public Int64 SaveRequestFormTemplate(RequestTemplateDetails requestTemplate)
 {
     Logging.LogDebugMessage("Method: SaveRequestFormTemplate, MethodType: Post, Layer: RequestFormController, Parameters:  requestTemplate = " + JsonConvert.SerializeObject(requestTemplate));
     using (RequestFormBL requestFormBL = new RequestFormBL())
     {
         return(requestFormBL.SaveRequestFormTemplate(requestTemplate));
     }
 }
Esempio n. 2
0
 /// <summary> Save or Update RequestFormTemplate </summary>
 /// <param name="requestTemplate">RequestTemplate Object</param>
 /// <returns>Integer Object</returns>
 public Int64 SaveRequestFormTemplate(RequestTemplateDetails requestTemplate)
 {
     Logging.LogDebugMessage("Method: SaveRequestFormTemplate, MethodType: Post, Layer: RequestFormBL, Parameters:  requestTemplate = " + JsonConvert.SerializeObject(requestTemplate));
     try
     {
         using (RequestFormDAL requestDL = new RequestFormDAL())
         {
             if (requestTemplate.RequestTemplateId == 0)
             {
                 RequestTemplateSection rs1 = new RequestTemplateSection();
                 rs1.RequestTemplateSectionId = 0;
                 rs1.RequestTemplateId        = 0;
                 rs1.TaskStepName             = "Location";
                 rs1.SeqNo        = 1;
                 rs1.SectionName  = "Location";
                 rs1.SectionTitle = "Location";
                 rs1.IsRequired   = true;
                 rs1.RowStatus    = "A";
                 requestTemplate.requestTemplateSection.Add(rs1);
                 RequestTemplateSection rs2 = new RequestTemplateSection();
                 rs2.RequestTemplateSectionId = 0;
                 rs2.RequestTemplateId        = 0;
                 rs2.TaskStepName             = "Photo";
                 rs2.SeqNo        = 2;
                 rs2.SectionName  = "Photo";
                 rs2.SectionTitle = "Photo";
                 rs2.IsRequired   = true;
                 rs2.RowStatus    = "A";
                 requestTemplate.requestTemplateSection.Add(rs2);
                 RequestTemplateSection rs3 = new RequestTemplateSection();
                 rs3.RequestTemplateSectionId = 0;
                 rs3.RequestTemplateId        = 0;
                 rs3.TaskStepName             = "Details";
                 rs3.SeqNo        = 3;
                 rs3.SectionName  = "Details";
                 rs3.SectionTitle = "Details";
                 rs3.IsRequired   = true;
                 rs3.RowStatus    = "A";
                 requestTemplate.requestTemplateSection.Add(rs3);
                 RequestTemplateSection rs4 = new RequestTemplateSection();
                 rs4.RequestTemplateSectionId = 0;
                 rs4.RequestTemplateId        = 0;
                 rs4.TaskStepName             = "Submit";
                 rs4.SeqNo        = 4;
                 rs4.SectionName  = "Submit";
                 rs4.SectionTitle = "Submit";
                 rs4.IsRequired   = true;
                 rs4.RowStatus    = "A";
                 requestTemplate.requestTemplateSection.Add(rs4);
                 RequestTemplateSection rs5 = new RequestTemplateSection();
                 rs5.RequestTemplateSectionId = 0;
                 rs5.RequestTemplateId        = 0;
                 rs5.TaskStepName             = "Register or Sign In";
                 rs5.SeqNo        = 5;
                 rs5.SectionName  = "Register or Sign In";
                 rs5.SectionTitle = "Register or Sign In";
                 rs5.IsRequired   = true;
                 rs5.RowStatus    = "A";
                 requestTemplate.requestTemplateSection.Add(rs5);
                 RequestTemplateSection rs6 = new RequestTemplateSection();
                 rs6.RequestTemplateSectionId = 0;
                 rs6.RequestTemplateId        = 0;
                 rs6.TaskStepName             = "Submit Request";
                 rs6.SeqNo        = 4;
                 rs6.SectionName  = "Submit Request";
                 rs6.SectionTitle = "Submit Request";
                 rs6.IsRequired   = true;
                 rs6.RowStatus    = "A";
                 requestTemplate.requestTemplateSection.Add(rs6);
             }
             return(requestDL.SaveRequestFormTemplate(requestTemplate));
         }
     }
     catch (SqlException sqlEx)
     {
         Logging.LogErrorMessage("Method: SaveRequestFormTemplate, Layer: RequestFormBL, Stack Trace: " + sqlEx.ToString());
         throw;
     }
     catch (Exception ex)
     {
         Logging.LogErrorMessage("Method: SaveRequestFormTemplate, Layer: RequestFormBL, Stack Trace: " + ex.ToString());
         throw;
     }
 }
Esempio n. 3
0
        /// <summary> Save or Update RequestFormTemplate </summary>
        /// <param name="requestTemplate">RequestTemplate Object</param>
        /// <returns>Integer Object</returns>
        public Int64 SaveRequestFormTemplate(RequestTemplateDetails requestTemplate)
        {
            var   dataset    = new DataSet();
            Int64 templateId = 0;

            Logging.LogDebugMessage("Method: SaveRequestFormTemplate, MethodType: Post, Layer: RequestFormDAL, Parameters:  requestTemplate = " + JsonConvert.SerializeObject(requestTemplate));
            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_SaveRequestFormTemplate_V1";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTemplateId", Value = requestTemplate.RequestTemplateId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestName", Value = requestTemplate.RequestName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestDescription", Value = requestTemplate.RequestDescription
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@DisplayType", Value = requestTemplate.DisplayType
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestCategoryId", Value = requestTemplate.RequestCategoryId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserId", Value = requestTemplate.UserId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Visibility", Value = requestTemplate.Visibility
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Priority", Value = requestTemplate.Priority
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RowStatus", Value = requestTemplate.RowStatus
                    });
                    DataTable dataTableOne = new DataTable();
                    dataTableOne = EntityCollectionHelper.ConvertTo <RequestTemplateSection>(requestTemplate.requestTemplateSection);
                    DataTable dataTableTwo = new DataTable();
                    dataTableTwo = EntityCollectionHelper.ConvertTo <RequestTemplateSectionControl>(requestTemplate.requestTemplateSectionControl);
                    DataTable    dataTableThree     = new DataTable();
                    SqlParameter structuredParamOne = new SqlParameter("@RequestTemplateSection", SqlDbType.Structured);
                    structuredParamOne.Value = dataTableOne;
                    command.Parameters.Add(structuredParamOne);
                    SqlParameter structuredParamTwo = new SqlParameter("@RequestTemplateSectionControl", SqlDbType.Structured);
                    structuredParamTwo.Value = dataTableTwo;
                    command.Parameters.Add(structuredParamTwo);
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataset);
                        if (dataset != null)
                        {
                            templateId = Convert.ToInt64(dataset.Tables[0].Rows[0][0]);
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: SaveRequestFormTemplate, Layer: RequestFormDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: SaveRequestFormTemplate, Layer: RequestFormDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(templateId);
        }