public EntityAllowanceDeduction GetDeduction(int DedId) { try { EntityAllowanceDeduction lst = (from tbl in objData.tblAllowanceDeductions where tbl.IsDelete == false && tbl.IsDeduction == true && tbl.AllowDedId == DedId select new EntityAllowanceDeduction { AllowDedId = tbl.AllowDedId, Percentage = tbl.Percentage, IsPercentage = tbl.IsPercentage, IsFixed = tbl.IsFixed, IsFlexible = tbl.IsFlexible, Amount = tbl.Amount }).FirstOrDefault(); return(lst); } catch (Exception ex) { throw ex; } }
protected void ddlDeduction_SelectedIndexChanged(object sender, EventArgs e) { try { EntityAllowanceDeduction lst = mobjSalBLL.GetDeduction(Convert.ToInt32(ddlDeduction.SelectedValue)); if (lst.IsPercentage == true) { txtDedAmount.Text = Convert.ToString((Convert.ToDecimal(lblbaseSal.Text) * lst.Percentage) / 100); } else { if (lst.IsFlexible == true) { txtDedAmount.Enabled = true; } else { txtDedAmount.Text = Convert.ToString(lst.Amount); } } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
public EntityAllowanceDeduction GetAllowDed(EntityAllowanceDeduction ent) { EntityAllowanceDeduction cnt = (from tbl in objData.tblAllowanceDeductions where tbl.Description.Equals(ent.Description) select new EntityAllowanceDeduction { Description = tbl.Description }).FirstOrDefault(); return(cnt); }
public EntityAllowanceDeduction GetDetailsDeduction(int deductionId) { EntityAllowanceDeduction lst = (from tbl in objData.tblAllowanceDeductions where tbl.IsDelete == false && tbl.IsDeduction == true && tbl.AllowDedId == deductionId select new EntityAllowanceDeduction { AllowDedId = tbl.AllowDedId, Percentage = tbl.Percentage, Amount = tbl.Amount, IsPercentage = tbl.IsPercentage, IsFixed = tbl.IsFixed, IsFlexible = tbl.IsFlexible, }).FirstOrDefault(); return(lst); }
internal EntityAllowanceDeduction GetAllowID(int LedgerId) { EntityAllowanceDeduction lst = (from tbl in objData.tblAllowanceDeductions where tbl.IsDelete == false && tbl.AllowDedId == LedgerId select new EntityAllowanceDeduction { AllowDedId = tbl.AllowDedId, Description = tbl.Description, Percentage = tbl.Percentage, Amount = tbl.Amount, IsPercentage = tbl.IsPercentage, IsFixed = tbl.IsFixed, IsFlexible = tbl.IsFlexible, IsAllowance = tbl.IsAllowance, IsDeduction = tbl.IsDeduction, }).FirstOrDefault(); return(lst); }
public void Save(EntityAllowanceDeduction objInfo) { try { tblAllowanceDeduction objBatch = new tblAllowanceDeduction(); objBatch.Description = objInfo.Description; objBatch.IsFlexible = objInfo.IsFlexible; objBatch.IsFixed = objInfo.IsFixed; objBatch.IsPercentage = objInfo.IsPercentage; objBatch.Amount = objInfo.Amount; objBatch.Percentage = objInfo.Percentage; objBatch.IsAllowance = objInfo.IsAllowance; objBatch.IsDeduction = objInfo.IsDeduction; objBatch.IsBasic = objInfo.IsBasic.Value; objData.tblAllowanceDeductions.InsertOnSubmit(objBatch); objData.SubmitChanges(); } catch (Exception ex) { throw ex; } }
public void Update(EntityAllowanceDeduction objT) { try { tblAllowanceDeduction obj = (from tbl in objData.tblAllowanceDeductions where tbl.AllowDedId == objT.AllowDedId && tbl.IsDelete == false select tbl).FirstOrDefault(); obj.Description = objT.Description; obj.Amount = objT.Amount; obj.Percentage = objT.Percentage; obj.IsFlexible = objT.IsFlexible; obj.IsFixed = objT.IsFixed; obj.IsPercentage = objT.IsPercentage; obj.IsAllowance = objT.IsAllowance; obj.IsDeduction = objT.IsDeduction; objData.SubmitChanges(); } catch (Exception ex) { throw ex; } }
public EntityAllowanceDeduction ValidateByName(EntityAllowanceDeduction objInfo) { try { tblAllowanceDeduction objBatch = (from tbl in objData.tblAllowanceDeductions where tbl.Description.ToUpper().Equals(objInfo.Description) && tbl.IsDelete == false select tbl).FirstOrDefault(); if (objBatch != null) { return(objInfo); } else { return(null); } } catch (Exception ex) { throw ex; } }
protected void ddlAllowance_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlAllowance.SelectedIndex > 0) { EntityAllowanceDeduction lst = mobjSalBLL.GetAllowances(Convert.ToInt32(ddlAllowance.SelectedValue)); if (lst.IsPercentage == true) { txtAllowAmount.ReadOnly = true; txtAllowAmount.Enabled = false; txtAllowAmount.Text = Convert.ToString(decimal.Round(Convert.ToDecimal(Convert.ToDecimal(lblbaseSal.Text) * lst.Percentage / 100), 2)); } else { if (lst.IsFlexible == true) { if (lst.IsBasic != null) { if (lst.IsBasic.Value) { txtAllowAmount.Text = Convert.ToString(decimal.Round(Convert.ToDecimal(lblbaseSal.Text), 2)); txtAllowAmount.Enabled = false; txtAllowAmount.ReadOnly = false; } else { txtAllowAmount.Enabled = true; } } else { txtAllowAmount.Enabled = true; } } else { if (lst.IsBasic != null) { if (lst.IsBasic.Value) { txtAllowAmount.Text = Convert.ToString(decimal.Round(Convert.ToDecimal(lblbaseSal.Text), 2)); txtAllowAmount.Enabled = false; txtAllowAmount.ReadOnly = false; } else { if (lst.IsFlexible) { txtAllowAmount.Enabled = true; } else { txtAllowAmount.Text = Convert.ToString(decimal.Round(lst.Amount, 2)); txtAllowAmount.Enabled = false; } } } else { txtAllowAmount.Enabled = true; } } } } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
protected void BtnSave_Click(object sender, EventArgs e) { try { MyFlag = "Save"; EntityAllowanceDeduction AllowDed = new EntityAllowanceDeduction(); if (RdAllowance.Checked == true) { AllowDed.Description = txtDescription.Text.Trim().ToUpper(); AllowDed.IsFixed = RdFixed.Checked; AllowDed.IsFlexible = RdFlexible.Checked; AllowDed.IsPercentage = RdPercentage.Checked; AllowDed.IsBasic = ChkIsbasic.Checked ? true : false; if (RdPercentage.Checked == true) { int amt = Convert.ToInt32(txtAmount.Text); if (amt >= 100 || amt <= 0) { lblMsg.Text = "Please Enter Correct Percentage Value "; txtAmount.Focus(); return; } else { AllowDed.Percentage = Convert.ToInt32(txtAmount.Text); } } else if (RdFlexible.Checked) { AllowDed.Amount = 0; } else if (ChkIsbasic.Checked) { AllowDed.Amount = 0; } else { AllowDed.Amount = Convert.ToDecimal(txtAmount.Text); } AllowDed.IsAllowance = true; AllowDed.IsDeduction = false; } if (RdDeduction.Checked == true) { AllowDed.IsBasic = false; AllowDed.Description = txtDescription.Text.ToUpper().Trim(); AllowDed.IsFixed = RdFixed.Checked; AllowDed.IsFlexible = RdFlexible.Checked; AllowDed.IsPercentage = RdPercentage.Checked; if (RdPercentage.Checked == true) { int check = Convert.ToInt32(txtAmount.Text); if (check >= 100 || check <= 0) { lblMsg.Text = "Please Enter Correct Percentage Value"; txtAmount.Focus(); return; } else { AllowDed.Percentage = Convert.ToInt32(txtAmount.Text); } } else if (RdFlexible.Checked) { AllowDed.Amount = 0; } else { AllowDed.Amount = Convert.ToDecimal(txtAmount.Text); } AllowDed.IsAllowance = false; AllowDed.IsDeduction = true; } if (objallow.ValidateByName(AllowDed) == null) { objallow.Save(AllowDed); btnAddNew.Visible = true; GetAllowanceDed(); Clear(); MultiView1.SetActiveView(View1); } else { lblMsg.Text = "Allowance Or Deduction Name is Already Exist.."; txtDescription.Focus(); txtDescription.Text = string.Empty; } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
protected void BtnEdit_Click(object sender, EventArgs e) { //int lintcount = 0; try { EntityAllowanceDeduction ent = new EntityAllowanceDeduction(); ent.AllowDedId = Convert.ToInt32(Session["AllowDedId"]); ent.Description = txtDescription.Text; ent.IsAllowance = RdAllowance.Checked; ent.IsDeduction = RdDeduction.Checked; ent.IsFixed = RdFixed.Checked; ent.IsFlexible = RdFlexible.Checked; ent.IsPercentage = RdPercentage.Checked; if (RdPercentage.Checked == true) { int check = Convert.ToInt32(txtAmount.Text); if (check >= 100 || check <= 0) { lblMsg.Text = "Please Enter Correct Percentage Value"; txtAmount.Focus(); return; } else { ent.Percentage = Convert.ToInt32(txtAmount.Text); } } else if (RdFlexible.Checked) { ent.Amount = 0; } else { ent.Amount = Convert.ToDecimal(txtAmount.Text); } if (objallow.ValidateDescName(ent) != null) { objallow.Update(ent); lblMessage.Text = "Record Updated Successfully."; GetAllowanceDed(); } else { if (objallow.ValidateByName(ent) == null) { objallow.Update(ent); lblMessage.Text = "Record Updated Successfully."; GetAllowanceDed(); } else { lblMessage.Text = "Record Already Exist..."; txtDescription.Text = string.Empty; txtDescription.Focus(); } } } catch (Exception ex) { lblMessage.Text = ex.Message; } MultiView1.SetActiveView(View1); }