コード例 #1
0
        public void ReloadDataGrid(object sender, ThresholdReachedEventArgs e)
        {
            if (ConvertTo.DateTimeVal(DtStartDate.EditValue) == e.AttendanceDate && IsString.IsEqualTo(txtEmpCode.EditValue, e.EmpCode))
            {
            }
            else
            {
                DtStartDate.EditValue = e.AttendanceDate;
                txtEmpCode.EditValue  = e.EmpCode;


                var ds = ProjectFunctions.GetDataSet("SELECT     empmst.EmpCode, empmst.EmpName, DeptMst.DeptDesc FROM         empmst LEFT OUTER JOIN DeptMst ON empmst.EmpDeptCode = DeptMst.DeptCode Where EmpCode='" + txtEmpCode.Text.Trim() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtEmpCode.Text = ds.Tables[0].Rows[0]["EmpCode"].ToString();
                    txtEmpName.Text = ds.Tables[0].Rows[0]["EmpName"].ToString();

                    lblemp.Text = ds.Tables[0].Rows[0]["EmpName"].ToString();



                    //Thread.Sleep(1000);

                    btnLoad_Data.PerformClick();//.Focus();
                }
            }


            //LoadAttendanceDataGrid();
            PrintLogWin.PrintLog("---------------------------------");
        }
コード例 #2
0
        public void LoadGatePassDataGrid(bool onFormLoad)
        {
            PrintLogWin.PrintLog("LoadGatePassDataGrid => GlobalVariables.ProgCode ******************** : " + GlobalVariables.ProgCode);
            try
            {
                gridView_AttendanceData.Columns.Clear();

                string  _params = "'" + txtEmpCode.EditValue + "', '" + ConvertTo.DateTimeVal(DtStartDate.EditValue).ToString("yyyy-MM-dd") + "'";
                DataSet ds      = ProgramMasterData.GetData(GlobalVariables.ProgCode, _params);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    gridControl_AttendanceData.DataSource = ds.Tables[0];
                    gridView_AttendanceData.BestFitColumns();
                }
                else
                {
                    gridControl_AttendanceData.DataSource = null;

                    if (!onFormLoad)
                    {
                        ProjectFunctions.SpeakError("There is no data in this Query");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString().Trim());
            }
        }
コード例 #3
0
        private void Report_Print_Preview(string action)
        {
            XtraReport_EmployeeAttendance Xtra_Report_EmployeeAttendanceList = new XtraReport_EmployeeAttendance();

            DynamicParameters paramSalary = new DynamicParameters();

            paramSalary.Add("@Emp_Code_Processing", txtEmpCode.EditValue);
            paramSalary.Add("@Salary_Month", DtStartDate.EditValue);
            paramSalary.Add("@Deduct_Advance", 1);
            paramSalary.Add("@Deduct_Loan", 1);
            paramSalary.Add("@TeaRate", 0);
            paramSalary.Add("@NoOfCups", 0);


            DynamicParameters param = new DynamicParameters();

            param.Add("@EmpCode", txtEmpCode.EditValue);
            param.Add("@Attendance_Month", DtStartDate.EditValue);

            DynamicParameters paramEmp = new DynamicParameters();

            paramEmp.Add("@EmpCode", txtEmpCode.EditValue);

            ProgramMasterModel programMaster = ProgramMasterData.GetProgramMasterModel(GlobalVariables.ProgCode);



            EmployeeAttendanceDetails_Model employeeAttendanceDetails_Model = new EmployeeAttendanceDetails_Model
            {
                EmpCode                     = txtEmpCode.EditValue + string.Empty,
                AttendanceMonth             = ConvertTo.DateTimeVal(DtStartDate.EditValue),
                EmployeeAttendance_Get_List = EmployeeData.EmployeeAttendance_Get(programMaster.ProgProcName + "_v2", param),
                EmployeesSalaryList         = EmployeeData.GetEmployeesSalaryList("sp_Salary_Process", paramSalary),
                EmployeeMasterDataList      = EmployeeData.GetEmployeeMasterDataList("sp_LoadEmpMstFEditing", paramEmp)
            };

            //EmployeeMasterModel
            attendanceBindingSource.DataSource = employeeAttendanceDetails_Model;

            Xtra_Report_EmployeeAttendanceList.DataSource = attendanceBindingSource;

            //MessageBox.Show(employeeAttendanceDetails_Model.EmployeesSalaryList.Count + "");

            ReportPrintTool tool = new ReportPrintTool(Xtra_Report_EmployeeAttendanceList);

            if (action.Equals("preview"))
            {
                tool.ShowRibbonPreviewDialog();
            }
            if (action.Equals("print"))
            {
                tool.PrintDialog();
            }
        }
コード例 #4
0
        public void LoadGatePassDataGrid_Obsoulete()
        {
            PrintLogWin.PrintLog("LoadGatePassDataGrid => GlobalVariables.ProgCode ******************** " + GlobalVariables.ProgCode);


            gridView_AttendanceData.Columns.Clear();

            string  _params = "'" + txtEmpCode.EditValue + "', '" + ConvertTo.DateTimeVal(DtStartDate.EditValue).ToString("yyyy-MM-dd") + "'";
            DataSet att_ds  = ProgramMasterData.GetData(GlobalVariables.ProgCode, _params);

            if (ComparisonUtils.IsNotNull_DataSet(att_ds))
            {
                gridControl_AttendanceData.DataSource = att_ds;
            }
        }
