コード例 #1
0
ファイル: frmManager.cs プロジェクト: kimykunjun/test
        private void gen_SecondRun(int nPayrollID)
        {
            //init Function
            string strSQL;
            DataSet _ds;
            int output;
            DataRow[] DrMSEList;
            DataRow[] DrSPACList;
            DataRow[] DrThepList;
            DataRow[] DrPTList;
            DataRow[] DrBMList;
            DataRow[] DrABMList;

            try
            {//Checking status of second run payroll

                if (cbJob.SelectedIndex != 0)
                {
                    strSQL = "select nEmployeeID,fPartTime,strBranchCode,strJobPositionCode from tblEmployee where nStatusID=1 and strJobPositionCode='" + cbJob.EditValue.ToString() + "'";
                }
                    else
                    {
                        strSQL = "select nEmployeeID,fPartTime,strBranchCode,strJobPositionCode,fPtInstructor,fSpaConsult,fTherapist,fMSE from tblEmployee where nStatusID=1 ";
                    }

                _ds = new DataSet();

                SqlHelper.FillDataset(connection,CommandType.StoredProcedure,"UP_GETDATA",_ds,new string[] {"table"}, new SqlParameter("@strSQL", strSQL) );

                //Init Payroll 2nd Run
                progressBarControl1.Properties.Minimum = 0;
                progressBarControl1.Properties.Maximum = _ds.Tables["table"].Rows.Count;
                progressBarControl1.Properties.Step = 1;
                progressBarControl1.Visible = true;

                DrMSEList = _ds.Tables["table"].Select("fMSE = true");
                foreach( DataRow dr in DrMSEList )
                {
                    try
                    {
                        /// 3. MSE COMMISSION
                        CommissionSpaService comm3 = new CommissionSpaService();
                        comm3.CalculateSpaServiceCommission(ConvertToInt(dr[0]),System.Convert.ToString(dr[2]),(ACMSLogic.Staff.Month)(ConvertToInt(comboBoxEditMTH.SelectedIndex)),ConvertToInt(comboBoxEditYR.Text),true);

                        // To Generate Spa Service Comm Detais
                        // To Generate Commission Details and store to table tblPayrollPTServiceCommDetails
                        output = 0;
                        if (comm3.MSECommDetail.Rows.Count>0)
                        {
                            foreach (DataRow drMSE in comm3.MSECommDetail.Rows)
                            {
                                SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
                                    new SqlParameter("@RET_VAL",output),
                                    new SqlParameter("@CMD","U"),
                                    new SqlParameter("@nPayrollID",nPayrollID),
                                    new SqlParameter("@nEmployeeID",Convert.ToInt32(drMSE[0])),
                                    new SqlParameter("@mCommission",Convert.ToDecimal(drMSE[1])),
                                    //	new SqlParameter("@mCommissionLatenessPenalty",CommissionPenalty * 2),
                                    new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
                                    new SqlParameter("@nSecondRunStaff",employee.Id.ToString())	);

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(dr[0].ToString()+ " "+ex.Message);
                    }
                }

            //					output = 0;
            //					SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
            //						new SqlParameter("@RET_VAL",output),
            //						new SqlParameter("@CMD","U"),
            //						new SqlParameter("@nPayrollID",nPayrollID),
            //						new SqlParameter("@nEmployeeID",Convert.ToInt32(dr[0])),
            //						new SqlParameter("@mCommission",0),
            //						//new SqlParameter("@mCommissionLatenessPenalty",0),
            //						new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
            //						new SqlParameter("@nSecondRunStaff",employee.Id.ToString())
            //						//Commission * (total lateness in mins)/100
            //						);
            //					try
            //					{
            //						/// 1. PT SERVICE COMMISSION
            //						CommissionPTService comm1 = new CommissionPTService();
            //						comm1.CalculatePTServiceCommission(Convert.ToInt32(dr[0]),(ACMSLogic.Staff.Month)(Convert.ToInt32(comboBoxEditMTH.EditValue)),Convert.ToInt32(comboBoxEditYR.Text));
            //
            //						// To Generate Commission Details and store to table tblPayrollPTServiceCommDetails
            //						output = 0;
            //						foreach (DataRow drDetl in comm1.ResultTableInDetail.Rows)
            //						{
            //							SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollPTServiceCommDetails",
            //								new SqlParameter("@RET_VAL",output),
            //								new SqlParameter("@CMD","I"),
            //								new SqlParameter("@nPayrollID",nPayrollID),
            //								new SqlParameter("@nEmployeeID",Convert.ToInt32(drDetl["nEmployeeID"])),
            //								new SqlParameter("@dtDate",ConvertToDateTime(drDetl["dtDate"])),
            //								new SqlParameter("@strBranchCode",drDetl["strBranchCode"].ToString()),
            //								new SqlParameter("@strServiceCode",drDetl["strServiceCode"].ToString()),
            //								new SqlParameter("@mCommission",Convert.ToDecimal(drDetl["mCommission"]))
            //								);
            //						}
            //					}
            //					catch (Exception ex)
            //					{
            //						MessageBox.Show(dr[0].ToString()+ " " + ex.Message);
            //					}

                DrSPACList = _ds.Tables["table"].Select("fSpaConsult = true");
                foreach( DataRow dr in DrSPACList )
                {
                    try
                    {
                        /// 2. SPA Consultant COMMISSION:
                        CommissionSpaService comm2 = new CommissionSpaService();
                        comm2.CalculateSpaServiceCommission(ConvertToInt(dr[0]),System.Convert.ToString(dr[2]),(ACMSLogic.Staff.Month)(ConvertToInt(comboBoxEditMTH.SelectedIndex)),ConvertToInt(comboBoxEditYR.Text),true);

                        // To Generate Spa Service Comm Detais
                        // To Generate Commission Details and store to table tblPayrollPTServiceCommDetails
                        output = 0;
                        if (comm2.SPACCommDetail.Rows.Count>0)
                        {
                            foreach (DataRow drSPAC in comm2.SPACCommDetail.Rows)
                            {
                                SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
                                    new SqlParameter("@RET_VAL",output),
                                    new SqlParameter("@CMD","U"),
                                    new SqlParameter("@nPayrollID",nPayrollID),
                                    new SqlParameter("@nEmployeeID",Convert.ToInt32(drSPAC[0])),
                                    new SqlParameter("@mCommission",Convert.ToDecimal(drSPAC[1])),
                                    //	new SqlParameter("@mCommissionLatenessPenalty",CommissionPenalty * 2),
                                    new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
                                    new SqlParameter("@nSecondRunStaff",employee.Id.ToString())	);

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(dr[0].ToString()+ " "+ex.Message);
                    }
                }

                DrThepList = _ds.Tables["table"].Select("fTherapist = true");
                foreach( DataRow dr in DrThepList )
                {
                    try
                    {
                        /// 2. THerapist COMMISSION:
                        CommissionSpaService comm4 = new CommissionSpaService();
                        comm4.CalculateSpaServiceCommission(ConvertToInt(dr[0]),System.Convert.ToString(dr[2]),(ACMSLogic.Staff.Month)(ConvertToInt(comboBoxEditMTH.SelectedIndex)),ConvertToInt(comboBoxEditYR.Text),true);

                        // To Generate Spa Service Comm Detais
                        // To Generate Commission Details and store to table tblPayrollPTServiceCommDetails
                        output = 0;
                        if (comm4.THEPCommDetail.Rows.Count>0)
                        {
                            foreach (DataRow drTHEP in comm4.THEPCommDetail.Rows)
                            {
                                SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
                                    new SqlParameter("@RET_VAL",output),
                                    new SqlParameter("@CMD","U"),
                                    new SqlParameter("@nPayrollID",nPayrollID),
                                    new SqlParameter("@nEmployeeID",Convert.ToInt32(drTHEP[0])),
                                    new SqlParameter("@mCommission",Convert.ToDecimal(drTHEP[1])),
                                    //	new SqlParameter("@mCommissionLatenessPenalty",CommissionPenalty * 2),
                                    new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
                                    new SqlParameter("@nSecondRunStaff",employee.Id.ToString())	);

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(dr[0].ToString()+ " "+ex.Message);
                    }
                }

                DrBMList = _ds.Tables["table"].Select("strJobPositionCode = 'BRM'");
                foreach( DataRow dr in DrBMList )
                {
                    try
                    {
                        /// 2. BM COMMISSION:
                        CommissionSpaService comm5 = new CommissionSpaService();
                        comm5.CalculateSpaServiceCommission(ConvertToInt(dr[0]),(ACMSLogic.Staff.Month)(ConvertToInt(comboBoxEditMTH.SelectedIndex)),ConvertToInt(comboBoxEditYR.Text),true);

                        // To Generate Spa Service Comm Detais
                        // To Generate Commission Details and store to table tblPayrollPTServiceCommDetails
                        output = 0;
                        if (comm5.BMCommDetail.Rows.Count>0)
                        {
                            foreach (DataRow drBM in comm5.BMCommDetail.Rows)
                            {
                                SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
                                    new SqlParameter("@RET_VAL",output),
                                    new SqlParameter("@CMD","U"),
                                    new SqlParameter("@nPayrollID",nPayrollID),
                                    new SqlParameter("@nEmployeeID",Convert.ToInt32(drBM[0])),
                                    new SqlParameter("@mCommission",Convert.ToDecimal(drBM[1])),
                                    //	new SqlParameter("@mCommissionLatenessPenalty",CommissionPenalty * 2),
                                    new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
                                    new SqlParameter("@nSecondRunStaff",employee.Id.ToString())	);

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(dr[0].ToString()+ " "+ex.Message);
                    }
                }

                DrBMList = _ds.Tables["table"].Select("strJobPositionCode = 'ABMGR'");
                foreach( DataRow dr in DrBMList )
                {
                    try
                    {
                        /// 2. BM COMMISSION:
                        CommissionSpaService comm5 = new CommissionSpaService();
                        comm5.CalculateSpaServiceCommission(ConvertToInt(dr[0]),System.Convert.ToString(dr[2]),(ACMSLogic.Staff.Month)(ConvertToInt(comboBoxEditMTH.SelectedIndex)),ConvertToInt(comboBoxEditYR.Text),false);

                        // To Generate Spa Service Comm Detais
                        // To Generate Commission Details and store to table tblPayrollPTServiceCommDetails
                        output = 0;
                        if (comm5.BMCommDetail.Rows.Count>0)
                        {
                            foreach (DataRow drBM in comm5.BMCommDetail.Rows)
                            {
                                SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
                                    new SqlParameter("@RET_VAL",output),
                                    new SqlParameter("@CMD","U"),
                                    new SqlParameter("@nPayrollID",nPayrollID),
                                    new SqlParameter("@nEmployeeID",Convert.ToInt32(drBM[0])),
                                    new SqlParameter("@mCommission",Convert.ToDecimal(drBM[1])),
                                    //	new SqlParameter("@mCommissionLatenessPenalty",CommissionPenalty * 2),
                                    new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
                                    new SqlParameter("@nSecondRunStaff",employee.Id.ToString())	);

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(dr[0].ToString()+ " "+ex.Message);
                    }
                }

                DrPTList = _ds.Tables["table"].Select("fPtInstructor = 'true'");
                foreach( DataRow dr in DrPTList )
                {
                    try
                    {
                        bool IsPT = false;
                        if(System.Convert.ToString(dr["strJobPositionCode"]).Trim() == "PT")
                             IsPT = true;

                        /// 2. PT COMMISSION:
                        CommissionSpaService commPT = new CommissionSpaService();
                        commPT.CalculateSpaServiceCommission(ConvertToInt(dr[0]),System.Convert.ToString(dr[2]),(ACMSLogic.Staff.Month)(ConvertToInt(comboBoxEditMTH.SelectedIndex)),ConvertToInt(comboBoxEditYR.Text),IsPT);

                        // To Generate Spa Service Comm Detais
                        // To Generate Commission Details and store to table tblPayrollPTServiceCommDetails
                        output = 0;
                        if (commPT.PTCommDetail.Rows.Count>0)
                        {
                            foreach (DataRow drPT in commPT.PTCommDetail.Rows)
                            {
                                SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
                                    new SqlParameter("@RET_VAL",output),
                                    new SqlParameter("@CMD","U"),
                                    new SqlParameter("@nPayrollID",nPayrollID),
                                    new SqlParameter("@nEmployeeID",Convert.ToInt32(drPT[0])),
                                    new SqlParameter("@mCommission",Convert.ToDecimal(drPT[1])),
                                    //	new SqlParameter("@mCommissionLatenessPenalty",CommissionPenalty * 2),
                                    new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
                                    new SqlParameter("@nSecondRunStaff",employee.Id.ToString())	);

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(dr[0].ToString()+ " "+ex.Message);
                    }
                }
                    //..LATENESS PENATLY
            //					try
            //					{
            //						output = 0;
            //						SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollCommissionPenalty",
            //							new SqlParameter("@RET_VAL",output),
            //							new SqlParameter("@CMD","I"),
            //							new SqlParameter("@nPayrollID",nPayrollID),
            //							new SqlParameter("@nEmployeeID",Convert.ToInt32(dr[0])),
            //							new SqlParameter("@Month",comboBoxEditMTH.EditValue),
            //							new SqlParameter("@Year",comboBoxEditYR.Text));
            //					}
            //					catch (Exception ex)
            //					{
            //						MessageBox.Show(employee.Id.ToString()+" "+ex.Message);
            //					}
            //
            //					try
            //					{
            //						decimal SpaServiceAmount,PTServiceAmount,SalesCommissionAmount,TotalCommission;
            //						SpaServiceAmount=0;
            //						PTServiceAmount=0;
            //						SalesCommissionAmount=0;
            //						TotalCommission=0;
            //
            //						//Spa Service Comm
            //						strSQL = "Select sum(mCommission) as totalCommission from tblPayrollSpaServiceCommDetails where nPayrollID='" + nPayrollID + "' and nEmployeeID='" + Convert.ToInt32(dr[0]) + "'";
            //						_ds = new DataSet();
            //						SqlHelper.FillDataset(connection,CommandType.StoredProcedure,"UP_GETDATA",_ds,new string[] {"table"}, new SqlParameter("@strSQL", strSQL) );
            //						foreach(DataRow row1 in _ds.Tables["table"].Rows)
            //						{
            //							SpaServiceAmount=Convert.ToDecimal(row1[0]);
            //						}
            //
            //						//PT Service Comm
            //						strSQL = "Select sum(mCommission) as totalCommission from tblPayrollPTServiceCommDetails where nPayrollID='" + nPayrollID + "' and nEmployeeID='" + Convert.ToInt32(dr[0]) + "'";
            //						_ds = new DataSet();
            //						SqlHelper.FillDataset(connection,CommandType.StoredProcedure,"UP_GETDATA",_ds,new string[] {"table"}, new SqlParameter("@strSQL", strSQL) );
            //						foreach(DataRow row2 in _ds.Tables["table"].Rows)
            //						{
            //							PTServiceAmount=Convert.ToDecimal(row2[0]);
            //						}
            //
            //						//Sales Comm
            //						strSQL = "Select sum(mTotalCommission) as totalCommission from tblPayrollSalesCommDetails where nPayrollID='" + nPayrollID + "' and nEmployeeID='" + Convert.ToInt32(dr[0]) + "'";
            //						_ds = new DataSet();
            //						SqlHelper.FillDataset(connection,CommandType.StoredProcedure,"UP_GETDATA",_ds,new string[] {"table"}, new SqlParameter("@strSQL", strSQL) );
            //						foreach(DataRow row3 in _ds.Tables["table"].Rows)
            //						{
            //							SalesCommissionAmount=Convert.ToDecimal(row3[0]);
            //						}
            //
            //						TotalCommission = SpaServiceAmount + PTServiceAmount + SalesCommissionAmount;
            //						output = 0;
            //						SqlHelper.ExecuteNonQuery(connection,"UP_tblPayrollEntries_SecondRun",
            //							new SqlParameter("@RET_VAL",output),
            //							new SqlParameter("@CMD","U"),
            //							new SqlParameter("@nPayrollID",nPayrollID),
            //							new SqlParameter("@nEmployeeID",Convert.ToInt32(dr[0])),
            //							new SqlParameter("@mCommission",TotalCommission),
            //						//	new SqlParameter("@mCommissionLatenessPenalty",CommissionPenalty * 2),
            //							new SqlParameter("@dtSecondRunDate",DateTime.Now.ToShortDateString()),
            //							new SqlParameter("@nSecondRunStaff",employee.Id.ToString())	);
            //
            //					}
            //					catch (Exception ex)
            //					{
            //						MessageBox.Show(employee.Id.ToString()+" "+ex.Message);
            //					}

                    progressBarControl1.PerformStep();
                    progressBarControl1.Update();

                progressBarControl1.Visible = false;
                InitPayroll(2);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        private void ProcessCalculation()
        {
            myResultDataSet = new DataSet();
            GetBasicEmployeeInfo();

            if (myResultDataSet.Tables[EMPLOYEEINFO].Rows[0]["fPartTime"] != DBNull.Value && System.Convert.ToBoolean(myResultDataSet.Tables[EMPLOYEEINFO].Rows[0]["fPartTime"]) == true)
            {
                CommissionSpaService myCommission = new CommissionSpaService();
                myCommission.CalculateSpaServiceCommission(nEmployeeID, strBranchCode, month, year, true);
                myResultDataSet = new DataSet();
                myResultDataSet.Tables.Add(myCommission.ResultTableInSummary.Copy());
                //myResultDataSet.Tables.Add(myCommission.ResultTableInDetail.Copy());
                return;
            }

            // Check have commission code for current employee or not. If don't have return 0 commission.
            if (myResultDataSet.Tables[SERVICESESSION].Rows.Count == 0)
            {
                // Actually is don't need foreach. Should be have 1 row only.
                foreach(DataRow myRow in myResultDataSet.Tables[EMPLOYEEINFO].Rows)
                {
                    myRow.BeginEdit();
                    myRow["mCommission"] = 0m;
                    myRow.EndEdit();
                }
                return;
            }

            decimal commission = 0m;
            // Sum all mServiceCommission using strServiceCode commission.
            //foreach (DataRow myRow in myResultDataSet.Tables[SERVICESESSION].Rows)
            for (int i = 1; i <= myResultDataSet.Tables[SERVICESESSION].Rows.Count; i++)
            {
                DataRow myRow = myResultDataSet.Tables[SERVICESESSION].Rows[i - 1];
                decimal currentCommission = 0m;
                currentCommission = CalculateCommission(i);
                commission += currentCommission;
                myRow["mCommission"] = currentCommission;
            }
            foreach(DataRow myRow in myResultDataSet.Tables[EMPLOYEEINFO].Rows)
            {
                myRow.BeginEdit();
                myRow["mCommission"] = commission;
                myRow.EndEdit();
            }
        }
コード例 #3
0
ファイル: frmStaff.cs プロジェクト: kimykunjun/test
        private void frmStaff_Load(object sender, System.EventArgs e)
        {
            // TODO: This line of code loads data into the 'aCMSDataSet.TblDeliverySchedule' table. You can move, or remove it, as needed.
            //this.tblDeliveryScheduleTableAdapter.Fill(this.aCMSDataSet.TblDeliverySchedule, oUser.NDepartmentID());
            barstaticCurrentLogin.Caption = string.Format(barstaticCurrentLogin.Caption, employee.StrEmployeeName, DateTime.Now.ToString("dd MMMM yyyy"));

            connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
            connection = new SqlConnection(connectionString);

            myEmployeeInfo = Ultis.EmployeeInfo(employee.Id);

            TabStaff_init();

            int currentYear = DateTime.Now.Year;
            object[] years = new object[]{currentYear - 3, currentYear - 2, currentYear - 1, currentYear, currentYear + 1};
            cbServiceYear.Properties.Items.AddRange(years);
            cbServiceYear.EditValue = currentYear;
            cbServiceMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbSalesYear.Properties.Items.AddRange(years);
            cbSalesYear.EditValue = currentYear;
            cbSalesMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbAppointmentYear.Properties.Items.AddRange(years);
            cbAppointmentYear.EditValue = currentYear;
            cbAppointmentMonth.SelectedIndex = DateTime.Now.Month - 1;

            mySpaCommission = new CommissionSpaService();
            myPTCommission = new CommissionPTService();
            mySalesCommission = new SalesCommission();
            myCV = new ACMSLogic.Staff.CV();
            myMemo = new ACMSLogic.Staff.Memo();
            myReceipientGroup = new ACMSLogic.Staff.ReceipientGroup();
            myAppointment = new Appointment();
            myContacts = new Contacts();
            //myTimesheet = new Timesheet();
            //myLateness = new Lateness();
            //myLeave = new Leave();

            timer1.Enabled = true;

            luedtSalesBranchCode.EditValue = terminalUser.Branch.Id;
            luedtCommissionServiceBranch.EditValue = terminalUser.Branch.Id;

            new ACMS.XtraUtils.LookupEditBuilder.BranchCodeLookupEditBuilder2(luedtSalesBranchCode.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.BranchCodeLookupEditBuilder2(luedtCommissionServiceBranch.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtMemoEmployeeID.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.DepartmentLookupEditBuilder2(luedtCVAssignTo.Properties);

            //			employee.RightsLevel.Id = 103;
            if (employee.HasRight("AS_VIEW_ALL_CV"))
            {
                new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtCVSubmitter.Properties);
                //Add not filter row for Submiter
                DataTable tempTable = luedtCVSubmitter.Properties.DataSource as DataTable;
                DataRow tempRow = tempTable.NewRow();
                tempRow.BeginEdit();
                tempRow["nEmployeeID"] = DBNull.Value;
                tempRow["strEmployeeName"] = "<<No Filter>>";
                tempRow.EndEdit();
                tempTable.Rows.Add(tempRow);
                tempTable.AcceptChanges();
                luedtCVSubmitter.Visible = true;
                lblCVSubmitter.Visible = true;
            }
            else
            {
                luedtCVSubmitter.Visible = false;
                lblCVSubmitter.Visible = false;
            }
            //Add not filter row for AssignTo
            DataTable tempTable2 = luedtCVAssignTo.Properties.DataSource as DataTable;
            DataRow tempRow2 = tempTable2.NewRow();
            tempRow2.BeginEdit();
            tempRow2["nDepartmentID"] = DBNull.Value;
            tempRow2["strDescription"] = "<<No Filter>>";
            tempRow2.EndEdit();
            tempTable2.Rows.Add(tempRow2);
            tempTable2.AcceptChanges();

            //			employee.RightsLevel.Id = 105;

            isFinishedMemoInit = false;
            isFinishedCVInit = false;
            luedtMemoEmployeeID.EditValue = employee.Id;
            isFinishedMemoInit = true;

            //			employee.RightsLevel.Id = 106;
            if (!employee.HasRight("AS_MEMO_SUPER_RIGHT"))
            {
                lblMemoEmployeeID.Visible = false;
                luedtMemoEmployeeID.Visible = false;
            }
            //ListMemo();
            //ListReceipientGroup();

            int_lblFour();
            lblFour_1.ForeColor = System.Drawing.Color.Firebrick;
            tabStaffFour.TabControl.SelectedTabPage = tabStaffFour;
            groupAppointment.Show();
        }
コード例 #4
0
ファイル: frmStaff.cs プロジェクト: kimykunjun/test
        private void frmStaff_Load(object sender, System.EventArgs e)
        {
            barstaticCurrentLogin.Caption = string.Format(barstaticCurrentLogin.Caption, employee.StrEmployeeName, DateTime.Now.ToString("dd MMMM yyyy"));

            connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
            connection = new SqlConnection(connectionString);

            myEmployeeInfo = Ultis.EmployeeInfo(employee.Id);
            myLeaveEmployeeInfo = myEmployeeInfo;

            TabStaff_init();

            int currentYear = DateTime.Now.Year;
            object[] years = new object[]{currentYear - 3, currentYear - 2, currentYear - 1, currentYear, currentYear + 1};
            cbServiceYear.Properties.Items.AddRange(years);
            cbServiceYear.EditValue = currentYear;
            cbServiceMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbSalesYear.Properties.Items.AddRange(years);
            cbSalesYear.EditValue = currentYear;
            cbSalesMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbTimesheetYear.Properties.Items.AddRange(years);
            cbTimesheetYear.EditValue = currentYear;
            cbTimesheetMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbAppointmentYear.Properties.Items.AddRange(years);
            cbAppointmentYear.EditValue = currentYear;
            cbAppointmentMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbOvertimeYear.Properties.Items.AddRange(years);
            cbOvertimeYear.EditValue = currentYear;
            cbOvertimeMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbLatenessYear.Properties.Items.AddRange(years);
            cbLatenessYear.EditValue = currentYear;
            cbLatenessMonth.SelectedIndex = DateTime.Now.Month - 1;

            mySpaCommission = new CommissionSpaService();
            myPTCommission = new CommissionPTService();
            mySalesCommission = new SalesCommission();
            myCV = new ACMSLogic.Staff.CV();
            myMemo = new ACMSLogic.Staff.Memo();
            myReceipientGroup = new ACMSLogic.Staff.ReceipientGroup();
            myAppointment = new Appointment();
            myContacts = new Contacts();
            myTimesheet = new Timesheet();
            myLateness = new Lateness();
            myLeave = new Leave();

            timer1.Enabled = true;

            luedtSalesBranchCode.EditValue = terminalUser.Branch.Id;
            luedtCommissionServiceBranch.EditValue = terminalUser.Branch.Id;

            new ACMS.XtraUtils.LookupEditBuilder.BranchCodeLookupEditBuilder2(luedtSalesBranchCode.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.BranchCodeLookupEditBuilder2(luedtCommissionServiceBranch.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtLeaveEmployeeID.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtMemoEmployeeID.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.DepartmentLookupEditBuilder2(luedtCVAssignTo.Properties);

            //			employee.RightsLevel.Id = 103;
            if (employee.HasRight("AS_VIEW_ALL_CV"))
            {
                new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtCVSubmitter.Properties);
                //Add not filter row for Submiter
                DataTable tempTable = luedtCVSubmitter.Properties.DataSource as DataTable;
                DataRow tempRow = tempTable.NewRow();
                tempRow.BeginEdit();
                tempRow["nEmployeeID"] = DBNull.Value;
                tempRow["strEmployeeName"] = "<<No Filter>>";
                tempRow.EndEdit();
                tempTable.Rows.Add(tempRow);
                tempTable.AcceptChanges();
                luedtCVSubmitter.Visible = true;
                lblCVSubmitter.Visible = true;
            }
            else
            {
                luedtCVSubmitter.Visible = false;
                lblCVSubmitter.Visible = false;
            }
            //Add not filter row for AssignTo
            DataTable tempTable2 = luedtCVAssignTo.Properties.DataSource as DataTable;
            DataRow tempRow2 = tempTable2.NewRow();
            tempRow2.BeginEdit();
            tempRow2["nDepartmentID"] = DBNull.Value;
            tempRow2["strDescription"] = "<<No Filter>>";
            tempRow2.EndEdit();
            tempTable2.Rows.Add(tempRow2);
            tempTable2.AcceptChanges();

            startLeaveDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
            luedtLeaveEmployeeID.EditValue = employee.Id;

            //			employee.RightsLevel.Id = 105;
            if (!employee.HasRight("AS_LEAVE_SUPER_RIGHT"))
            {
                lblLeaveEmployeeID.Visible = false;
                luedtLeaveEmployeeID.Visible = false;
            }

            isFinishedMemoInit = false;
            isFinishedCVInit = false;
            luedtMemoEmployeeID.EditValue = employee.Id;
            isFinishedMemoInit = true;

            //			employee.RightsLevel.Id = 106;
            if (!employee.HasRight("AS_MEMO_SUPER_RIGHT"))
            {
                lblMemoEmployeeID.Visible = false;
                luedtMemoEmployeeID.Visible = false;
            }
            ListMemo();
            ListReceipientGroup();
        }