コード例 #1
0
        protected void imgbtnInputTypeEdit_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                ImageButton imgbtn = (ImageButton)sender;
                GridViewRow row    = (GridViewRow)imgbtn.NamingContainer;

                Label lblID  = (Label)gridviewInputType.Rows[row.RowIndex].FindControl("lblInputTypeId");
                int   itemID = Convert.ToInt32(lblID.Text);
                Session["lblID"] = lblID.Text;
                LC_InputType _InputType = inputTypeBll.GetInputByID(itemID);
                if (_InputType != null)
                {
                    hidInputid.Value          = _InputType.InputType_Id.ToString();
                    ddlDept.SelectedItem.Text = _InputType.Use_Dept;
                    txtbxInputType.Text       = _InputType.Input_Name;
                    txtSerial.Text            = _InputType.Sl_No.ToString();
                    btnInputTypeSubmit.Text   = "Update";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 internal int InsertInputType(LC_InputType InputTypeObj)
 {
     try
     {
         using (var context = new ERPSSL_LCEntities())
         {
             context.LC_InputType.AddObject(InputTypeObj);
             context.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message.ToString());
     }
 }
コード例 #4
0
        internal int UpdateInputType(LC_InputType InputTypeObj, int itemID)
        {
            try
            {
                using (var Context = new ERPSSL_LCEntities())
                {
                    LC_InputType ObjLC_MasterLC = Context.LC_InputType.FirstOrDefault(x => x.InputType_Id == itemID);
                    ObjLC_MasterLC.Use_Dept   = InputTypeObj.Use_Dept;
                    ObjLC_MasterLC.Input_Name = InputTypeObj.Input_Name;
                    ObjLC_MasterLC.Sl_No      = InputTypeObj.Sl_No;

                    Context.SaveChanges();
                    return(1);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
コード例 #5
0
 internal int UpdateInputType(LC_InputType InputTypeObj, int itemID)
 {
     return(InputTypeDal.UpdateInputType(InputTypeObj, itemID));
 }
コード例 #6
0
 internal int InsertInputType(LC_InputType InputTypeObj)
 {
     return(InputTypeDal.InsertInputType(InputTypeObj));
 }