コード例 #5
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int serial_id = ConvertTo.IntVal(txtEmpCode.Tag);

                var               str      = "sp_GatePassData_AddEdit";
                RepGen            reposGen = new RepGen();
                DynamicParameters param    = new DynamicParameters();
                param.Add("@serial_id", serial_id);
                param.Add("@entry_date", ConvertTo.DateFormatDb(DateTime.Now));//Convert.ToDateTime(DateTime.Now).ToString("yyyy-MM-dd")
                param.Add("@status_id", txtStatusCode.Text);
                param.Add("@employee_code", txtEmpCode.Text);
                param.Add("@attendance_date", ConvertTo.DateFormatDb(ConvertTo.DateTimeVal(DtDate.Text)));//Convert.ToDateTime(DtDate.Text).ToString("yyyy-MM-dd")
                param.Add("@attendance_out", timeEdit_Time_Out.Text);
                param.Add("@attendance_in", timeEdit_Time_In.Text);

                param.Add("@output", dbType: DbType.Int32, direction: ParameterDirection.Output);
                param.Add("@Returnvalue", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);

                string intResult = reposGen.ExecuteNonQuery_SP(str, param);
                if (intResult.Equals("0"))
                {
                    int outputVal = param.Get <int>("@output");
                    int returnVal = param.Get <int>("@Returnvalue");

                    PrintLogWin.PrintLog("outputVal => " + outputVal);
                    PrintLogWin.PrintLog("returnVal => " + returnVal);

                    txtEmpCode.Tag = outputVal;
                    ProjectFunctions.SpeakError("Record has been saved");
                    LoadGatePassDataGrid();
                }
                else
                {
                    ProjectFunctions.SpeakError("Error in save record.");
                    PrintLogWin.PrintLog(intResult);
                }
                //this.Close();
            }
            catch (Exception ex)
            {
                ProjectFunctions.SpeakError("Error in save record.");
                PrintLogWin.PrintLog(ex);
            }
        }
コード例 #6
0
        private void Report_Print_Preview(string action)
        {
            //XtraReport_EmployeesSalaryList Xtra_report_employeesSalaryList = new XtraReport_EmployeesSalaryList();
            XtraReport_Salary Xtra_report_employeesSalaryList = new XtraReport_Salary();

            DynamicParameters param = new DynamicParameters();

            param.Add("@Emp_Code_Processing", string.Empty);
            param.Add("@Salary_Month", DtStartDate.EditValue);
            param.Add("@Deduct_Advance", 1);
            param.Add("@Deduct_Loan", 1);
            param.Add("@TeaRate", txtteatrate.Text);
            param.Add("@NoOfCups", 0);



            //List<EmployeeSalary> EmployeesSalaryList = EmployeeData.GetEmployeesSalaryList("sp_Salary_Process", param);

            MonthlySalaryDetails_Model monthlySalaryDetails_Model = new MonthlySalaryDetails_Model
            {
                SalaryMonth         = ConvertTo.DateTimeVal(DtStartDate.EditValue),
                EmployeesSalaryList = EmployeeData.GetEmployeesSalaryList("sp_Salary_Process", param)
            };


            //MessageBox.Show(EmployeesSalaryList.Count + "");

            //salaryBindingSource.DataSource = EmployeesSalaryList;
            salaryBindingSource.DataSource = monthlySalaryDetails_Model;

            Xtra_report_employeesSalaryList.DataSource = salaryBindingSource;


            ReportPrintTool tool = new ReportPrintTool(Xtra_report_employeesSalaryList);

            if (action.Equals("preview"))
            {
                tool.ShowRibbonPreviewDialog();
            }
            if (action.Equals("print"))
            {
                tool.PrintDialog();
            }
        }
