Ejemplo n.º 1
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            Paras.SavingResult = new SavingResult();

            UserDetailModel loginUser = UserDAL.GetUserDetailModel(txtUserName.Text, txtPassword.Text);

            if (loginUser == null)
            {
                Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                Paras.SavingResult.ValidationError = "Please check, user name or password not matched.";
                return;
                //Alit.WinformControls.MessageBox.Show(this, "Please check, user name or password not matched.", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                //txtUserName.Focus();
                //return;
            }
            else
            {
                Model.CommonProperties.LoginInfo.LoggedinUser   = loginUser;
                Model.CommonProperties.LoginInfo.UserPermission = UserGroupDALObj.GetPermission(Model.CommonProperties.LoginInfo.LoggedinUser.UserGroupID);
            }

            Paras.SavingResult.ExecutionResult = eExecutionResult.NotExecutedYet;

            base.SaveRecord(Paras);
        }
Ejemplo n.º 2
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DAL.tblBiometricDevice SaveModel = null;
            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew || EditRecordDataSource == null)
            {
                SaveModel = new DAL.tblBiometricDevice();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((BiometricDeviceEditListModel)EditRecordDataSource).BMDID);

                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user.";
                    return;
                }
            }

            SaveModel.BMDTitle  = txtBMDTitle.Text;
            SaveModel.MachineNo = Model.CommonFunctions.ParseInt(txtMachineNo.Text);
            SaveModel.IPAddress = txtIPAddress.Text;
            SaveModel.PortNo    = Model.CommonFunctions.ParseInt(txtPortNo.Text);
            SaveModel.Password  = Model.CommonFunctions.ParseInt(txtPassword.Text);

            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel);
            base.SaveRecord(Paras);
        }
Ejemplo n.º 3
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DAL.tblUserGroup SaveModel = null;
            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew)
            {
                SaveModel = new DAL.tblUserGroup();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((UserGroupEditListModel)EditRecordDataSource).UserGroupID);

                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another UserGroup.";
                    return;
                }
            }

            SaveModel.UserGroupName = txtUserGroupName.Text;


            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel, (List <Model.Users.MenuOptionPermissionViewModel>)gridControlPermission.DataSource, (List <Model.Settings.CompanyMultiSelectLookupModel>)gvCompany.DataSource,
                                                         dsLocation);
            base.SaveRecord(Paras);
        }
Ejemplo n.º 4
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DAL.tblUser SaveModel = null;
            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew)
            {
                SaveModel = new DAL.tblUser();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((UserEditListModel)EditRecordDataSource).UserID);

                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user.";
                    return;
                }
            }

            SaveModel.UserName    = txtUserName.Text;
            SaveModel.Password    = txtPassword.Text;
            SaveModel.UserGroupID = (int)lookUpUserGroup.EditValue;
            SaveModel.EMailID     = txtEmailID.Text;

            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel);
            base.SaveRecord(Paras);
        }
Ejemplo n.º 5
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DAL.tblState SaveModel = null;

            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew || EditRecordDataSource == null)
            {
                SaveModel = new DAL.tblState();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((Model.City.StateEditListModel)EditRecordDataSource).StateID);

                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user.";
                    return;
                }
            }

            SaveModel.StateName = txtStateName.Text;
            SaveModel.CountryID = (int)lookUpCountry.EditValue;

            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel);
            base.SaveRecord(Paras);
        }
Ejemplo n.º 6
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DAL.tblFinPeriod SaveModel = null;
            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew || EditRecordDataSource == null)
            {
                SaveModel = new DAL.tblFinPeriod();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((FinPeriodEditListModel)EditRecordDataSource).FinPeriodID);

                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user.";
                    return;
                }
            }

            SaveModel.FinPeriodName = txtFinPerName.Text;
            SaveModel.FinPeriodFrom = (DateTime)deStartDate.EditValue;

            SaveModel.FinPeriodTo = (DateTime?)deEndDate.EditValue;

            SaveModel.CompanyID = Model.CommonProperties.LoginInfo.LoggedInCompany.CompanyID;

            List <AccountClosingBalanceViewModel> OpeningBalances = null;

            if (chkTransferAccountOpeningBalance.Checked)
            {
                OpeningBalances = (List <AccountClosingBalanceViewModel>)gridControlAccountBalance.DataSource;
            }
            List <ProductOpeningStockViewModel> OpeningStock = null;

            if (chkTransferProductStock.Checked)
            {
                OpeningStock = (List <ProductOpeningStockViewModel>)gridcontrolProductStock.DataSource;
            }

            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel, PrevFinPeriod, NextFinPeriod, OpeningBalances, OpeningStock);
            base.SaveRecord(Paras);
        }
