protected void btnInputTypeSubmit_Click(object sender, EventArgs e) { try { LC_InputType InputTypeObj = new LC_InputType(); if (chkDept.Checked == true) { LC_Input_Department InputDeptObj = new LC_Input_Department(); InputTypeObj.Use_Dept = txtDept.Text; string inputDept = InputTypeObj.Use_Dept; InputDeptObj.InputDept_NAME = inputDept; InputDeptObj.CreateUser = ((SessionUser)Session["SessionUser"]).UserId; InputDeptObj.CreateDate = DateTime.Now; InputDeptObj.OCODE = ((SessionUser)Session["SessionUser"]).OCode; var result = inputTypeBll.InsertInputDepartment(InputDeptObj); } else { InputTypeObj.Use_Dept = ddlDept.SelectedItem.Text; } InputTypeObj.Input_Name = txtbxInputType.Text; InputTypeObj.Sl_No = Convert.ToInt32(txtSerial.Text); InputTypeObj.CreateUser = ((SessionUser)Session["SessionUser"]).UserId; InputTypeObj.CreateDate = DateTime.Now; InputTypeObj.OCode = ((SessionUser)Session["SessionUser"]).OCode; if (btnInputTypeSubmit.Text == "Submit") { int result = inputTypeBll.InsertInputType(InputTypeObj); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true); } } else { int itemID = Convert.ToInt32(hidInputid.Value); int results = inputTypeBll.UpdateInputType(InputTypeObj, itemID); if (results == 1) { //lblMessage.Text = "Data Update Successfully"; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true); btnInputTypeSubmit.Text = "Submit"; } } ClearUI(); ShowInputType(); chkDept.Checked = false; txtDept.Visible = false; ddlDept.Visible = true; GetDepartment(); } catch (Exception ex) { throw ex; } }
internal int InsertInputDepartment(LC_Input_Department InputDeptObj) { try { using (var context = new ERPSSL_LCEntities()) { context.LC_Input_Department.AddObject(InputDeptObj); context.SaveChanges(); return(1); } } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } }
internal int InsertInputDepartment(LC_Input_Department InputDeptObj) { return(InputTypeDal.InsertInputDepartment(InputDeptObj)); }