コード例 #7
0
        private void SaveEmployeeData()
        {
            string sql = string.Empty;

            if (ValidateData())
            {
                using (var sqlcon = new SqlConnection(ProjectFunctions.GetConnection()))
                {
                    sqlcon.Open();
                    var sqlcom      = sqlcon.CreateCommand();
                    var transaction = sqlcon.BeginTransaction("SaveTransaction");
                    sqlcom.Connection  = sqlcon;
                    sqlcom.Transaction = transaction;
                    sqlcom.CommandType = CommandType.Text;
                    try
                    {
                        if (S1 == "&Add")
                        {
                            string empCode_SQL = "(SELECT RIGHT('0000' + CAST((ISNULL(MAX(CAST(EmpCode AS INT)), 0) + 1) AS VARCHAR(4)), 4) FROM EmpMst)";// SQL_QUERIES._frmEmployeeMstAddEdit._GetNewEmpCode(hasRtnCol:false);

                            sql = " SET TRANSACTION ISOLATION LEVEL SERIALIZABLE  Begin Transaction "
                                  + " Insert into EmpMst"
                                  + " (EmpCode,EmpName,EmpFHRelationTag,EmpFHName, UnitCode, EmpDeptCode,EmpDesgCode,EmpCategory,"
                                  + " EmpSex,EmpDOJ,EmpDOL,EmpPFDTag,"
                                  + " EmpESIDTag,EmpPFno,EmpESIno,EmpBasic,EmpHRA,EmpConv,"
                                  + " EmpPET,EmpTDS,EmpLeft,EmpRemarks,EmpMotherNm,"
                                  + " EmpNationality,EmpEmail,EmpDoB,EmpPanNo,"
                                  + " EmpPassportNo                           ,"
                                  + " EmpSplAlw,EmpReligion,EmpMaritalStatus,EmpPymtMode,EmpBankIFSCode,"
                                  + " EmpBankAcNo,EmpBankName,EmpNominee,EmpNomineeRelation,EmpNomineeDOB,EmpAdharCardNo,EmpGHISDed,EmpFPFDTag,EmpMscD1,EmpAddress1,EmpAddress2,EmpAddress3,EmpDistCity,EmpState,EmpCountry,EmpUANNo,EmpBankBranchCode," +
                                  string.Empty +
                                  "   TimeInFirst, TimeOutFirst, TimeInLast, TimeOutLast, WorkingHours, EmpImage, DailyWage, DailyWageRate, DailyWageMinutes, TeaBreak, TeaBreakTime,EmpTeaTag)"
                                  + " values(" + empCode_SQL + ",@EmpName,@EmpFHRelationTag,@EmpFHName, @UnitCode, @EmpDeptCode,@EmpDesgCode,@EmpCategory,"
                                  + " @EmpSex,@EmpDOJ,@EmpDOL,@EmpPFDTag,"
                                  + " @EmpESIDTag,@EmpPFno,@EmpESIno,@EmpBasic,@EmpHRA,@EmpConv,"
                                  + " @EmpPET,@EmpTDS,@EmpLeft,@EmpRemarks,@EmpMotherNm,"
                                  + " @EmpNationality,@EmpEmail,@EmpDoB,@EmpPanNo,"
                                  + " @EmpPassportNo,"
                                  + " @EmpSplAlw,@EmpReligion,@EmpMaritalStatus,@EmpPymtMode,@EmpBankIFSCode,"
                                  + " @EmpBankAcNo,@EmpBankName,@EmpNominee,@EmpNomineeRelation,@EmpNomineeDOB,@EmpAdharCardNo,@EmpGHISDed,@EmpFPFDTag,@EmpMscD1,@EmpAddress1,@EmpAddress2,@EmpAddress3,@EmpDistCity,@EmpState,@EmpCountry,@EmpUANNo,@EmpBankBranchCode," +
                                  "@TimeInFirst, @TimeOutFirst, @TimeInLast, @TimeOutLast, @WorkingHours, @EmpImage, @DailyWage, @DailyWageRate, @DailyWageMinutes, @TeaBreak, @TeaBreakTime,@EmpTeaTag)"
                                  + " Commit ";
                            sqlcom.CommandText = sql;

                            PrintLogWin.PrintLog(sql);
                        }
                        if (S1 == "Edit")
                        {
                            sql = " UPDATE EmpMst SET "
                                  + " EmpFHRelationTag=@EmpFHRelationTag,EmpFHName=@EmpFHName, UnitCode=@UnitCode, EmpDeptCode=@EmpDeptCode,EmpDesgCode=@EmpDesgCode,EmpCategory=@EmpCategory, "
                                  + " EmpSex=@EmpSex,EmpDOJ=@EmpDOJ,EmpDOL=@EmpDOL,EmpPFDTag=@EmpPFDTag, "
                                  + " EmpESIDTag=@EmpESIDTag,EmpPFno=@EmpPFno,EmpESIno=@EmpESIno,EmpBasic=@EmpBasic,EmpHRA=@EmpHRA,EmpConv=@EmpConv, "
                                  + " EmpPET=@EmpPET,EmpTDS=@EmpTDS,EmpLeft=@EmpLeft,EmpRemarks=@EmpRemarks,EmpMotherNm=@EmpMotherNm,EmpNationality=@EmpNationality, "
                                  + " EmpEmail=@EmpEmail,EmpDoB=@EmpDoB,EmpPanNo=@EmpPanNo,EmpPassportNo=@EmpPassportNo,EmpSplAlw=@EmpSplAlw,"
                                  + " EmpReligion=@EmpReligion,EmpMaritalStatus=@EmpMaritalStatus,EmpPymtMode=@EmpPymtMode,EmpBankIFSCode=@EmpBankIFSCode, "
                                  + " EmpBankAcNo=@EmpBankAcNo,EmpBankName=@EmpBankName,EmpNominee=@EmpNominee,EmpNomineeRelation=@EmpNomineeRelation,EmpNomineeDOB=@EmpNomineeDOB, "
                                  + " EmpAdharCardNo=@EmpAdharCardNo,EmpGHISDed=@EmpGHISDed,EmpFPFDTag=@EmpFPFDTag,EmpMscD1=@EmpMscD1,EmpAddress1=@EmpAddress1,EmpAddress2=@EmpAddress2,EmpAddress3=@EmpAddress3,EmpDistCity=@EmpDistCity,EmpState=@EmpState,EmpCountry=@EmpCountry ,EmpUANNo=@EmpUANNo,EmpBankBranchCode=@EmpBankBranchCode, " +
                                  "   TimeInFirst = @TimeInFirst," +
                                  "   TimeOutFirst = @TimeOutFirst," +
                                  "   TimeInLast = @TimeInLast," +
                                  "   TimeOutLast = @TimeOutLast," +
                                  "   WorkingHours = @WorkingHours, " +
                                  "   EmpImage = @EmpImage," +
                                  "   DailyWage = @DailyWage," +
                                  "   DailyWageRate = @DailyWageRate," +
                                  "   DailyWageMinutes = @DailyWageMinutes," +
                                  "   TeaBreak = @TeaBreak," +
                                  "   TeaBreakTime = @TeaBreakTime,EmpTeaTag=@EmpTeaTag" +
                                  "   Where EmpCode=@EmpCode";

                            sqlcom.CommandText = sql;

                            PrintLogWin.PrintLog(sql);
                        }

                        sqlcom.Parameters.AddWithValue("@EmpCode", txtEmpCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpName", txtEmpName.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpFHRelationTag", txtRelationTag.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpFHName", txtFHName.Text.Trim());

                        sqlcom.Parameters.AddWithValue("@UnitCode", txtUnitCode.Text.Trim());

                        sqlcom.Parameters.AddWithValue("@EmpDeptCode", txtDeptCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpDesgCode", txtDesgCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpCategory", txtCategoryCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpSex", txtEmpSex.Text.Trim());

                        if (txtDOJ.Text.Length == 0)
                        {
                            sqlcom.Parameters.AddWithValue("@EmpDOJ", System.Data.SqlTypes.SqlDateTime.Null);
                        }
                        else
                        {
                            sqlcom.Parameters.AddWithValue("@EmpDOJ", ConvertTo.DateTimeVal(txtDOJ.Text));
                        }
                        if (txtDOL.Text.Length == 0)
                        {
                            sqlcom.Parameters.AddWithValue("@EmpDOL", System.Data.SqlTypes.SqlDateTime.Null);
                        }
                        else
                        {
                            sqlcom.Parameters.AddWithValue("@EmpDOL", ConvertTo.DateTimeVal(txtDOL.Text));
                        }
                        sqlcom.Parameters.AddWithValue("@EmpPFDTag", txtEPFTag.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpESIDTag", txtESIDTag.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpPFno", txtEPFNo.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpESIno", txtESICNo.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpBasic", 0);
                        sqlcom.Parameters.AddWithValue("@EmpHRA", 0);
                        sqlcom.Parameters.AddWithValue("@EmpConv", 0);
                        sqlcom.Parameters.AddWithValue("@EmpPET", 0);
                        sqlcom.Parameters.AddWithValue("@EmpTDS", ConvertTo.DecimalVal(txtTDS.Text));
                        sqlcom.Parameters.AddWithValue("@EmpLeft", txtEmpLeft.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpRemarks", txtRemarks.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpMotherNm", txtMotherName.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpNationality", txtNationality.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpEmail", txtEmail.Text.Trim());
                        if (txtDOB.Text.Length == 0)
                        {
                            sqlcom.Parameters.AddWithValue("@EmpDoB", ConvertTo.DateTimeVal(txtDOB.Text));
                        }
                        else
                        {
                            sqlcom.Parameters.AddWithValue("@EmpDoB", ConvertTo.DateTimeVal(txtDOB.Text));
                        }
                        sqlcom.Parameters.AddWithValue("@EmpPanNo", txtPanNo.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpPassportNo", txtPassPortNo.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpSplAlw", 0);
                        sqlcom.Parameters.AddWithValue("@EmpReligion", txtEmployeeReligion.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpMaritalStatus", txtMaritalStatus.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpPymtMode", txtPaymentMode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpBankIFSCode", txtIfscCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpBankAcNo", txtBankAccountNo.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpBankName", txtBankName.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpNominee", txtNomineeName.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpNomineeRelation", txtNomineeRelation.Text.Trim());
                        if (txtNomineeDOB.Text.Length == 0)
                        {
                            sqlcom.Parameters.AddWithValue("@EmpNomineeDOB", System.Data.SqlTypes.SqlDateTime.Null);
                        }
                        else
                        {
                            sqlcom.Parameters.AddWithValue("@EmpNomineeDOB", ConvertTo.DateTimeVal(txtNomineeDOB.Text));
                        }
                        sqlcom.Parameters.AddWithValue("@EmpAdharCardNo", txtAdharCardNo.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpGHISDed", ConvertTo.DecimalVal(txtHealthInsurance.Text));
                        sqlcom.Parameters.AddWithValue("@EmpFPFDTag", txtEFPFTag.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpMscD1", ConvertTo.DecimalVal(txtMiscDed.Text));
                        sqlcom.Parameters.AddWithValue("@EmpAddress1", txtAddress1.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpAddress2", txtAddress2.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpAddress3", txtAddress3.Text.Trim());

                        sqlcom.Parameters.AddWithValue("@EmpDistCity", string.Empty);

                        sqlcom.Parameters.AddWithValue("@EmpState", txtState.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpCountry", txtCountry.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@EmpUANNo", txtUANNo.Text.Trim());

                        sqlcom.Parameters.AddWithValue("@EmpBankBranchCode", txtBankBranchCode.Text.Trim());

                        sqlcom.Parameters.AddWithValue("@TimeInFirst", ConvertTo.DateTimeVal(timeEdit_Time_In_First.Text.ToString().Trim()));
                        sqlcom.Parameters.AddWithValue("@TimeOutFirst", ConvertTo.DateTimeVal(timeEdit_Time_Out_First.Text.ToString().Trim()));
                        sqlcom.Parameters.AddWithValue("@TimeInLast", ConvertTo.DateTimeVal(timeEdit_Time_In_Last.Text.ToString().Trim()));
                        sqlcom.Parameters.AddWithValue("@TimeOutLast", ConvertTo.DateTimeVal(timeEdit_Time_Out_Last.Text.ToString().Trim()));
                        sqlcom.Parameters.AddWithValue("@WorkingHours", ConvertTo.IntVal(totalWorkingHours_Text.Text.ToString().Trim()));



                        if (ComparisonUtilsWin.PictureBox_IsNullOrEmpty(pictureBox1))
                        {
                            byte[] byteEmpty = ConvertImageToBinary(WindowsFormsApplication1.Properties.Resources.profile_icon);
                            sqlcom.Parameters.AddWithValue("@EmpImage", byteEmpty);
                            PrintLogWin.PrintLog("================== 1");
                        }
                        else
                        {
                            sqlcom.Parameters.AddWithValue("@EmpImage", ConvertImageToBinary(pictureBox1.Image));
                            PrintLogWin.PrintLog("================== 2");
                        }

                        sqlcom.Parameters.AddWithValue("@DailyWage", chkDailyWage.Checked);
                        sqlcom.Parameters.AddWithValue("@DailyWageRate", (txtDailyWageRate.Text.Length == 0) ? 0 : txtDailyWageRate.EditValue);
                        sqlcom.Parameters.AddWithValue("@DailyWageMinutes", (txtDailyWageMinutes.Text.Length == 0) ? 0 : txtDailyWageMinutes.EditValue);

                        sqlcom.Parameters.AddWithValue("@TeaBreak", (chkTeaBreak.Checked) ? 1 : 0);
                        sqlcom.Parameters.AddWithValue("@TeaBreakTime", (txtTeaBreakTime.EditValue == null) ? 0 : txtTeaBreakTime.EditValue);
                        sqlcom.Parameters.AddWithValue("@EmpTeaTag", chTeaTag.Checked ? "Y" : "N");

                        sqlcom.ExecuteNonQuery();
                        transaction.Commit();
                        sqlcon.Close();
                        //XtraMessageBox.Show("Data Saved Successfully");
                        ProjectFunctions.SpeakError("Data Saved Successfully");
                        Close();
                    }
                    catch (Exception ex)
                    {
                        PrintLogWin.PrintLog(sql);


                        PrintLogWin.PrintLog("Line 663 : " + ex);
                        XtraMessageBox.Show("Something Wrong. \n I am going to Roll Back." + ex.Message, ex.GetType().ToString());
                        try
                        {
                            transaction.Rollback();
                        }
                        catch (Exception ex2)
                        {
                            XtraMessageBox.Show("Something Wrong. \n Roll Back Failed." + ex2.Message, ex2.GetType().ToString());
                        }
                    }
                }
            }
        }
コード例 #8
0
        private void BtnProcessSalary_Click(object sender, EventArgs e)
        {
            DateTime salaryMonth = ConvertTo.DateTimeVal(DtStartDate.EditValue);

            if (ProjectFunctions.SpeakConfirmation("Do you want to process Salary for month [ " + salaryMonth.ToString("MMMM yyyy") + " ]", "Confirmation", MessageBoxButtons.YesNo) != DialogResult.No)
            {
                try
                {
                    DataTable dtProcessSalary = new DataTable();
                    dtProcessSalary.Columns.Add("EmpCode", typeof(string));
                    dtProcessSalary.Columns.Add("SalaryMonth", typeof(DateTime));
                    dtProcessSalary.Columns.Add("SalaryPaid", typeof(decimal));
                    dtProcessSalary.Columns.Add("LoanInstallment", typeof(decimal));
                    dtProcessSalary.Columns.Add("SalaryCalculated", typeof(decimal));
                    dtProcessSalary.Columns.Add("TeaRate", typeof(decimal));
                    dtProcessSalary.Columns.Add("NoOfCups", typeof(decimal));
                    dtProcessSalary.Columns.Add("TotalTeaAmount", typeof(decimal));

                    for (int rowIndex = 0; rowIndex != gridView_SalaryProcess.RowCount; rowIndex++)
                    {
                        int    intRow              = gridView_SalaryProcess.GetVisibleRowHandle(rowIndex);
                        string strSalaryMonth      = gridView_SalaryProcess.GetRowCellValue(intRow, "SalaryMonth").ToString();
                        string strEmpCode          = gridView_SalaryProcess.GetRowCellValue(intRow, "EmpCode").ToString();
                        string strSalaryPaid       = gridView_SalaryProcess.GetRowCellValue(intRow, "SalaryPaid").ToString();
                        string strLoanInstallment  = gridView_SalaryProcess.GetRowCellValue(intRow, "Loan").ToString();
                        string strSalaryCalculated = gridView_SalaryProcess.GetRowCellValue(intRow, "SalaryCalculated").ToString();
                        string strTeaRate          = gridView_SalaryProcess.GetRowCellValue(intRow, "TeaRate").ToString();
                        string strNoOfCups         = gridView_SalaryProcess.GetRowCellValue(intRow, "NoOfCups").ToString();
                        string strTotalTeaAmount   = gridView_SalaryProcess.GetRowCellValue(intRow, "TotalTeaAmount").ToString();



                        PrintLogWin.PrintLog("----- btnProcessSalary_Click => strSalaryMonth: " + strSalaryMonth);
                        PrintLogWin.PrintLog("----- btnProcessSalary_Click => strEmpCode: " + strEmpCode);

                        //if (strSalaryPaid != null && strEmpCode.Equals("0030") && ConvertTo.DateTimeVal(strSalaryMonth).Month == 6)
                        if (strSalaryPaid != null)
                        {
                            if (ConvertTo.DecimalVal(strSalaryPaid) > 0)
                            {
                                PrintLogWin.PrintLog("strSalaryMonth => " + strSalaryMonth);
                                PrintLogWin.PrintLog("strEmpCode => " + strEmpCode);
                                PrintLogWin.PrintLog("strSalaryPaid => " + strSalaryPaid);
                                PrintLogWin.PrintLog("strLoanInstallment => " + strLoanInstallment);
                                PrintLogWin.PrintLog("strSalaryCalculated => " + strSalaryCalculated);
                                PrintLogWin.PrintLog("------------------------------");

                                //dt.Rows.Add(strEmpCode, ConvertTo.DateTimeVal(strSalaryMonth), ConvertTo.DecimalVal(strSalaryPaid));
                                dtProcessSalary.Rows.Add(
                                    strEmpCode,
                                    ConvertTo.DateFormatDb(strSalaryMonth),
                                    ConvertTo.DecimalVal(strSalaryPaid),
                                    ConvertTo.DecimalVal(strLoanInstallment),
                                    ConvertTo.DecimalVal(strSalaryCalculated),
                                    ConvertTo.DecimalVal(strTeaRate),
                                    ConvertTo.DecimalVal(strNoOfCups),
                                    ConvertTo.DecimalVal(strTotalTeaAmount)
                                    );

                                PrintLogWin.PrintLog("***** btnProcessSalary_Click => strSalaryMonth: " + strSalaryMonth);
                                PrintLogWin.PrintLog("***** btnProcessSalary_Click => strEmpCode: " + strEmpCode);
                            }
                        }


                        //cn.Execute(@"Insert INTO #routineUpdatedRecords VALUES('" + strEmpCode + "', '" + strSalaryMonth + "', " + strSalaryPaid + ")");
                    }

                    PrintLogWin.PrintLog("*******************************" + string.Empty);

                    using (SqlConnection con = new SqlConnection(ProjectFunctionsUtils.ConnectionString))
                    {
                        con.Open();
                        using (SqlCommand com = new SqlCommand("sp_UpdateSalaryPaid", con))
                        {
                            com.CommandType = CommandType.StoredProcedure;
                            com.Parameters.AddWithValue("@TableParam", dtProcessSalary);
                            com.ExecuteNonQuery();

                            ProjectFunctions.SpeakError("Salary Has Been Processed");
                            FillGrid();
                        }
                    }
                }
                catch (Exception ex)
                {
                    PrintLogWin.PrintLog(ex);
                }
            }
        }
コード例 #9
0
        private void FillGrid()
        {
            ClearGrid();

            //DECLARE @Salary_Month DATETIME = '2020-06-01 00:00:00';
            var str = "sp_Salary_Process '','" + ConvertTo.DateFormatDb(ConvertTo.DateTimeVal(DtStartDate.EditValue)) + "', 1, 1,'1','" + txtteatrate.Text + "','0'";

            PrintLogWin.PrintLog(str);

            DataSet ds = ProjectFunctionsUtils.GetDataSet(str);

            ds.Tables[0].Columns.Add(new DataColumn("Balance_1", typeof(double)));
            ds.Tables[0].Columns.Add(new DataColumn("Arrears_1", typeof(double)));
            ds.Tables[0].Columns.Add(new DataColumn("Loan_1", typeof(double)));
            ds.Tables[0].Columns.Add(new DataColumn("SalaryCalculated_1", typeof(double)));

            for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
            {
                ds.Tables[0].Rows[i]["Balance_1"]          = ConvertTo.DoubleVal(ds.Tables[0].Rows[i]["Balance"]);
                ds.Tables[0].Rows[i]["Arrears_1"]          = ds.Tables[0].Rows[i]["Arrears"];
                ds.Tables[0].Rows[i]["Loan_1"]             = ds.Tables[0].Rows[i]["Loan"];
                ds.Tables[0].Rows[i]["SalaryCalculated_1"] = ds.Tables[0].Rows[i]["SalaryCalculated"];
            }

            if (ComparisonUtils.IsNotNull_DataSet(ds))
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    gridControl_SalaryProcess.DataSource = ds.Tables[0];
                    gridView_SalaryProcess.BestFitColumns();

                    gridView_SalaryProcess.Columns["EmpSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "EmpSalary", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryEarned"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryEarned", string.Empty);
                    gridView_SalaryProcess.Columns["OT_Salary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "OT_Salary", string.Empty);
                    gridView_SalaryProcess.Columns["DeductionSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "DeductionSalary", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryGenerateBasic"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryGenerateBasic", string.Empty);
                    gridView_SalaryProcess.Columns["AdvanceSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "AdvanceSalary", string.Empty);
                    object p = gridView_SalaryProcess.Columns["Loan"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "Loan", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryCalculated"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryCalculated", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryPaid"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryPaid", string.Empty);
                    gridView_SalaryProcess.Columns["Balance"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "Balance", string.Empty);
                    gridView_SalaryProcess.Columns["Arrears"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "Arrears", string.Empty);
                    gridView_SalaryProcess.Columns["TotalTeaAmount"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "TotalTeaAmount", string.Empty);
                    //gridView_SalaryProcess.Columns["EmpSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Custom);

                    gridView_SalaryProcess.UpdateTotalSummary();
                }
            }
            else
            {
            }
            gridView_SalaryProcess.OptionsBehavior.Editable = true;

            foreach (DevExpress.XtraGrid.Columns.GridColumn Col in gridView_SalaryProcess.Columns)
            {
                if (Col.FieldName == "LoanIntsallment" || Col.FieldName == "SalaryPaid" || Col.FieldName == "Loan" || Col.FieldName == "NoOfCups")
                {
                }
                else
                {
                    Col.OptionsColumn.AllowEdit = false;
                }
            }

            SetGridViewStyle();
        }
コード例 #10
0
        public void LoadAttendanceDataGrid()
        {
            //ProgramMasterModel programMaster = ProgramMasterData.GetProgramMasterModel(GlobalVariables.ProgCode);

            //DataSet ds = ProjectFunctions.GetDataSet("Select ProgProcName,ProgDesc from ProgramMaster Where ProgCode='" + GlobalVariables.ProgCode + "'");
            //string ProcedureName = ds.Tables[0].Rows[0]["ProgProcName"].ToString();

            PrintLogWin.PrintLog("LoadAttendanceDataGrid => GlobalVariables.ProgCode ******************** " + GlobalVariables.ProgCode);
            //PrintLogWin.PrintLog("LoadAttendanceDataGrid => ProcedureName Dapper ******************** " + programMaster.ProgProcName);
            //PrintLogWin.PrintLog("LoadAttendanceDataGrid => ProcedureName B ******************** " + ProcedureName);


            //List<AttendanceModel> att = ProgramMasterData.GetData<AttendanceModel>(GlobalVariables.ProgCode);
            //PrintLogWin.PrintLog("LoadAttendanceDataGrid => att ******************** " + att.Count);


            gridView_AttendanceData.Columns.Clear();

            string  _params = "'" + txtEmpCode.EditValue + "', '" + ConvertTo.DateTimeVal(DtStartDate.EditValue).ToString("yyyy-MM-dd") + "'";
            DataSet att_ds  = ProgramMasterData.GetData(GlobalVariables.ProgCode, _params, "_v2");

            if (ComparisonUtils.IsNotNull_DataSet(att_ds))
            {
                BindingList <object> binding_list = new BindingList <object>();

                foreach (DataRow dr in att_ds.Tables[0].Rows)

                {
                    var employeeAttendance = new
                    {
                        SerialId = dr[Col.EmployeeAttendance.serial_id],
                        //EntryDate = dr[Col.EmployeeAttendance.entry_date],
                        AttendanceDate = ConvertTo.DateFormatApp(dr[Col.EmployeeAttendance.attendance_date]),
                        EmployeeCode   = dr[Col.EmployeeAttendance.employee_code],
                        //Shift = dr[Col.DailyShifts.shift_name],
                        Status        = dr[Col.AttendanceStatus.status],
                        TimeIn_First  = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_in_first]),
                        TimeOut_First = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_out_first]),
                        TimeIn_Last   = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_in_last]),
                        TimeOut_Last  = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_out_last]),
                        WorkingHours  = dr[Col.EmployeeAttendance.working_hours],
                        OverTime      = dr[Col.EmployeeAttendance.ot_deducton_time],
                        OverTime_1    = ConvertTo.IntVal(dr[Col.EmployeeAttendance.ot_deducton_time_1]),
                        GatePassTime  = dr[Col.EmployeeAttendance.gate_pass_time],
                        Source        = dr[Col.AttendanceSource.source_name],
                        RowStyle      = dr[Col.GridStyle.Row_Style]
                    };
                    //ConvertTo.DateTimeVal(dr[Col.EmployeeAttendance.attendance_in_first]).ToString("hh:mm tt")

                    binding_list.Add(employeeAttendance);
                }

                gridControl_AttendanceData.DataSource = binding_list;
                if (gridView_AttendanceData.Columns["SerialId"] != null)
                {
                    gridView_AttendanceData.Columns["SerialId"].Visible = false;
                }
                if (gridView_AttendanceData.Columns["EmployeeCode"] != null)
                {
                    gridView_AttendanceData.Columns["EmployeeCode"].Visible = false;
                }
                if (gridView_AttendanceData.Columns["RowStyle"] != null)
                {
                    gridView_AttendanceData.Columns["RowStyle"].Visible = false;
                }
                if (gridView_AttendanceData.Columns["OverTime_1"] != null)
                {
                    gridView_AttendanceData.Columns["OverTime_1"].Visible = false;
                }

                if (binding_list.Count > 0)
                {
                    //GridColumnSummaryItem item1 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Max, "GatePassTime", "MAX GatePassTime={0}");
                    //GridColumnSummaryItem item2 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Min, "GatePassTime", "MIN GatePassTime={0}");
                    //gridView_AttendanceData.Columns["GatePassTime"].Summary.Add(item1);
                    //gridView_AttendanceData.Columns["GatePassTime"].Summary.Add(item2);

                    //gridView_AttendanceData.Columns["WorkingHours"].Summary.Add(DevExpress.Data.SummaryItemType.Average, "WorkingHours", "Avg={0:n2}");
                    //gridView_AttendanceData.Columns["WorkingHours"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "WorkingHours", "Sum={0}");
                    //GridColumnSummaryItem item = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Max, "WorkingHours", "Max={0}");
                    //gridView_AttendanceData.Columns["WorkingHours"].Summary.Add(item);

                    //gridView_AttendanceData.Columns["OverTime"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "OverTime_1", "Total OverTime={0}",);

                    /*
                     *                  GridColumnSummaryItem item = new GridColumnSummaryItem();
                     *                  item.SummaryType = DevExpress.Data.SummaryItemType.Custom;
                     *
                     *                  item.Tag = "OverTime_Summary";
                     *                  gridView_AttendanceData.Columns["OverTime"].Summary.Add(item);
                     */
                    //item = new GridColumnSummaryItem();
                    //item.SummaryType = DevExpress.Data.SummaryItemType.Custom;
                    //item.Tag = "2";
                    //gridView_AttendanceData.Columns["OverTime"].Summary.Add(item);

                    gridView_AttendanceData.Columns["OverTime_1"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "OverTime_1", string.Empty);
                    gridView_AttendanceData.Columns["OverTime"].Summary.Add(DevExpress.Data.SummaryItemType.Custom);

                    gridView_AttendanceData.UpdateTotalSummary();
                }
            }
        }
