Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ServiceMASTERS service = new ServiceMASTERS();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }
                tbl_Acct_Financial_Year model = null;
                if (FIN_YEAR_ID == 0)
                {
                    model = new tbl_Acct_Financial_Year();
                }
                else
                {
                    model = service.GetFinancialYearDbRecordByID(FIN_YEAR_ID);
                }

                model.FK_CompanyID = ((SelectListItem)cboCompany.SelectedItem).ID;
                model.FK_BranchID  = ((SelectListItem)cboBranch.SelectedItem).ID;
                model.FromDate     = dtFromDate.Value;
                model.ToDate       = dtToDate.Value;
                model.FinYearName  = txtFinYearName.Text;

                if (FIN_YEAR_ID == 0)
                {
                    FIN_YEAR_ID = service.AddNewFinancialYear(model);
                }
                else
                {
                    service.UpdateFinancialYear(model);
                }

                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditFinYear::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        public void PopulateEmployeeLeaveConfigurations()
        {
            try
            {
                gridLeaves.DataSource = (new ServiceEmployee()).GetAllLeavesConfigurationOfEmployeeForYear(SelectedEmployeeID, SelectedFinYearID);
                foreach (DataGridViewColumn col in gridLeaves.Columns)
                {
                    col.Visible = false;
                }
                gridLeaves.Columns["MaxDaysAllow"].Visible                                          =
                    gridLeaves.Columns["LeaveTypeName"].Visible                                     =
                        gridLeaves.Columns["CarryForwardLeave"].Visible                             =
                            gridLeaves.Columns["CarryForwardLimitDays"].Visible                     =
                                gridLeaves.Columns["LeavesEarned"].Visible                          =
                                    gridLeaves.Columns["ApplicableInProbation"].Visible             =
                                        gridLeaves.Columns["LeaveEnchashable"].Visible              =
                                            gridLeaves.Columns["EncashableSalaryHeadNames"].Visible =
                                                gridLeaves.Columns["IsActive"].Visible              = true;

                gridLeaves.Columns["CarryForwardLimitDays"].HeaderText     = "Limit Days";
                gridLeaves.Columns["LeaveTypeName"].HeaderText             = "Leave Type";
                gridLeaves.Columns["CarryForwardLeave"].HeaderText         = "Carry Forward";
                gridLeaves.Columns["LeavesEarned"].HeaderText              = "Earned";
                gridLeaves.Columns["ApplicableInProbation"].HeaderText     = "Probation";
                gridLeaves.Columns["LeaveEnchashable"].HeaderText          = "Enchashable";
                gridLeaves.Columns["EncashableSalaryHeadNames"].HeaderText = "Salary Head(s)";

                tbl_Acct_Financial_Year fyYear = (new ServiceMASTERS()).GetFinancialYearDbRecordByID(this.SelectedFinYearID);
                if (fyYear != null)
                {
                    headerGroupYearlyLeaves.Values.Heading = string.Format("Leave Configuration - {0}", fyYear.FinYearName);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlEmployeeLeaveConfig::PopulateEmployeeLeaveConfigurations", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void frmAddEditLeaveApplication_Load(object sender, EventArgs e)
        {
            try
            {
                PopulateEmployeeDropdown();
                if (EmployeeID != 0)
                {
                    cboEmployees.SelectedItem = ((List <SelectListItem>)cboEmployees.DataSource).Where(x => x.ID == EmployeeID).FirstOrDefault();
                }
                PopulateLeaveFormDropdown();
                if (this.SelectedLeavFormTypeID != 0)
                {
                    cboLeaveFormType.SelectedItem = ((List <SelectListItem>)cboLeaveFormType.DataSource).Where(x => x.ID == this.SelectedLeavFormTypeID).FirstOrDefault();
                }

                PopulateLeaveTypeDropdown();
                PopulateRequestToDropdown();
                if (LeaveApplicationID == 0)
                {
                    txtLeaveApplicationNo.Text   = (new ServiceLeaveApplication()).GenerateNewLeaveApplicationNumber(Program.CURR_USER.FinYearID, Program.CURR_USER.BranchID, Program.CURR_USER.CompanyID);
                    dtLeaveApplicationDate.Value = AppCommon.GetServerDateTime();


                    tbl_Acct_Financial_Year dbYear = (new ServiceMASTERS()).GetFinancialYearDbRecordByID(Program.CURR_USER.FinYearID);
                    //dtLeaveApplicationDate.MinDate = dtFromDate.MinDate = dtFromTime.MinDate = dtToDate.MinDate= dtToTime.MinDate= dbYear.FromDate;
                    //dtLeaveApplicationDate.MaxDate = dtFromDate.MaxDate = dtFromTime.MaxDate = dtToDate.MaxDate = dtToTime.MaxDate = dbYear.ToDate;
                    dtLeaveApplicationDate.Value = dtFromDate.Value = dtFromTime.Value = dtToDate.Value = dtToTime.Value = AppCommon.GetServerDateTime();
                }
                else
                {
                    ScatterData();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditLeaveApplication::frmAddEditLeaveApplication_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
 private void btnGenerateLeaveConfigurationForEmployees_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         txtProgress.Text = string.Empty;
         tbl_Acct_Financial_Year   currYear      = (new ServiceMASTERS()).GetFinancialYearDbRecordByID(this.SelectedFinYearID);
         ServiceLeaveConfiguration configuration = new ServiceLeaveConfiguration();
         configuration.OnEmployeeLeaveConfigurationCompleted += Configuration_OnEmployeeLeaveConfigurationCompleted;
         configuration.GenerateEmployeeLeaveConfigurationsForFinYear(currYear.FK_CompanyID, currYear.FK_BranchID, currYear.PK_ID);
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageFinYear::btnGenerateLeaveConfigurationForEmployees_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Cursor = Cursors.Default;
 }
Esempio n. 5
0
 private void ScatterData()
 {
     try
     {
         tbl_Acct_Financial_Year model = (new ServiceMASTERS()).GetFinancialYearDbRecordByID(this.FIN_YEAR_ID);
         if (model != null)
         {
             cboCompany.SelectedItem = ((List <SelectListItem>)cboCompany.DataSource).Where(x => x.ID == (int)model.FK_CompanyID).FirstOrDefault();
             cboBranch.SelectedItem  = ((List <SelectListItem>)cboBranch.DataSource).Where(x => x.ID == (int)model.FK_BranchID).FirstOrDefault();
             dtFromDate.Value        = model.FromDate;
             dtToDate.Value          = model.ToDate;
             txtFinYearName.Text     = model.FinYearName;
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmAddEditFinYear::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public void PopulateHolidayAndWeekOffViews()
        {
            btnDeleteHoliday.Visible = true;
            ServiceHolidayAndWeekOffs _service = new ServiceHolidayAndWeekOffs();

            try
            {
                tbl_Acct_Financial_Year model = (new ServiceMASTERS()).GetFinancialYearDbRecordByID(this.SelectedFYID);
                if (model != null)
                {
                    this.SuspendLayout();
                    monthViewControl = new ComponentFactory.Krypton.Toolkit.KryptonMonthCalendar();
                    //monthViewControl.MaxDate = DateTime.Now;
                    //monthViewControl.MinDate = DateTime.Now;
                    monthViewControl.MinDate      = (DateTime)model.FromDate;
                    monthViewControl.MaxDate      = (DateTime)model.ToDate;
                    monthViewControl.DateChanged += _Calender_DateChanged;
                    //_Calender.DayStyle = ButtonStyle.Standalone;
                    //_Calender.OverrideBolded.Day.Back.Color1 = System.Drawing.Color.Red;
                    //_Calender.HeaderStyle = HeaderStyle.Primary;
                    monthViewControl.SelectionStart    = (DateTime)model.FromDate;
                    monthViewControl.SelectionEnd      = (DateTime)model.FromDate;
                    monthViewControl.MaxSelectionCount = 1;
                    monthViewControl.ShowToday         = false;
                    monthViewControl.ShowTodayCircle   = false;


                    List <TBL_MP_HR_HolidaysAndWeekOff> lstHolidays = _service.GetAllHolidaysForTheFinYear(this.SelectedFYID);
                    _HolidayAndWeekOffList = new BindingList <SelectListItem>();
                    foreach (TBL_MP_HR_HolidaysAndWeekOff item in lstHolidays)
                    {
                        monthViewControl.AddBoldedDate(item.HolidayDate);
                        _HolidayAndWeekOffList.Add(new SelectListItem()
                        {
                            ID = item.PK_HolidayID, Code = item.HolidayDate.ToString("dd MMM yyyy"), Description = item.Remarks
                        });
                    }
                    gridHolidaysAndWeekOffs.DataSource = _HolidayAndWeekOffList;
                    //make these columns hidden PK_HolidayID, FK_YearID, HolidayType
                    gridHolidaysAndWeekOffs.Columns["ID"].Visible =
                        gridHolidaysAndWeekOffs.Columns["DescriptionToUpper"].Visible =
                            gridHolidaysAndWeekOffs.Columns["IsActive"].Visible       = false;

                    this.monthViewControl.CalendarDimensions = new System.Drawing.Size(4, 3);
                    this.monthViewControl.DayOfWeekStyle     = ComponentFactory.Krypton.Toolkit.ButtonStyle.Alternate;
                    this.monthViewControl.DayStyle           = ComponentFactory.Krypton.Toolkit.ButtonStyle.Standalone;
                    this.monthViewControl.Dock     = System.Windows.Forms.DockStyle.Fill;
                    this.monthViewControl.Location = new System.Drawing.Point(0, 0);
                    this.monthViewControl.OverrideBolded.Day.Back.Color1     = System.Drawing.Color.Yellow;
                    this.monthViewControl.OverrideBolded.Day.Back.Color2     = System.Drawing.Color.Red;
                    this.monthViewControl.OverrideBolded.Day.Back.ColorStyle = ComponentFactory.Krypton.Toolkit.PaletteColorStyle.Solid;
                    //this._Calender.OverrideBolded.Day.Border.Color1 = System.Drawing.Color.Lime;
                    //this._Calender.OverrideBolded.Day.Border.ColorStyle = ComponentFactory.Krypton.Toolkit.PaletteColorStyle.Solid;
                    //this._Calender.OverrideBolded.Day.Border.DrawBorders = ((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders)((((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Top | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Bottom)
                    //| ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Left)
                    //| ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Right)));
                    //this._Calender.OverrideBolded.Day.Border.Width = 1;
                    this.monthViewControl.OverrideBolded.Day.Content.ShortText.Color1 = System.Drawing.Color.Red;
                    this.monthViewControl.OverrideBolded.Day.Content.LongText.Color2  = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
                    this.monthViewControl.OverrideBolded.Day.Content.ShortText.Font   = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    this.monthViewControl.OverrideBolded.Day.Content.ShortText.TextH  = ComponentFactory.Krypton.Toolkit.PaletteRelativeAlign.Center;
                    this.monthViewControl.OverrideBolded.Day.Content.ShortText.TextV  = ComponentFactory.Krypton.Toolkit.PaletteRelativeAlign.Center;

                    headerGroupCalendarView.Panel.Controls.Clear();
                    headerGroupCalendarView.Panel.Controls.Add(monthViewControl);
                    monthViewControl.Show();
                    this.ResumeLayout(false);
                    //monthViewControl.Dock = DockStyle.Fill;
                    headerGroupRight.ValuesPrimary.Heading     = string.Format("FA: {0}  till  {1}", model.FromDate.ToString("dd MMMM yyyy"), model.ToDate.ToString("dd MMMM yyyy "));
                    headerGroupRight.ValuesPrimary.Description = string.Format("Holidays: {0} Week-offs: {1}", _service.GetHolidayCountForYear(this.SelectedFYID), _service.GetWeekOffCountForYear(this.SelectedFYID));
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "PageHolidayAndWeekOffs::PopulateHolidayAndWeekOffViews", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }