internal static bool GhiNhanDieuChinhLuong(int iMaCC, DateTime thang, decimal luong) { int kqThaotac = 0; bool flagError = false; #region query string query = @" UPDATE DieuChinhLuongThangTruoc SET LuongDieuChinh = @LuongDieuChinh WHERE UserEnrollNumber = @UserEnrollNumber and Thang = @Thang and Nam=@Nam IF @@ROWCOUNT=0 INSERT INTO DieuChinhLuongThangTruoc(UserEnrollNumber,Thang,Nam,LuongDieuChinh) VALUES (@UserEnrollNumber,@Thang,@Nam,@LuongDieuChinh) " ; #endregion kqThaotac = SqlDataAccessHelper.ExecNoneQueryString(query , new string[] { "@UserEnrollNumber", "@Thang", "@Nam", "@LuongDieuChinh" } , new object[] { iMaCC, thang.Month, thang.Year, luong }); if (kqThaotac == 0) { flagError = true; } if (flagError == true) { return(false); } return(true); }
public static bool KhaiBaoNgayVangChoNV(int[] DSMaCC_MaNV_Checked, List <DateTime> DSNgayCheck, DataRowView row, int currentUserID) { #region query string query = @" INSERT INTO Absent (UserEnrollNumber, TimeDate, AbsentCode, Thang, Nam, Workingday, WorkingTime, UserID) VALUES (@UserEnrollNumber, @TimeDate, @AbsentCode,@Thang,@Nam,@Workingday,@WorkingTime,@UserID)" ; #endregion int kqThaotac = 0; bool flagError = false; float cong = (float)row["WorkingDay"]; float workingtime = (float)row["WorkingTime"]; for (int i = 0; i < DSMaCC_MaNV_Checked.Length; i++) { int maCC = DSMaCC_MaNV_Checked[i]; foreach (DateTime ngay in DSNgayCheck) { kqThaotac = SqlDataAccessHelper.ExecNoneQueryString(query , new string[] { "@UserEnrollNumber", "@TimeDate", "@AbsentCode", "@Thang", "@Nam", "@Workingday", "@WorkingTime", "@UserID" } , new object[] { maCC, ngay.Date, row["AbsentCode"].ToString(), ngay.Month, ngay.Year, cong, workingtime, currentUserID }); if (kqThaotac == 0) { flagError = true; break; } } if (flagError) { break; } } if (flagError) { return(false); } return(true); }
public static bool XoaGioChoNV(int pUserEnrollNumber, DateTime pGioCu, string pSourceOld, int pMachineNoOld, int pUserID, string pLydo, string pGhichu) { int kq = 0; string query = @" DELETE CheckInOut WHERE UserEnrollNumber = @UserEnrollNumber and TimeStr = @TimeStrOld and (MachineNo % 2 = @MachineNoOld % 2) INSERT INTO LichSuSuaGioVaoRa (UserEnrollNumber , TimeStrOld, TimeStrNew, SourceOld, SourceNew, MachineNoOld, MachineNoNew , UserID, Explain, Note, CommandType, ExecuteTime ) VALUES (@UserEnrollNumber ,@TimeStrOld,@TimeStrOld,@SourceOld,@SourceOld,@MachineNoOld,@MachineNoOld ,@UserID,@Explain,@Note,@CommandType,GetDate() ) "; kq = SqlDataAccessHelper.ExecNoneQueryString(query , new string[] { "@UserEnrollNumber", "@TimeStrOld", "@SourceOld", "@MachineNoOld" , "@UserID", "@Explain", "@Note", "@CommandType" } , new object[] { pUserEnrollNumber, pGioCu, pSourceOld, pMachineNoOld , pUserID, pLydo, pGhichu, -1 }); if (kq == 0) { return(false); } return(true); }
internal static int DuyetLamViecNgayNghi(int id) { string query = " update LamViecNgayNghi set Duyet = 1 where ID = @ID "; int kq = SqlDataAccessHelper.ExecNoneQueryString(query, new[] { "@ID" }, new object[] { id }); return(kq); }
public static bool ThemGioChoNV(int pUserEnrollNumber, DateTime pGioMoi, bool pKieuGioMoi, int pMachineNoNew, int pUserID, string pLydo, string pGhichu) { int kq = 0; string OriginTypeNew = (pKieuGioMoi) ? "I" : "O"; string query = @" INSERT INTO CheckInOut (UserEnrollNumber, TimeStr, TimeDate, Source, MachineNo, OriginType, WorkCode) VALUES (@UserEnrollNumber, @TimeStrNew, @TimeDateNew, @SourceNew, @MachineNoNew, @OriginTypeNew, 0) INSERT INTO LichSuSuaGioVaoRa (UserEnrollNumber , TimeStrOld, TimeStrNew, SourceOld, SourceNew, MachineNoOld, MachineNoNew , UserID, Explain, Note, CommandType, ExecuteTime ) VALUES (@UserEnrollNumber ,@TimeStrNew,@TimeStrNew,@SourceNew,@SourceNew,@MachineNoNew,@MachineNoNew ,@UserID,@Explain,@Note,@CommandType,GetDate() ) "; kq = SqlDataAccessHelper.ExecNoneQueryString(query , new string[] { "@UserEnrollNumber", "@TimeStrNew", "@TimeDateNew", "@SourceNew", "@MachineNoNew", "@OriginTypeNew" , "@UserID", "@Explain", "@Note", "@CommandType" } , new object[] { pUserEnrollNumber, pGioMoi, pGioMoi.Date, "PC", pMachineNoNew, OriginTypeNew , pUserID, pLydo, pGhichu, 1 }); if (kq == 0) { return(false); } return(true); }
public static bool KhaiBaoLVNgayNghiChoNV(int[] arrDSNVCheck, DateTime NgayKhaiBao, float PCThem, float PCDem, int currentUserID) { string query = @" INSERT INTO LamViecNgayNghi (UserEnrollNumber, Ngay, PCThem, PCDem, UserID, Duyet) VALUES (@UserEnrollNumber, @Ngay, @PCThem, @PCDem,@UserID, 0 )" ;// mặc định số 0 là khai báo thì chưa được duyệt, chờ được duyệt for (int i = 0; i < arrDSNVCheck.Length; i++) { int UserEnrollNumber = arrDSNVCheck[i]; int kqThuchien = SqlDataAccessHelper.ExecNoneQueryString(query, new string[] { "@UserEnrollNumber", "@Ngay", "@PCThem", "@PCDem", "@UserID" }, new object[] { UserEnrollNumber, NgayKhaiBao, PCThem, PCDem, currentUserID }); if (kqThuchien == 0) { return(false); } } return(true); }
internal static bool CapNhatHeSoLuong(int iMaCC, Single hslCB, Single hslSP, Single hsBHcongthem) { int kqThaotac = 0; bool flagError = false; #region query string query = @" UPDATE UserInfo SET HeSoLuongCB = @HeSoLuongCB, HeSoLuongSP = @HeSoLuongSP, HSBHCongThem=@HSBHCongThem WHERE UserEnrollNumber = @UserEnrollNumber" ; #endregion kqThaotac = SqlDataAccessHelper.ExecNoneQueryString(query , new string[] { "@UserEnrollNumber", "@HeSoLuongCB", "@HeSoLuongSP", "@HSBHCongThem" } , new object[] { iMaCC, hslCB, hslSP, hsBHcongthem }); if (kqThaotac == 0) { flagError = true; } if (flagError == true) { return(false); } return(true); }
public static bool XoaNgayVangNV(DataRow[] arrRecord) { int kqThaotac = 0; bool flagError = false; string query = @"DELETE FROM Absent WHERE ID = @ID"; foreach (DataRow row in arrRecord) { int ID = (int)row["ID"]; kqThaotac = SqlDataAccessHelper.ExecNoneQueryString(query, new string[] { "@ID" }, new object[] { ID }); if (kqThaotac == 0) { flagError = true; break; } } if (flagError == true) { return(false); } return(true); }
public static bool XoaLamViecNgayNghiDaKhaiBao(DataRow[] arrRecord) { int kqThaotac = 0; bool flagError = false; string query = @" DELETE FROM LamViecNgayNghi WHERE ID = @ID"; //duyet qua cac record, neu ngay nao da foreach (DataRow row in arrRecord) { int ID = (int)row["ID"]; kqThaotac = SqlDataAccessHelper.ExecNoneQueryString(query, new string[] { "@ID" }, new object[] { ID }); if (kqThaotac == 0) { flagError = true; break; } } if (flagError == true) { return(false); } return(true); }
public static int XacNhanGio(int iUserEnrollNumber, int ShiftID, string ShiftCode , string onnduty, string offduty, int lategrace, int earlygrace, int afterot, int daycount , float wktime, float wkdayy, int sophutOT, bool tinhPC150 , DateTime timestrInn, DateTime timestrOut, string SourceInn, string SourceOut, int MachineNoInn, int MachineNoOut) { #region query string query = @" declare @ID int ; INSERT INTO XacNhanCaVaLamThem ( UserEnrollNumber, ShiftID, ShiftCode, Onduty, Offduty, LateGrace, EarlyGrace, AfterOT, DayCount, WorkingTime, Workingday, TimeStrIn, TimeStrOut, OTMin, TinhPC150, Note ) VALUES ( @UserEnrollNumber, @ShiftID, @ShiftCode, @Onduty, @Offduty, @LateGrace, @EarlyGrace, @AfterOT, @DayCount, @WorkingTime, @Workingday, @TimeStrIn, @TimeStrOut, @OTMin, @TinhPC150, @Note ) select @ID = @@Identity UPDATE CheckInOut SET IDXacNhanCaVaLamThem = @ID WHERE UserEnrollNumber = @UserEnrollNumber AND (MachineNo % 2 = @MachineNoIn % 2) AND (TimeStr between @TimeStrIn and @TimeStrInn30) UPDATE CheckInOut SET IDXacNhanCaVaLamThem = @ID WHERE UserEnrollNumber = @UserEnrollNumber AND (MachineNo % 2 = @MachineNoOut%2) AND (TimeStr between @TimeStrOut and @TimeStrOut30) INSERT INTO LichSuSuaGioVaoRa ( UserEnrollNumber, TimeStrOld, TimeStrNew, SourceOld, SourceNew, MachineNoOld, MachineNoNew, UserID, Explain, Note, ExecuteTime, CommandType ) VALUES ( @UserEnrollNumber, @TimeStrIn, @TimeStrIn, @SourceInn, N'PC', @MachineNoIn,21, @UserID, @Explain, @Note, GetDate(), 1) INSERT INTO LichSuSuaGioVaoRa ( UserEnrollNumber, TimeStrOld, TimeStrNew, SourceOld, SourceNew, MachineNoOld, MachineNoNew, UserID, Explain, Note, ExecuteTime, CommandType ) VALUES ( @UserEnrollNumber, @TimeStrOut, @TimeStrOut, @SourceOut, N'PC', @MachineNoOut,22, @UserID, @Explain, @Note, GetDate(), 1) " ; #endregion DateTime TimeStrInn30 = timestrInn.Add(ThamSo._30phut); DateTime TimeStrOut30 = timestrOut.Add(ThamSo._30phut); return(SqlDataAccessHelper.ExecNoneQueryString(query , new string[] { "@UserEnrollNumber", "@ShiftID", "@ShiftCode", "@Onduty", "@Offduty", "@LateGrace", "@EarlyGrace", "@AfterOT", "@DayCount", "@WorkingTime", "@Workingday", "@OTMin", "@TinhPC150", "@TimeStrIn", "@TimeStrOut", "@TimeStrInn30", "@TimeStrOut30", "SourceInn", "SourceOut", "@MachineNoIn", "@MachineNoOut", "@Note", "@Explain", "@UserID" } , new object[] { iUserEnrollNumber, ShiftID, ShiftCode, onnduty, offduty, lategrace, earlygrace, afterot, daycount, wktime, wkdayy, sophutOT, tinhPC150, timestrInn, timestrOut, TimeStrInn30, TimeStrOut30, SourceInn, SourceOut, MachineNoInn, MachineNoOut, "Xác nhận giờ chấm công", "", ThamSo.currUserID })); }
public static int ThemChamCongTay(int iUserEnrollNumber, DateTime timeBD, DateTime timeKT, int ShiftID, string ShiftCode, string onnduty, string offduty, int lategrace, int earlygrace, int afterot, int daycount, float wktime, float wkdayy, int sophutOT, bool tinhPC150, string lydo, string ghichu) { #region query string query = @" declare @ID int ; INSERT INTO XacNhanCaVaLamThem ( UserEnrollNumber, ShiftID, ShiftCode, Onduty, Offduty, LateGrace, EarlyGrace, AfterOT, DayCount, WorkingTime, Workingday, TimeStrIn, TimeStrOut, OTMin, TinhPC150, Note ) VALUES ( @UserEnrollNumber, @ShiftID, @ShiftCode, @Onduty, @Offduty, @LateGrace, @EarlyGrace, @AfterOT, @DayCount, @WorkingTime, @Workingday, @TimeStrIn, @TimeStrOut, @OTMin, @TinhPC150, N'Chấm công tay' ) select @ID = @@Identity INSERT INTO CheckInOut ( UserEnrollNumber, TimeDate, TimeStr, OriginType, Source, MachineNo, WorkCode, IDXacNhanCaVaLamThem ) VALUES ( @UserEnrollNumber, @TimeDateIn, @TimeStrIn, N'I', N'PC', 21, 0, @ID) INSERT INTO CheckInOut ( UserEnrollNumber, TimeDate, TimeStr, OriginType, Source, MachineNo, WorkCode, IDXacNhanCaVaLamThem ) VALUES ( @UserEnrollNumber, @TimeDateOut, @TimeStrOut, N'O', N'PC', 22, 0, @ID) INSERT INTO LichSuSuaGioVaoRa ( UserEnrollNumber, TimeStrOld, TimeStrNew, SourceOld, SourceNew, MachineNoOld, MachineNoNew, UserID, Explain, Note, ExecuteTime, CommandType ) VALUES ( @UserEnrollNumber, @TimeStrIn, @TimeStrIn, N'PC', N'PC', 21,21, @UserID, @Explain, @Note, GetDate(), 1) INSERT INTO LichSuSuaGioVaoRa ( UserEnrollNumber, TimeStrOld, TimeStrNew, SourceOld, SourceNew, MachineNoOld, MachineNoNew, UserID, Explain, Note, ExecuteTime, CommandType ) VALUES ( @UserEnrollNumber, @TimeStrOut, @TimeStrOut, N'PC', N'PC', 22,22, @UserID, @Explain, @Note, GetDate(), 1) " ; #endregion return(SqlDataAccessHelper.ExecNoneQueryString(query , new string[] { "@UserEnrollNumber", "@ShiftID", "@ShiftCode", "@Onduty", "@Offduty", "@LateGrace", "@EarlyGrace", "@AfterOT", "@DayCount", "@WorkingTime", "@Workingday", "@OTMin", "@TinhPC150", "@TimeStrIn", "@TimeStrOut", "@TimeDateIn", "@TimeDateOut", "@Note", "@Explain", "@UserID" } , new object[] { iUserEnrollNumber, ShiftID, ShiftCode, onnduty, offduty, lategrace, earlygrace, afterot, daycount, wktime, wkdayy, sophutOT, tinhPC150, timeBD, timeKT, timeBD.Date, timeKT.Date, ghichu, lydo, ThamSo.currUserID })); }