internal static Form GetFormByFormCode(string FormCode)
{
Form form = null;
using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
{
SqlCommand sqlCommand = new SqlCommand(SN_FORM_GET_BY_CODE, sqlConnection);
sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
SqlParameter parameter = new SqlParameter(PN_FORM_CODE, System.Data.SqlDbType.NVarChar);
parameter.Direction = System.Data.ParameterDirection.Input;
parameter.Value = FormCode;
sqlCommand.Parameters.Add(parameter);
sqlCommand.Connection.Open();
using (SqlDataReader reader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
{
while (reader.Read())
{
if (form == null)
form = new Form();
FillFromReader(form, reader);
}
reader.Close();
sqlCommand.Connection.Close();
}
}
return form;
}