Ejemplo n.º 1
0
        public SavingResult SaveNewRecord(tblEmployeeSalaryIncrement SaveModel)
        {
            SavingResult res = new SavingResult();

            using (dbVisionEntities db = new dbVisionEntities())
            {
                if (SaveModel.EmployeeSalaryIncrementID == 0)
                {
                    SaveModel.rcuid       = Model.CommonProperties.LoginInfo.LoggedinUser.UserID;
                    SaveModel.rcdt        = DateTime.Now;
                    SaveModel.CompanyID   = Model.CommonProperties.LoginInfo.LoggedInCompany.CompanyID;
                    SaveModel.FinPeriodID = CommonProperties.LoginInfo.LoggedInFinPeriod.FinPeriodID;
                    db.tblEmployeeSalaryIncrements.Add(SaveModel);
                }
                else
                {
                    SaveModel.reuid = Model.CommonProperties.LoginInfo.LoggedinUser.UserID;
                    SaveModel.redt  = DateTime.Now;
                    db.tblEmployeeSalaryIncrements.Attach(SaveModel);
                    db.Entry(SaveModel).State = System.Data.Entity.EntityState.Modified;
                }

                var tblService = db.tblEmployeeServiceDetails.Where(p => p.EmployeeID == SaveModel.EmployeeID).FirstOrDefault();
                if (tblService != null)
                {
                    tblService.BasicSalary = SaveModel.NewBasicSalary;
                }

                try
                {
                    db.SaveChanges();
                    res.PrimeKeyValue   = SaveModel.EmployeeSalaryIncrementID;
                    res.ExecutionResult = eExecutionResult.CommitedSucessfuly;
                }
                catch (Exception ex)
                {
                    CommonFunctions.GetFinalError(res, ex);
                }
            }
            return(res);
        }
Ejemplo n.º 2
0
        public override void FillSelectedRecordInContent(object RecordToFill)
        {
            EmployeeSalaryIncrementID = ((EmployeeSalaryIncrementEditListModel)RecordToFill).EmployeeSalaryIncrementID;
            tblEmployeeSalaryIncrement SaveModel = DALObj.FindSaveModelByPrimeKey(EmployeeSalaryIncrementID);
            if (SaveModel == null)
            {
                return;
            }

            txtEmployee.EditValue = SaveModel.EmployeeID;
            txtTransectionNo.EditValue = SaveModel.EmployeeSalaryIncrementNo;
            txtCurrentBasicSalary.EditValue = SaveModel.CurrentBasicSalary;
            cmbIncrementType.SelectedIndex = SaveModel.IncrementType;
            txtIncrementAmount.EditValue = SaveModel.IncrementAmount;
            txtIncrementPercentage.EditValue = SaveModel.IncrementPercentage;
            dtpTransectionDate.EditValue = SaveModel.EmployeeSalaryIncrementDate;
            dtpEffectiveMonth.EditValue = DateFrom.ToString("MMMM-yyyy");
            txtNewBasicSalary.EditValue = SaveModel.NewBasicSalary;
            txtLastIncAmount.EditValue = SaveModel.LastIncAmount;
            dtpLastIncDate.Text = SaveModel.LastIncDate == null ? "" : SaveModel.LastIncDate.Value.ToString("dd-MM-yyyy");
            txtRemarks.EditValue = SaveModel.Remarks;
            base.FillSelectedRecordInContent(RecordToFill);
        }
Ejemplo n.º 3
0
        public SavingResult DeleteRecord(long DeleteID)
        {
            SavingResult res = new SavingResult();

            using (dbVisionEntities db = new dbVisionEntities())
            {
                if (DeleteID != 0)
                {
                    tblEmployeeSalaryIncrement RecordToDelete = db.tblEmployeeSalaryIncrements.FirstOrDefault(r => r.EmployeeSalaryIncrementID == DeleteID);

                    if (RecordToDelete == null)
                    {
                        res.ValidationError = "Selected record not found. May be it has been deleted by another user over network.";
                        res.ExecutionResult = eExecutionResult.ValidationError;
                        return(res);
                    }
                    else
                    {
                        byte RecordState_Deleted = (byte)eRecordState.Deleted;
                        RecordToDelete.rState = RecordState_Deleted;
                        db.tblEmployeeSalaryIncrements.Attach(RecordToDelete);
                        db.Entry(RecordToDelete).State = System.Data.Entity.EntityState.Modified;
                    }

                    try
                    {
                        db.SaveChanges();
                        res.ExecutionResult = eExecutionResult.CommitedSucessfuly;
                    }
                    catch (Exception ex)
                    {
                        CommonFunctions.GetFinalError(res, ex);
                    }
                }
            }
            return(res);
        }