Ejemplo n.º 7
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DAL.tblCity SaveModel = null;
            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew || EditRecordDataSource == null)
            {
                SaveModel = new DAL.tblCity();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((Model.City.CityEditListModel)EditRecordDataSource).CityID);

                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user.";
                    return;
                }
            }

            SaveModel.CityName = txtCityName.Text;
            //eCityType CityType = (eCityType)lookupCityType.EditValue;
            //SaveModel.CityType = (int)lookupCityType.EditValue;

            //SaveModel.TehsilID = (CityType == eCityType.Town ? (int?)lookupTehsil.EditValue : null);
            //SaveModel.DistrictID = (CityType == eCityType.Town || CityType == eCityType.Tehsil ? (int?)lookupDistrict.EditValue : null);

            if (lookupState.EditValue != null)
            {
                SaveModel.StateID = (int)lookupState.EditValue;
            }
            else
            {
                SaveModel.StateID = null;
            }
            //SaveModel.PIN = txtPIN.Text;
            //SaveModel.STDCode = txtSTDCode.Text;

            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel);
            base.SaveRecord(Paras);
        }
Ejemplo n.º 8
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DialogResult result = MessageBox.Show("Are you sure? you want to close current payroll month?", "Close Payroll month", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                tblPayrollMonth SaveModel = null;
                if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew)
                {
                    SaveModel = new tblPayrollMonth();
                }
                //SaveModel.tblCompany =
                SaveModel.CompanyID             = CommonProperties.LoginInfo.LoggedInCompany.CompanyID;
                SaveModel.PayrollMonthName      = txtNextMonthName.EditValue.ToString();
                SaveModel.PayrollMonth          = Convert.ToDateTime(txtNextMonthName.EditValue);
                SaveModel.PayrollMonthEndDate   = Convert.ToDateTime(txtNextMonthEndDate.EditValue);
                SaveModel.PayrollMonthStartDate = Convert.ToDateTime(txtNextMonthStartDate.EditValue);
                //SaveModel.rcdt = DateTime.Now;
                //SaveModel.rcuid = CommonProperties.LoginInfo.LoggedinUser.UserID;
                SavingParemeter SaveResult = new SavingParemeter();
                SaveResult.SavingResult = DALObject.SaveNewRecord(SaveModel);
                AfterSaving(SaveResult);
            }
        }
Ejemplo n.º 9
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            ApplicationSettingsViewModel ApplicationSetting = CommonProperties.LoginInfo.SoftwareSettings;

            #region Level 0
            CommonProperties.LoginInfo.SoftwareSettings.License_NofCompany = Model.CommonFunctions.ParseInt(txtLicense_NofCompany.Text);

            #region No Reply Email Setup
            CommonProperties.LoginInfo.SoftwareSettings.NoReply_EmailID  = txtNoReply_EmailID.Text;
            CommonProperties.LoginInfo.SoftwareSettings.NoReply_Password = txtNoReply_Password.Text;
            CommonProperties.LoginInfo.SoftwareSettings.NoReply_SMTPHost = txtNoReply_SMTPHost.Text;
            CommonProperties.LoginInfo.SoftwareSettings.NoReply_SMTPPort = Model.CommonFunctions.ParseInt(txtNoReply_SMTPPort.Text);
            CommonProperties.LoginInfo.SoftwareSettings.NoReply_SSL      = tswitchNoReply_SSL.IsOn;
            #endregion

            #endregion

            #region Level 1

            #region Document Location
            ApplicationSetting.DocumentLocation_EmployeeImage             = txtDocumentLocation_EmployeeImages.Text;
            ApplicationSetting.DocumentLocation_EmployeeDocument          = txtDocumentLocation_EmployeeDocument.Text;
            ApplicationSetting.DocumentLocation_LeaveApplicationDocument  = txtDocumentLocation_LeaveApplicationDocument.Text;
            ApplicationSetting.DocumentLocation_SafariApplicationDocument = txtDocumentLocation_SafariApplicationDocument.Text;
            ApplicationSetting.DocumentLocation_LoanApplicationDocument   = txtDocumentLocation_LoanApplicationDocument.Text;
            ApplicationSetting.DocumentLocation_LoanAdjustmentDocument    = txtDocumentLocation_LoanAdjustmentDocument.Text;
            ApplicationSetting.DocumentLocation_TAApprovalDocument        = txtDocumentLocation_TAApprovalDocument.Text;
            #endregion

            #region License
            //CommonProperties.LoginInfo.SoftwareSettings.License_NofEmployee = CommonFunctions.ParseInt(txtLicense_NofEmployee.Text);
            if (dsLicenseNofEmployee != null)
            {
                var rLicenseNofEmployee = dsLicenseNofEmployee.FirstOrDefault(r => r.CompanyID == CommonProperties.LoginInfo.LoggedInCompany.CompanyID);
                if (rLicenseNofEmployee != null)
                {
                    CommonProperties.LoginInfo.SoftwareSettings.License_NofEmployee = rLicenseNofEmployee.NofEmployee;
                    CommonProperties.LoginInfo.SoftwareSettings.License_ValidUpto   = rLicenseNofEmployee.ValidUpto;
                }
            }
            #endregion

            #region Employee
            CommonProperties.LoginInfo.SoftwareSettings.Employee_CurrentMonthLeaveAccumulateOn = (eEmployee_LeaveAccumulateOn)cmbEmployee_CurrentMonthLeaveAccumulateOn.SelectedIndex;
            #endregion

            #region Payroll
            ApplicationSetting.OvertimeRate          = (decimal)txtOvertimeRate.EditValue;
            ApplicationSetting.DoubleOvertimeRate    = (decimal)txtDoubleOvertimeRate.EditValue;
            ApplicationSetting.WorkingHoursPerWeek   = (decimal)txtWorkingHoursPerWeek.EditValue;
            ApplicationSetting.WorkingHoursPerDay    = (decimal)txtWorkingHoursPerDay.EditValue;
            ApplicationSetting.WorkingDaysPerMonth   = (decimal)txtWorkingDaysPerMonth.EditValue;
            ApplicationSetting.LatenessPenaltyAmount = (decimal)txtLatenessPenaltyAmount.EditValue;

            ApplicationSetting.PFContributionEmployer = (decimal)txtPFContributionEmployer.EditValue;
            ApplicationSetting.PFContributionEmployee = (decimal)txtPFContributionEmployee.EditValue;

            #endregion

            #endregion

            Paras.SavingResult = DALObject.SaveSettings(ApplicationSetting
                                                        , CommonProperties.LoginInfo.LoggedInCompany.CompanyID
                                                        , dsLicenseNofEmployee);
            //Model.CommonProperties.LoginInfo.SoftwareSettings = DALObject.GetSetting();
            base.SaveRecord(Paras);
        }