コード例 #11
0
        private void SetFormValues(int rowIndex, string _employee_code, string _attendance_date, int _serial_id)
        {
            try
            {
                string str = "sp_GatePassData_Single '" + _employee_code + "', '" + ConvertTo.DateFormatDb(ConvertTo.DateTimeVal(_attendance_date)) + "', " + _serial_id + string.Empty;

                PrintLogWin.PrintLog(str);

                DataSet _ds = ProjectFunctionsUtils.GetDataSet(str);

                if (ComparisonUtils.IsNotNull_DataSet(_ds))
                {
                    DataRow dr = _ds.Tables[0].Rows[rowIndex];
                    DtDate.EditValue = Convert.ToDateTime(dr["AttendanceDate"]);
                    txtEmpCode.Text  = dr["EmpCode"].ToString();
                    txtEmpCode.Tag   = dr["SerialId"].ToString();

                    txtEmpCodeDesc.Text = dr["EmpName"].ToString();
                    txtEmpCodeDesc.Tag  = dr["DeptDesc"].ToString();

                    txtStatusCode.Text = dr["StatusCode"].ToString();
                    txtStatusCode.Tag  = dr["UnitName"].ToString();

                    txtStatusCodeDesc.Text = dr["Status"].ToString();

                    timeEdit_Time_Out.EditValue = dr["TimeOut"].ToString();
                    timeEdit_Time_In.EditValue  = dr["TimeIn"].ToString();

                    pictureBox1.Image = ImageUtils.ConvertBinaryToImage((byte[])dr["EmpImage"]);

                    PrintLogWin.PrintLog("TimeOut " + dr["TimeOut"].ToString());
                    PrintLogWin.PrintLog("TimeIn " + dr["TimeIn"].ToString());

                    ////////////////////////

                    /*XtraReportGatePass report = new XtraReportGatePass(
                     * dr["EmpCode"].ToString(),
                     * ConvertTo.IntVal(dr["SerialId"].ToString()),
                     * dr["EmpName"].ToString(),
                     * dr["DeptDesc"].ToString() + "",
                     * dr["UnitName"].ToString() + "",
                     * "",
                     * dr["Status"].ToString(),
                     * timeEdit_Time_Out.EditValue + "",
                     * timeEdit_Time_In.EditValue + "",
                     * pictureBox1.Image
                     * );*/
                }
                else
                {
                    //clear();
                }
            }
            catch (Exception ex)
            {
                PrintLogWin.PrintLog(ex);
                //                clear();
            }
        }