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("---------------------------------"); }
private void OnClickRow() { try { //DataRow CurrentRow = gridView_AttendanceData.GetDataRow(gridView_AttendanceData.FocusedRowHandle); int row = (gridControl_AttendanceData.FocusedView as ColumnView).FocusedRowHandle; ColumnView detailView = (ColumnView)gridControl_AttendanceData.FocusedView; int cellValue_serial_id = ConvertTo.IntVal(detailView.GetFocusedRowCellValue("SerialId")); //.GetRowCellValue(row, "Edit_Link").ToString(); // string employee_code = detailView.GetFocusedRowCellValue("EmployeeCode").ToString(); string attendance_date = ConvertTo.DateFormatDb(detailView.GetFocusedRowCellValue("AttendanceDate").ToString()); PrintLogWin.PrintLog("%%%%%%%%%%%%%%%%" + cellValue_serial_id); PrintLogWin.PrintLog("%%%%%%%%%%%%%%%%" + row); //MessageBox.Show(CurrentRow[0] + ""); OpenAttendanceForm(cellValue_serial_id, employee_code, attendance_date); } catch (Exception ex) { PrintLogWin.PrintLog("%%%%%%%%%%%%%%%% => Exception : " + ex); } }
//Convert image to binary byte[] ConvertImageToBinary(Image img) { try { if (img != null) { using (MemoryStream ms = new MemoryStream()) { img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); return(ms.ToArray()); } } } catch (Exception ex) { PrintLogWin.PrintLog(ex); } try { using (MemoryStream ms = new MemoryStream()) { Properties.Resources.profile_icon.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); return(ms.ToArray()); } } catch (Exception ex) { PrintLogWin.PrintLog(ex); } return(null); }
public XtraReportGatePass( string _employee_code, int _serial_id, string _employee_code_desc, string _employee_dept, string _employee_unit, string _employee_contact, string _employee_status, string _time_out, string _time_in, Image image) { InitializeComponent(); PrintLogWin.PrintLog("employee_code : " + _employee_code); PrintLogWin.PrintLog("serial_id : " + _serial_id + ""); rptEmpCode.Text = _employee_code; rptEmpCodeDesc.Text = _employee_code_desc; rptEmpDept.Text = _employee_dept; rptEmpUnit.Text = _employee_unit; rptEmpContact.Text = _employee_contact; rptStatus.Text = _employee_status; rptTimeOut.Text = _time_out; rptTimeIn.Text = _time_in; rptPictureBox.ImageSource = new DevExpress.XtraPrinting.Drawing.ImageSource(image); }
public void LoadGatePassDataGrid() { PrintLogWin.PrintLog("LoadGatePassDataGrid => GlobalVariables.ProgCode ******************** : " + GlobalVariables.ProgCode); try { gridView_GatePassData.Columns.Clear(); string _storedProcedre = SQL_QUERIES.Sp_GatePassData_Daily_List() + " '" + txtEmpCode.EditValue + "', '" + ConvertTo.DateFormatDb(DtDate.EditValue) + "'"; //DataSet ds = ProgramMasterData.GetData(GlobalVariables.ProgCode, _params); DataSet _ds = ProjectFunctionsUtils.GetDataSet(_storedProcedre); if (_ds.Tables[0].Rows.Count > 0) { gridControl_GatePassData.DataSource = _ds.Tables[0]; gridView_GatePassData.BestFitColumns(); //////////////////// PrintPrivewButton.Enabled = true; PrintButton.Enabled = true; } else { gridControl_GatePassData.DataSource = null; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString().Trim()); } }
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()); } }
private void Button_delete_ButtonClick(object sender, ButtonPressedEventArgs e) { BtnEdit_Click(null, e); PrintLogWin.PrintLog("================= button_delete_ButtonClick" + string.Empty); }
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(); } }
private void GridEvents() { PrintLogWin.PrintLog("*[ GridEvents ]*"); gridView_AttendanceData.ShowingEditor += GridView_UserMaster_ShowingEditor; gridView_AttendanceData.DoubleClick += GridControl_AttendanceData_DoubleClick; }
private void FrmGatePassLaoding_Load(object sender, EventArgs e) { PrintLogWin.PrintLog("*[ frmGatePassLaoding_Load ]*"); SetMyControls2(); LoadGatePassDataGrid(true); }
private void FrmExcelDataLoading_Load(object sender, EventArgs e) { PrintLogWin.PrintLog("*[ frmExcelDataLoading_Load ]*"); //SetMyControls(); SetMyControls2(); LoadAttendanceDataGrid(); }
private void GridControl_AttendanceData_DoubleClick(object sender, EventArgs e) { gridView_AttendanceData.SetMasterRowExpanded(0, false); gridView_AttendanceData.SetMasterRowExpanded(1, true); DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(gridControl_AttendanceData, e).Handled = true; PrintLogWin.PrintLog("*[ gridControl_AttendanceData_DoubleClick ]*"); OnClickRow(); }
//private DataSet dsMain; private void FrmGatePassTimeAddEdit_Load(object sender, EventArgs e) { securityPassword = ProjectFunctionsUtils.GetDateChangePassword(); PrintLogWin.PrintLog(securityPassword); PrintPrivewButton.Enabled = false; PrintButton.Enabled = false; SetMyControls(); if (S1 == "Add") { //DtDate.Enabled = false; DtDate.EditValue = DateTime.Now; //DtDateforMonth.EditValue = DateTime.Now; //txtAdvanceNo.Text = getNewLoanPassNo().PadLeft(6, '0'); //txtStatusCode.Text = "A"; txtEmpCode.Focus(); } if (S1 == "Edit") { //DtDateforMonth.Enabled = false; DtDate.Enabled = false; txtEmpCode.Enabled = false; DtDate.EditValue = Attendance_date; txtEmpCode.EditValue = Employee_code; try { SetFormValues(0, Employee_code, Attendance_date, 0); //if (ComparisonUtils.IsNotNull_DataSet(dsMain)) //{ //gridControl_GatePassData.DataSource = dsMain.Tables[0]; //gridView_GatePassData.BestFitColumns(); //DtDate.EditValue = Convert.ToDateTime(ds.Tables[0].Rows[0]["AttendanceDate"]); //txtEmpCode.Text = ds.Tables[0].Rows[0]["EmpCode"].ToString(); //txtEmpCodeDesc.Text = ds.Tables[0].Rows[0]["EmpName"].ToString(); //txtStatusCode.Text = ds.Tables[0].Rows[0]["StatusCode"].ToString(); //txtStatusCodeDesc.Text = ds.Tables[0].Rows[0]["Status"].ToString(); //} } catch (Exception ex) { PrintLogWin.PrintLog(ex); } } }
private void GridEvents() { PrintLogWin.PrintLog("*[ GridEvents ]*"); //Disableed //gridControl_AttendanceData.Load += gridControl_AttendanceData_Load; //In Non-Editable Mode gridView_AttendanceData.ShowingEditor += GridView_UserMaster_ShowingEditor; //gridView_UserMaster.DoubleClick += gridView_DoubleClick; //gridControl_AttendanceData.DoubleClick += gridControl_AttendanceData_DoubleClick; gridView_AttendanceData.DoubleClick += GridControl_AttendanceData_DoubleClick; }
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; } }
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); } }
private void OnClickRow() { int row = (gridControl_AttendanceData.FocusedView as ColumnView).FocusedRowHandle; ColumnView detailView = (ColumnView)gridControl_AttendanceData.FocusedView; string employee_code = detailView.GetFocusedRowCellValue("EmpCode").ToString(); string gate_pass_date = detailView.GetFocusedRowCellValue("GatePassDate").ToString(); PrintLogWin.PrintLog("%%%%%%%%%%%%%%%%" + row); PrintLogWin.PrintLog("%%%%%%%%%%%%%%%% employee_code " + employee_code); PrintLogWin.PrintLog("%%%%%%%%%%%%%%%% gate_pass_date " + gate_pass_date); OpenAttendanceForm("Edit", employee_code, gate_pass_date); }
//Convert binary to image Image ConvertBinaryToImage(byte[] data) { try { if (data != null) { using (MemoryStream ms = new MemoryStream(data)) { return(Image.FromStream(ms)); } } } catch (Exception ex) { PrintLogWin.PrintLog(ex); } return(null); }
//https://supportcenter.devexpress.com/ticket/details/a2934/how-to-handle-a-double-click-on-a-grid-row-or-cell void GridView_UserMaster_ShowingEditor(object sender, CancelEventArgs e) { if (gridView_UserMaster.FocusedColumn == gridView_UserMaster.Columns["Action"]) { PrintLogWin.PrintLog("********************* A "); return; } if (gridView_UserMaster.FocusedRowHandle == GridControl.NewItemRowHandle) { PrintLogWin.PrintLog("********************* B "); e.Cancel = false; } else { PrintLogWin.PrintLog("********************* C "); e.Cancel = true; } }
private void GridControl_GatePassData_DoubleClick(object sender, EventArgs e) { try { //int rowIndex = (gridControl_GatePassData.FocusedView as ColumnView).FocusedRowHandle; ColumnView detailView = (ColumnView)gridControl_GatePassData.FocusedView; int cellValue_serial_id = ConvertTo.IntVal(detailView.GetFocusedRowCellValue("SerialId")); string date_value = detailView.GetFocusedRowCellValue("Date") + string.Empty; SetFormValues(0, Employee_code, date_value, cellValue_serial_id); } catch (Exception ex) { PrintLogWin.PrintLog(ex); } }
private void FillDataToGrid() { PrintLogWin.PrintLog("FillGrid ******************** " + GlobalVariables.ProgCode); try { DataSet ds = ProjectFunctions.GetDataSet("Select ProgProcName,ProgDesc from ProgramMaster Where ProgCode='" + GlobalVariables.ProgCode + "'"); string ProcedureName = ds.Tables[0].Rows[0]["ProgProcName"].ToString(); PrintLogWin.PrintLog("FillGrid => ProcedureName ******************** " + ProcedureName); //ProjectFunctions.BindMasterFormToGrid(ProcedureName, gridControl_UserMaster, gridView_UserMaster); DataSet dsMaster = ProjectFunctionsUtils.GetDataSet(ProcedureName); FillTable(dsMaster); AddUnboundColumn(); AddButtonToGrid(); //userMasterBindingSource.DataSource = Binding_DataHelper.GetData(dsMaster); //RepositoryItemPictureEdit pictureEdit = new RepositoryItemPictureEdit(); //pictureEdit.SizeMode = PictureSizeMode.Zoom; //pictureEdit.NullText = " "; //pictureEdit.Padding = new Padding(1); //pictureEdit.Click += gridControl_UserMaster_Click // ; //gridControl_UserMaster.DataSource = CreateData(dsMaster); //gridView_UserMaster.Columns["Edit_Link"].ColumnEdit = pictureEdit ; //gridView_UserMaster.Columns["Edit_Link"].Visible = false; //GridColumn col = gridView_UserMaster.Columns.AddVisible("Edit", "Edit_Link"); //col.UnboundType = DevExpress.Data.UnboundColumnType.Object; //col.ColumnEdit = pictureEdit;// repositoryItemPictureEdit1; //gridView_UserMaster.CustomUnboundColumnData += gridView1_CustomUnboundColumnData; toolStrip_lbl.Text = ds.Tables[0].Rows[0]["ProgDesc"].ToString(); } catch (Exception ex) { MessageBox_Debug.ShowBox("frmMaster => FillGrid() => " + ex); } }
private void BtnEdit_Click(object sender, EventArgs e) { if (btnEdit.Enabled) { if (ComparisonUtils.IsEqualTo_String(GlobalVariables.ProgCode, WIN_APP_TABS._frmUserDetails)) { //DataRow CurrentRow = gridView_UserMaster.GetDataRow(gridView_UserMaster.FocusedRowHandle); //gridControl_UserMaster.Ge //ColumnView detailView = (ColumnView)gridControl_UserMaster.FocusedView; // //int foundIndex = detailView.GetDataSourceRowIndex(detailView.FocusedRowHandle); //DataRow CurrentRow = detailView.GetDataRow(detailView.FocusedRowHandle); int row = (gridControl_UserMaster.FocusedView as ColumnView).FocusedRowHandle; ColumnView detailView = (ColumnView)gridControl_UserMaster.FocusedView; string cellValue_UserName = detailView.GetRowCellValue(row, "UserName").ToString(); PrintLogWin.PrintLog(cellValue_UserName ); //int foundIndex = userMasterBindingSource.Find("clients_id", cellValue); //userMasterBindingSource.Position = foundIndex; FrmUserDetails frm = new FrmUserDetails() { S1 = btnEdit.Text, Text = "User Editing", UserName = cellValue_UserName }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(Parent); } } FillDataToGrid(); }
private void GridView_SalaryProcess_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e) { GridView view = sender as GridView; var focusRowView = (DataRowView)view.GetFocusedRow(); if (view.FocusedColumn.FieldName.ToUpper() == "NOOFCUPS") { int salary_locked = ConvertTo.IntVal(focusRowView["SalaryLocked"]); if (salary_locked == 0) { decimal noofcups = ConvertTo.DecimalVal(e.Value); decimal tearate = Convert.ToDecimal(txtteatrate.Text); decimal totalteaamount = noofcups * tearate; decimal salary_calculated = ConvertTo.DecimalVal(focusRowView["SalaryCalculated_1"]); decimal salary_calculated_new = salary_calculated - totalteaamount; view.SetRowCellValue(view.FocusedRowHandle, view.Columns["TotalTeaAmount"], totalteaamount); if (totalteaamount > 0) { view.SetRowCellValue(view.FocusedRowHandle, view.Columns["SalaryCalculated"], salary_calculated_new); } else { view.SetRowCellValue(view.FocusedRowHandle, view.Columns["SalaryCalculated"], salary_calculated); } ProjectFunctions.GetDataTable(" update tbl_Process_Salary Set NoOfCups = '" + noofcups + "' Where MONTH(SalaryMonth)= '" + Convert.ToDateTime(DtStartDate.EditValue).Month + "' and YEAR(SalaryMonth) = '" + Convert.ToDateTime(DtStartDate.EditValue).Year + "' and EmpCode = '" + ConvertTo.StringVal(focusRowView["EmpCode"]) + "'"); } else { } } if (view.FocusedColumn.FieldName == "SalaryPaid") { int salary_locked = ConvertTo.IntVal(focusRowView["SalaryLocked"]); if (salary_locked == 0) { decimal salary_paying = ConvertTo.DecimalVal(e.Value); decimal salary_calculated = ConvertTo.DecimalVal(focusRowView["SalaryCalculated"]); decimal salary_calculated_and_paying_difference = salary_calculated - salary_paying; decimal balance_new = salary_calculated_and_paying_difference; //PrintLogWin.PrintLog("******* balance_old A " + balance_old); PrintLogWin.PrintLog("******* balance_old B " + focusRowView["Balance"]); PrintLogWin.PrintLog("******* salary_paying " + salary_paying); PrintLogWin.PrintLog("******* salary_calculated " + salary_calculated); PrintLogWin.PrintLog("******* salary_calculated_and_paying_difference " + salary_calculated_and_paying_difference); PrintLogWin.PrintLog("******* balance_new " + balance_new); view.SetRowCellValue(view.FocusedRowHandle, view.Columns["Balance"], balance_new); } else { //view.SetRowCellValue(view.FocusedRowHandle, view.Columns["SalaryPaid"], balance_new); } } if (view.FocusedColumn.FieldName == "Loan") { decimal salary_paid = ConvertTo.DecimalVal(focusRowView["SalaryPaid"]); decimal loan_old = ConvertTo.DecimalVal(focusRowView["Loan_1"]); decimal loan_paying = ConvertTo.DecimalVal(e.Value); decimal salary_calculated_1 = ConvertTo.DecimalVal(focusRowView["SalaryCalculated_1"]); decimal new_salary_calculated = (salary_calculated_1 + loan_old) - loan_paying; PrintLogWin.PrintLog("******* loan_old " + loan_old); PrintLogWin.PrintLog("******* loan_paying " + loan_paying); PrintLogWin.PrintLog("******* salary_calculated_1 " + salary_calculated_1); PrintLogWin.PrintLog("******* new_salary_calculated " + new_salary_calculated); view.SetRowCellValue(view.FocusedRowHandle, view.Columns["SalaryCalculated"], new_salary_calculated); ///////////////////////////////////////////////////////////// if (salary_paid > 0) { decimal salary_paying = ConvertTo.DecimalVal(focusRowView["SalaryPaid"]); decimal salary_calculated = ConvertTo.DecimalVal(focusRowView["SalaryCalculated"]); decimal salary_calculated_and_paying_difference = salary_calculated - salary_paying; decimal balance_new = salary_calculated_and_paying_difference; //PrintLogWin.PrintLog("******* balance_old A " + balance_old); PrintLogWin.PrintLog("******* balance_old B " + focusRowView["Balance"]); PrintLogWin.PrintLog("******* salary_paying " + salary_paying); PrintLogWin.PrintLog("******* salary_calculated " + salary_calculated); PrintLogWin.PrintLog("******* salary_calculated_and_paying_difference " + salary_calculated_and_paying_difference); PrintLogWin.PrintLog("******* balance_new " + balance_new); view.SetRowCellValue(view.FocusedRowHandle, view.Columns["Balance"], balance_new); } } }
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()); } } } } }
private void CalculateDUtyHours() { //DateTime.ParseExact(Eval("aeStart").ToString(), "HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToShortTimeString() //int shift_id = 1; PrintLogWin.PrintLog("************* CalculateDUtyHours => CalculateDUtyHours"); try { PrintLogWin.PrintLog("************* form_loaded => " + form_loaded + string.Empty); PrintLogWin.PrintLog("************* timeEdit_Time_In_First.EditValue => " + timeEdit_Time_In_First.EditValue + string.Empty); PrintLogWin.PrintLog("************* timeEdit_Time_Out_First.EditValue => " + timeEdit_Time_Out_First.EditValue + string.Empty); PrintLogWin.PrintLog("************* timeEdit_Time_In_Last.EditValue => " + timeEdit_Time_In_Last.EditValue + string.Empty); PrintLogWin.PrintLog("************* timeEdit_Time_Out_Last.EditValue => " + timeEdit_Time_Out_Last.EditValue + string.Empty); if (!form_loaded) { } else { double totalHrs_First = 0; double totalHrs_Last = 0; if (timeEdit_Time_In_First.EditValue != null && timeEdit_Time_Out_First.EditValue != null) { DateTime dateTime_In_2 = ConvertTo.TimeToDate(timeEdit_Time_In_First.Text + string.Empty); DateTime dateTime_Out_2 = ConvertTo.TimeToDate(timeEdit_Time_Out_First.Text + string.Empty); if (dateTime_Out_2 < dateTime_In_2) { if (S1 == "Edit") { ProjectFunctions.SpeakError("Time Out First cannot be less than Time In First in Day Shift"); timeEdit_Time_Out_First.EditValue = null; } } else { totalHrs_First = (dateTime_Out_2 - dateTime_In_2).TotalHours; if (totalHrs_First < 0) { totalHrs_First *= -1; } } } if (timeEdit_Time_In_Last.EditValue != null && timeEdit_Time_Out_Last.EditValue != null) { DateTime dateTime_In_Last = ConvertTo.TimeToDate(timeEdit_Time_In_Last.Text + string.Empty); DateTime dateTime_Out_Last = ConvertTo.TimeToDate(timeEdit_Time_Out_Last.Text + string.Empty); if (timeEdit_Time_Out_First.EditValue != null) { DateTime dateTime_Out_1 = ConvertTo.TimeToDate(timeEdit_Time_Out_First.Text + string.Empty); if (dateTime_In_Last < dateTime_Out_1) { if (S1 == "Edit") { ProjectFunctions.SpeakError("Time In Last cannot be less than Time Out First in Day Shift"); timeEdit_Time_In_Last.EditValue = null; } } else { if (dateTime_Out_Last < dateTime_In_Last) { if (S1 == "Edit") { ProjectFunctions.SpeakError("Time Out Last cannot be less than Time In Last in Day Shift"); timeEdit_Time_Out_Last.EditValue = null; } } else { totalHrs_Last = (dateTime_Out_Last - dateTime_In_Last).TotalHours; if (totalHrs_Last < 0) { totalHrs_Last *= -1; } } } } else { if (dateTime_Out_Last < dateTime_In_Last) { if (S1 == "Edit") { ProjectFunctions.SpeakError("Time Out Last cannot be less than Time In Last in Day Shift"); timeEdit_Time_Out_Last.EditValue = null; } } else { totalHrs_Last = (dateTime_Out_Last - dateTime_In_Last).TotalHours; if (totalHrs_Last < 0) { totalHrs_Last *= -1; } } } } double totalHrs_FullDay = totalHrs_First + totalHrs_Last; totalWorkingHours_Text.Text = (totalHrs_FullDay).ToString(); } } catch (Exception ex) { MessageBox.Show(timeEdit_Time_In_First.EditValue + "\n\n" + ex + string.Empty); } }
private void EmployeeFormData_Load() { SetMyControls(); if (S1 == "&Add") { chkDailyWage.Checked = true; chkDailyWage.Checked = false; chkTeaBreak.Checked = true; chkTeaBreak.Checked = false; txtEmpName.Select(); txtEmpCode.Text = ProjectFunctionsUtils.GetNewEmpCode();//.PadLeft(5, '0'); form_loaded = true; } if (S1 == "Edit") { RepList <EmployeeMasterModel> lista = new RepList <EmployeeMasterModel>(); DynamicParameters param = new DynamicParameters(); param.Add("@EmpCode", EmpCode); EmployeeMasterModel empData = lista.returnClass_SP(SQL_QUERIES._frmEmployeeMstAddEdit.sp_LoadEmpMstFEditing(), param); //PrintLogWin.PrintLog("**************** =========> Line 120 => listData => " + listData.Count + ""); if (empData != null) { if (empData.EmpTeaTag == "Y") { chTeaTag.Checked = true; } else { chTeaTag.Checked = false; } txtEmpCode.Text = empData.EmpCode; // ds.Tables[0].Rows[0]["EmpCode"].ToString(); txtEmpName.Text = empData.EmpName; txtRelationTag.Text = empData.EmpFHRelationTag; //ds.Tables[0].Rows[0]["EmpFHRelationTag"].ToString(); txtFHName.Text = empData.EmpFHName; //ds.Tables[0].Rows[0]["EmpFHName"].ToString(); txtDeptCode.Text = empData.EmpDeptCode; //ds.Tables[0].Rows[0]["EmpDeptCode"].ToString(); txtDeptDesc.Text = empData.DeptDesc; //ds.Tables[0].Rows[0]["DeptDesc"].ToString(); txtDesgCode.Text = empData.EmpDesgCode; //ds.Tables[0].Rows[0]["EmpDesgCode"].ToString(); txtDesgDesc.Text = empData.DesgDesc; //ds.Tables[0].Rows[0]["DesgDesc"].ToString(); txtUnitCode.Text = empData.UnitCode; //ds.Tables[0].Rows[0]["EmpDesgCode"].ToString(); txtUnitDesc.Text = empData.UnitName; //ds.Tables[0].Rows[0]["DesgDesc"].ToString(); txtEmpSex.Text = empData.EmpSex; //ds.Tables[0].Rows[0]["EmpSex"].ToString(); if (empData.EmpDOJ.ToString() == string.Empty) { } else { txtDOJ.EditValue = Convert.ToDateTime(empData.EmpDOJ); } if (empData.EmpDOL.ToString() == string.Empty) { } else { txtDOL.EditValue = Convert.ToDateTime(empData.EmpDOL); } txtEPFTag.Text = empData.EmpPFDTag; //ds.Tables[0].Rows[0]["EmpPFDTag"].ToString(); txtESIDTag.Text = empData.EmpESIDTag; //ds.Tables[0].Rows[0]["EmpESIDTag"].ToString(); txtEPFNo.Text = empData.EmpPFno; //ds.Tables[0].Rows[0]["EmpPFno"].ToString(); txtESICNo.Text = empData.EmpESIno; //ds.Tables[0].Rows[0]["EmpESIno"].ToString(); txtTDS.Text = empData.EmpTDS.ToString(); //ds.Tables[0].Rows[0]["EmpTDS"].ToString(); txtEmpLeft.Text = empData.EmpLeft; //ds.Tables[0].Rows[0]["EmpLeft"].ToString(); txtRemarks.Text = empData.EmpRemarks; //ds.Tables[0].Rows[0]["EmpRemarks"].ToString(); txtMotherName.Text = empData.EmpMotherNm; //ds.Tables[0].Rows[0]["EmpMotherNm"].ToString(); txtState.Text = empData.EmpPerState; //ds.Tables[0].Rows[0]["EmpPerState"].ToString(); txtState.Text = empData.EmpPerCountry; //ds.Tables[0].Rows[0]["EmpPerCountry"].ToString(); txtNationality.Text = empData.EmpNationality; //ds.Tables[0].Rows[0]["EmpNationality"].ToString(); txtEmail.Text = empData.EmpEmail; //ds.Tables[0].Rows[0]["EmpEmail"].ToString(); txtCategoryCode.Text = empData.EmpCategory; //ds.Tables[0].Rows[0]["EmpCategory"].ToString(); txtCategoryDesc.Text = empData.CatgDesc; //ds.Tables[0].Rows[0]["CatgDesc"].ToString(); txtDOB.EditValue = Convert.ToDateTime(empData.EmpDoB); txtPanNo.Text = empData.EmpPanNo; //ds.Tables[0].Rows[0]["EmpPanNo"].ToString(); txtPassPortNo.Text = empData.EmpPassportNo; //ds.Tables[0].Rows[0]["EmpPassportNo"].ToString(); txtEmployeeReligion.Text = empData.EmpReligion; //ds.Tables[0].Rows[0]["EmpReligion"].ToString(); txtMaritalStatus.Text = empData.EmpMaritalStatus; //ds.Tables[0].Rows[0]["EmpMaritalStatus"].ToString(); txtPaymentMode.Text = empData.EmpPymtMode; //ds.Tables[0].Rows[0]["EmpPymtMode"].ToString(); txtIfscCode.Text = empData.EmpBankIFSCode; //ds.Tables[0].Rows[0]["EmpBankIFSCode"].ToString(); txtBankAccountNo.Text = empData.EmpBankAcNo; //ds.Tables[0].Rows[0]["EmpBankAcNo"].ToString(); txtBankName.Text = empData.EmpBankName; //ds.Tables[0].Rows[0]["EmpBankName"].ToString(); txtNomineeName.Text = empData.EmpNominee; //ds.Tables[0].Rows[0]["EmpNominee"].ToString(); txtNomineeRelation.Text = empData.EmpNomineeRelation; //ds.Tables[0].Rows[0]["EmpNomineeRelation"].ToString(); if (empData.EmpNomineeDOB.ToString() == string.Empty) { } else { txtNomineeDOB.EditValue = Convert.ToDateTime(empData.EmpNomineeDOB); } txtAdharCardNo.Text = empData.EmpAdharCardNo; //ds.Tables[0].Rows[0]["EmpAdharCardNo"].ToString(); txtHealthInsurance.Text = empData.EmpGHISDed.ToString(); //ds.Tables[0].Rows[0]["EmpGHISDed"].ToString(); txtMiscDed.Text = empData.EmpMscD1.ToString(); //ds.Tables[0].Rows[0]["EmpMscD1"].ToString(); txtAddress1.Text = empData.EmpAddress1; //ds.Tables[0].Rows[0]["EmpAddress1"].ToString(); txtAddress2.Text = empData.EmpAddress2; //ds.Tables[0].Rows[0]["EmpAddress2"].ToString(); txtAddress3.Text = empData.EmpAddress3; //ds.Tables[0].Rows[0]["EmpAddress3"].ToString(); txtState.Text = empData.EmpState; //ds.Tables[0].Rows[0]["EmpState"].ToString(); txtCountry.Text = empData.EmpCountry; //ds.Tables[0].Rows[0]["EmpCountry"].ToString(); txtEFPFTag.Text = empData.EmpFpfDTag; //ds.Tables[0].Rows[0]["EmpFpfDTag"].ToString(); //NULL Exception //txtUANNo.Text = ds.Tables[0].Rows[0]["EmpUANNo"].ToString(); //txtUnitCode.Text = ds.Tables[0].Rows[0]["UnitCode"].ToString(); //txtUnitName.Text = ds.Tables[0].Rows[0]["UnitName"].ToString(); //txtAccCode.Text = ds.Tables[0].Rows[0]["EmpPartyCode"].ToString(); //txtBankBranchCode.Text = ds.Tables[0].Rows[0]["EmpBankBranchCode"].ToString(); txtCategoryCode.Focus(); timeEdit_Time_In_First.EditValue = empData.TimeInFirst.ToString(); timeEdit_Time_Out_First.EditValue = empData.TimeOutFirst.ToString(); timeEdit_Time_In_Last.EditValue = empData.TimeInLast.ToString(); timeEdit_Time_Out_Last.EditValue = empData.TimeOutLast.ToString(); totalWorkingHours_Text.EditValue = empData.WorkingHours; pictureBox1.Image = ConvertBinaryToImage(empData.EmpImage); chkTeaBreak.Checked = (empData.TeaBreak == 1) ? true : false; txtTeaBreakTime.EditValue = empData.TeaBreakTime; PrintLogWin.PrintLog("chkTeaBreak.Checked =========> " + chkTeaBreak.Checked + string.Empty); PrintLogWin.PrintLog("empData.TeaBreak =========> " + empData.TeaBreak + string.Empty); chkDailyWage.Checked = empData.DailyWage; PrintLogWin.PrintLog("chkDailyWage.Checked =========> " + chkDailyWage.Checked + string.Empty); PrintLogWin.PrintLog("empData.DailyWage =========> " + empData.DailyWage + string.Empty); //DAILY WAGER////////////////////////////// if (chkDailyWage.Checked) { if (empData.DailyWageRate != null && empData.DailyWageRate != 0) { txtDailyWageRate.EditValue = empData.DailyWageRate; txtDailyWageRate.Tag = empData.DailyWageRate; } else { txtDailyWageRate.EditValue = null; } if (empData.DailyWageMinutes != null && empData.DailyWageMinutes != 0) { txtDailyWageHours.EditValue = empData.DailyWageMinutes / 60; txtDailyWageHours.Tag = empData.DailyWageMinutes / 60; } else { txtDailyWageHours.EditValue = null; } } else { txtDailyWageRate.Enabled = false; txtDailyWageRate.EditValue = null; txtDailyWageHours.Enabled = false; txtDailyWageHours.EditValue = null; } //TEA BREAK////////////////////////////// if (chkTeaBreak.Checked) { if (empData.TeaBreakTime != null && empData.TeaBreakTime != 0) { txtTeaBreakTime.EditValue = empData.TeaBreakTime; txtTeaBreakTime.Tag = empData.TeaBreakTime; } else { txtTeaBreakTime.EditValue = null; } } else { txtTeaBreakTime.Enabled = false; txtTeaBreakTime.EditValue = null; } } form_loaded = true; txtEmpName.Enabled = false; PrintLogWin.PrintLog("frmEmployeeMstAddEdit_Load =========> Line 131 => sp_LoadEmpMstFEditing '" + EmpCode + "'"); } }
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); } } }
private void SetGridViewStyle() { gridView_Style_List = ProjectFunctionsUtils.GridView_Style("frmProcessSalary", "gridControl_SalaryProcess"); if (gridView_Style_List != null) { int rowIndex = 0; foreach (GridColumn Col in gridView_SalaryProcess.Columns) { try { if (gridView_Style_List.Exists(x => x.column_name.Equals(Col.FieldName))) { GridView_Style_Model item = gridView_Style_List.Single <GridView_Style_Model>(x => x.column_name.Equals(Col.FieldName)); bool colShow = true; try { if (ComparisonUtils.IsNotEmpty(item.column_show)) { if (item.column_show == 0) { colShow = false; Col.Visible = false; //gridView_SalaryProcess.Columns[Col.FieldName].Visible = false; } else { colShow = true; Col.Visible = true; //gridView_SalaryProcess.Columns[Col.FieldName].Visible = true; } } } catch (Exception ex) { PrintLogWin.PrintLog("SetGridViewStyle => Color => Exception => " + ex); } if (colShow) { try { if (ComparisonUtils.IsNotEmpty(item.color_code)) { string hex = item.color_code; Color color = System.Drawing.ColorTranslator.FromHtml(hex); Col.AppearanceCell.BackColor = color; } } catch (Exception ex) { PrintLogWin.PrintLog("SetGridViewStyle => Color => Exception => " + ex); } try { if (ComparisonUtils.IsNotEmpty(item.font_style)) { if (item.font_style.ToLower().Equals("bold")) { Col.AppearanceCell.FontStyleDelta = FontStyle.Bold; } if (item.font_style.ToLower().Equals("Italic")) { Col.AppearanceCell.FontStyleDelta = FontStyle.Italic; } } } catch (Exception ex) { PrintLogWin.PrintLog("SetGridViewStyle => FontStyle => Exception => " + ex); } } } } catch (Exception ex) { PrintLogWin.PrintLog("SetGridViewStyle => Exception => " + ex); } if (Col.FieldName == "SalaryLocked") { } rowIndex++; } } }
private void FrmAdvanceAddEdit_Load(object sender, EventArgs e) { SetMyControls(); if (S1 == "Add") { DtDate.Enabled = true; DtDate.EditValue = DateTime.Now; DtDateforMonth.EditValue = DateTime.Now; txtAdvanceNo.Text = GetNewLoanPassNo().PadLeft(6, '0'); txtType.Text = "A"; DtDate.Focus(); } if (S1 == "Edit") { DtDateforMonth.Enabled = false; DtDate.Enabled = false; txtType.Enabled = false; string str = "SELECT " + " ExMst.ExPostHead, " + " ExMst.ExVoucherType, " + " ExMst.ExVoucherNo, " + " ExMst.ExVoucherDt, " + " ExMst.ExNo, " + " ExMst.ExId, " + " ExMst.ExDate, " + " ExMst.ExEmpCode, " + " ExMst.ExAmt, " + " ExMst.ExTag, " + " ExMst.ExDatePost, " + " ExMst.ExLoadTag, " + " ExMst.ExEmpCCode, " + " ExMst.ExFedDate, " + " ExMst.ExLoadedDate, " + " empmst.EmpName, " + " actmst.AccName " + " FROM ExMst " + " LEFT OUTER JOIN EmpMST ON ExMst.ExEmpCode = empmst.EmpCode " + " LEFT OUTER JOIN ActMst ON ExMst.ExPostHead = actmst.AccCode " + " WHERE ExId='" + ExId + "';" + string.Empty; //var qr = " SELECT ExMst.ExPostHead, ExMst.ExVoucherType, ExMst.ExVoucherNo, ExMst.ExVoucherDt, ExMst.ExNo, ExMst.ExId, ExMst.ExDate, ExMst.ExEmpCode, ExMst.ExAmt, ExMst.ExTag, ExMst.ExDatePost, "; //qr = qr + " ExMst.ExLoadTag, ExMst.ExEmpCCode, ExMst.ExFedDate, ExMst.ExLoadedDate, empmst.EmpName, EmpEmplrRef.ERMDesc, actmst.AccName "; //qr = qr + " FROM ExMst LEFT OUTER JOIN "; //qr = qr + " empmst ON ExMst.ExEmpCode = empmst.EmpCode LEFT OUTER JOIN "; //qr = qr + " EmpEmplrRef ON ExMst.ExEmpCCode = EmpEmplrRef.ERMCode LEFT OUTER JOIN "; //qr = qr + " actmst ON ExMst.ExPostHead = actmst.AccCode "; //qr = qr + " WHERE ExId='" + ExId + "'"; PrintLogWin.PrintLog(str); var ds = ProjectFunctionsUtils.GetDataSet(str); try { txtAdvanceNo.Text = ds.Tables[0].Rows[0]["ExNo"].ToString(); DtDate.EditValue = Convert.ToDateTime(ds.Tables[0].Rows[0]["ExDate"]); DtDateforMonth.EditValue = Convert.ToDateTime(ds.Tables[0].Rows[0]["ExDatePost"]); txtEmpCode.Text = ds.Tables[0].Rows[0]["ExEmpCode"].ToString(); txtEmpCodeDesc.Text = ds.Tables[0].Rows[0]["EmpName"].ToString(); txtType.Text = ds.Tables[0].Rows[0]["ExTag"].ToString(); txtAmount.Text = ds.Tables[0].Rows[0]["ExAmt"].ToString(); } catch (Exception ex) { PrintLogWin.PrintLog(ex); } //GetBasicDetail(); } }
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(); }