Ejemplo n.º 10
0
        public override void SaveRecord(Model.SavingParemeter Paras)
        {
            DAL.tblCompany SaveModel = null;

            DAL.tblPayrollMonth PayRollMonth = null;


            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew || EditRecordDataSource == null)
            {
                SaveModel = new tblCompany();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((CompanyEditListModel)EditRecordDataSource).CompanyID);

                PayRollMonth = PayrollMonthDAL.GetLatestPayrollMonthByCompanyID(((CompanyEditListModel)EditRecordDataSource).CompanyID);
                //DO SOMETHING HERE FOR PAYROLLMONTH
                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user.";
                    return;
                }
            }

            // on Creating new company or while editing there is no month exists.
            if (PayRollMonth == null)
            {
                PayRollMonth = new tblPayrollMonth()
                {
                    tblCompany = SaveModel
                };
            }


            SaveModel.CompanyCode = Model.CommonFunctions.ParseInt(txtCode.Text) + 1;
            SaveModel.CompanyName = txtCompanyName.Text;
            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew)
            {
                SaveModel.BusinessStartedFrom = (DateTime)deBusinessStartedFrom.EditValue;
            }
            SaveModel.CurrencyID = (int)lookupCurrency.EditValue;
            //SaveModel.CompanyLogoFileName = CompanyLogoSelectedFileName;

            SaveModel.Address1 = txtAddressLine1.Text;
            SaveModel.Address2 = txtAddressLine2.Text;
            SaveModel.Address3 = txtAddressLine3.Text;

            SaveModel.CityID = (int)lookupCity.EditValue;
            SaveModel.PIN    = txtPin.Text;

            SaveModel.Phone1    = txtPhone1.Text;
            SaveModel.Phone2    = txtPhoneNo2.Text;
            SaveModel.MobileNo1 = txtMobileNo1.Text;
            SaveModel.MobileNo2 = txtMobileNo2.Text;
            SaveModel.EMailID   = txtEMailID.Text;
            SaveModel.Website   = txtWebsite.Text;

            SaveModel.IncorporationNo   = txtIncorporationNo.Text;
            SaveModel.IncorporationDate = deIncorporationDate.DateTime;
            SaveModel.PINNo_RegNo       = txtPINNo.Text;
            SaveModel.NSSFNo            = txtNSSFNo.Text;
            SaveModel.NHIFNo            = txtNHIFNo.Text;
            SaveModel.PFNo       = txtPFNo.Text;
            SaveModel.SaccoRegNo = txtSACCORegNo.Text;

            SaveModel.Bank1_AccountNo  = txtBank1_AcNo.Text;
            SaveModel.Bank1_Name       = txtBank1_Name.Text;
            SaveModel.Bank1_BranchName = txtBank1_BranchName.Text;
            SaveModel.Bank1_Currency   = txtBank1_Currency.Text;

            SaveModel.Bank2_AccountNo  = txtBank2_AcNo.Text;
            SaveModel.Bank2_Name       = txtBank2_Name.Text;
            SaveModel.Bank2_BranchName = txtBank2_BranchName.Text;
            SaveModel.Bank2_Currency   = txtBank2_Currency.Text;

            SaveModel.Bank3_AccountNo  = txtBank3_AcNo.Text;
            SaveModel.Bank3_Name       = txtBank3_Name.Text;
            SaveModel.Bank3_BranchName = txtBank3_BranchName.Text;
            SaveModel.Bank3_Currency   = txtBank3_Currency.Text;

            PayRollMonth.PayrollMonthStartDate = payRollStartDate.DateTime;
            PayRollMonth.PayrollMonthEndDate   = payRollEndDate.DateTime;
            PayRollMonth.PayrollMonthName      = payRollEndDate.DateTime.ToString("MMMM-yyyy"); //this is not user selectable
            PayRollMonth.PayrollMonth          = payRollEndDate.DateTime.Date;

            long?CopySettingsFromCompanyID = null;

            //if(lcgSettings.Visibility != DevExpress.XtraLayout.Utils.LayoutVisibility.Never)
            //{
            //    CopySettingsFromCompanyID = (long?)lookupCopySettingFromCompany.EditValue;
            //}

            /// In Editing if logo image is cleared
            if (SaveModel.CompanyLogoFileName != null && CompanyLogoSelectedFileName == null)
            {
                try
                {
                    File.Delete(SaveModel.CompanyLogoFileName);
                }
                catch (Exception) { }
                SaveModel.CompanyLogoFileName = null;
            }

            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel, CopySettingsFromCompanyID, PayRollMonth);


            /// CompanyLogoSelectedFileName != null -- it means user has changed logo image
            if (CompanyLogoSelectedFileName != null &&
                Paras.SavingResult.ExecutionResult == eExecutionResult.CommitedSucessfuly &&
                SaveModel.CompanyLogoFileName != CompanyLogoSelectedFileName)
            {
                string LogoImageCopiedFileName = null;

                // to seperate both process file copy and saving file name in db, so that if exception occures than we can get in which part the exception occured
                bool IsFileCopied = false;

                // Copieng Image File
                if (System.IO.File.Exists(CompanyLogoSelectedFileName))
                {
                    string ImageDirectory = null;
                    if (CommonProperties.LoginInfo.SoftwareSettings.DocumentLocation_EmployeeImage != null)
                    {
                        ImageDirectory = CommonProperties.LoginInfo.SoftwareSettings.DocumentLocation_EmployeeImage + @"\Logo\";
                    }
                    else
                    {
                        ImageDirectory = @"\..\IMAGES\Logo\";
                        System.IO.Directory.CreateDirectory(ImageDirectory);
                    }

                    if (!Directory.Exists(ImageDirectory))
                    {
                        Directory.CreateDirectory(ImageDirectory);
                    }

                    LogoImageCopiedFileName = ImageDirectory + "" + ((int)Paras.SavingResult.PrimeKeyValue).ToString() + System.IO.Path.GetExtension(CompanyLogoSelectedFileName);
                    IsFileCopied            = false;

                    try
                    {
                        if (File.Exists(LogoImageCopiedFileName))
                        {
                            File.Delete(LogoImageCopiedFileName);
                        }
                        File.Copy(CompanyLogoSelectedFileName, LogoImageCopiedFileName);
                        IsFileCopied = true;
                    }
                    catch (Exception ex)
                    {
                        ex = DAL.CommonFunctions.GetFinalError(ex);
                        Paras.SavingResult.MessageAfterSave = "Error while trying to copy log image file. Please check following error \r\n" + ex.Message;
                    }

                    // if file successfully copied only then save file name
                    if (IsFileCopied)
                    {
                        SavingResult res = DALObject.SaveLogoFileName((int)Paras.SavingResult.PrimeKeyValue, LogoImageCopiedFileName);
                        if (res.ExecutionResult != eExecutionResult.CommitedSucessfuly && res.ExecutionResult != eExecutionResult.NotExecutedYet)
                        {
                            if (res.ExecutionResult == eExecutionResult.ErrorWhileExecuting)
                            {
                                Paras.SavingResult.MessageAfterSave = "Error while saving logo image file name.\r\n" + (res.Exception != null ? res.Exception.Message : "");
                            }
                            else if (res.ExecutionResult == eExecutionResult.ValidationError)
                            {
                                Paras.SavingResult.MessageAfterSave = "Error while saving logo image file name \r\n" + res.ValidationError;
                            }
                        }
                    }
                }
            }

            base.SaveRecord(Paras);
        }