コード例 #1
0
ファイル: GRADE_DAL.cs プロジェクト: Denar87/Asp.Net-Source
        //-------Update------------------------------------
        public int UpdateGrade(HRM_GRADE objGrd, int gradeId)
        {
            try
            {
                HRM_GRADE obj = _context.HRM_GRADE.First(x => x.GRADE_ID == gradeId);
                obj.STEP       = objGrd.STEP;
                obj.GRADE      = objGrd.GRADE;
                obj.GROSS_SAL  = objGrd.GROSS_SAL;
                obj.HOUSE_RENT = objGrd.HOUSE_RENT;
                obj.BASIC      = objGrd.BASIC;
                obj.MEDICAL    = objGrd.MEDICAL;
                obj.CONVEYANCE = objGrd.CONVEYANCE;
                obj.FOOD_ALLOW = objGrd.FOOD_ALLOW;
                obj.OTHERS     = objGrd.OTHERS;
                obj.EDIT_USER  = objGrd.EDIT_USER;
                obj.EDIT_DATE  = DateTime.Now;
                obj.OCODE      = objGrd.OCODE;

                _context.SaveChanges();
                return(1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                decimal GROSS_SAL  = Convert.ToDecimal(txtGrsSal.Text);
                decimal HOUSE_RENT = Convert.ToDecimal(txtHouseRent.Text);
                decimal BASIC      = Convert.ToDecimal(txtBasic.Text);
                decimal MEDICAL    = Convert.ToDecimal(txtMedical.Text);
                decimal CONVEYANCE = Convert.ToDecimal(txtConveyance.Text);
                decimal FOOD_ALLOW = Convert.ToDecimal(txtFoodAllowance.Text);
                decimal OTHERS     = Convert.ToDecimal(txtOthers.Text);

                decimal TOTAL = (BASIC + HOUSE_RENT + MEDICAL + CONVEYANCE + FOOD_ALLOW + OTHERS);

                if (GROSS_SAL == TOTAL)
                {
                    int gradeId = Convert.ToInt32(lblID.Text);
                    System.Threading.Thread.Sleep(2000);

                    HRM_GRADE objGrd = new HRM_GRADE();
                    objGrd.STEP  = Convert.ToInt32(drpStep.SelectedValue);
                    objGrd.GRADE = txtGrade.Text;

                    objGrd.GROSS_SAL = Convert.ToDecimal(txtGrsSal.Text);

                    objGrd.HOUSE_RENT = Convert.ToDecimal(txtHouseRent.Text);
                    objGrd.BASIC      = Convert.ToDecimal(txtBasic.Text);
                    objGrd.MEDICAL    = Convert.ToDecimal(txtMedical.Text);
                    objGrd.CONVEYANCE = Convert.ToDecimal(txtConveyance.Text);
                    objGrd.FOOD_ALLOW = Convert.ToDecimal(txtFoodAllowance.Text);
                    objGrd.OTHERS     = Convert.ToDecimal(txtOthers.Text);

                    objGrd.REMARKS = Convert.ToString(txtRemarks.Text);

                    objGrd.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId;
                    objGrd.EDIT_DATE = DateTime.Now;
                    objGrd.OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                    int result = objGrd_BLL.UpdateGrade(objGrd, gradeId);
                    if (result == 1)
                    {
                        lblModalMessage.Text      = "Record Updated successfully!";
                        lblModalMessage.ForeColor = System.Drawing.Color.Green;
                        BindGridGrade();
                    }
                }
                else
                {
                    lblModalMessage.Text      = "Gross Total is not Equal to Misc. Total!";
                    lblModalMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
コード例 #3
0
ファイル: GRADE_DAL.cs プロジェクト: Denar87/Asp.Net-Source
 //-------Insert------------------------------------
 public int InsertGrade(HRM_GRADE objGrd)
 {
     try
     {
         _context.HRM_GRADE.AddObject(objGrd);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message.ToString());
     }
 }
コード例 #4
0
 //-------Update------------------------------------
 public int UpdateGrade(HRM_GRADE objGrd, int gradeId)
 {
     return(objCtx_DAL.UpdateGrade(objGrd, gradeId));
 }
コード例 #5
0
 //-------Insert------------------------------------
 public int InsertGrade(HRM_GRADE objGrd)
 {
     return(objCtx_DAL.InsertGrade(objGrd));
 }