public bool InsertIP_V3(string IP, string Line_Vung, string IsMayTinh, bool IsActive, int No, string Line_Vung_Gop, bool G5Type, string Extension) { try { int rowAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@IP_Address", SqlDbType.VarChar, 15), new SqlParameter("@Line_Vung", SqlDbType.VarChar, 50), new SqlParameter("@IsMayTinh", SqlDbType.VarChar, 2), new SqlParameter("@IsHoatDong", SqlDbType.VarChar, 1), new SqlParameter("@No", SqlDbType.TinyInt), new SqlParameter("@Line_Vung_Gop", SqlDbType.NVarChar, 50), new SqlParameter("@G5Type", SqlDbType.VarChar, 1), new SqlParameter("@Extension", SqlDbType.VarChar, 10) }; parameters[0].Value = IP; parameters[1].Value = Line_Vung; parameters[2].Value = IsMayTinh; parameters[3].Value = IsActive == true ? "1" : "0"; parameters[4].Value = No; parameters[5].Value = Line_Vung_Gop; parameters[6].Value = G5Type == true ? "1" : "0"; parameters[7].Value = Extension; rowAffected = this.RunProcedure("SP_T_QUANTRICAUHINH_HETHONGMAYTINH_Insert_V4", parameters, rowAffected); return(rowAffected > 0); } catch (Exception e) { LogErrorUtils.WriteLogError("InsertIP_V3: ", e); return(false); } }
/// <summary> /// Update Status Row /// </summary> /// <param name="PK_KhachDatID"></param> /// <returns></returns> public bool KhachDat_UpdateStatus(int PK_KhachDatID, int StatusRow, DateTime UpdateDate, string UpdateBy) { try { int rowAffect = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@PK_KhachDatID", SqlDbType.Int), new SqlParameter("@StatusRow", SqlDbType.Int), new SqlParameter("@UpdateDate", SqlDbType.DateTime), new SqlParameter("@UpdateBy", SqlDbType.VarChar, 20) }; parameters[0].Value = PK_KhachDatID; parameters[1].Value = StatusRow; parameters[2].Value = UpdateDate; parameters[3].Value = UpdateBy; rowAffect = this.RunProcedure("SP_T_KHACHDAT_UPDATE_STATUS", parameters, rowAffect); return(rowAffect > 0); } catch (Exception ex) { LogErrorUtils.WriteLogError("KhachDat_UpdateStatus", ex); return(false); } }
/// <summary> /// Báo cáo Tổng hợp cuốc khách điều hành /// </summary> /// <returns>Danh sách thông tin về cuốc khách điều hành</returns> public static DataTable GetReport(DateTime start, DateTime end, string KieuCuocGoi, string SoDienThoai, string DiaChi, string ID_DTTD, string ID_CS, string Line, string Vung, string NhacMaySau, string XeNhan, string XeDon, TimeSpan TGDamThoai, TimeSpan TGChuyenDam, int KetQua, int CachDieu, int LoaiKH, string Xe, string LenhKhachDat, string MaDoiTac, bool CuocChen = false) { DataTable dtAll = new DataTable(); try { int countLoop = (end - start).TotalDays.To <int>(); for (int i = 1; i <= countLoop + 1; i++) { if (start.AddDays(1) < end) { dtAll.Merge(Inst.ExeStore(spReport, start, start.AddDays(1), KieuCuocGoi, SoDienThoai, DiaChi, ID_DTTD, ID_CS, Line, Vung, NhacMaySau, XeNhan, XeDon, TGDamThoai, TGChuyenDam, KetQua, CachDieu, LoaiKH, Xe, LenhKhachDat, MaDoiTac, CuocChen)); } else { dtAll.Merge(Inst.ExeStore(spReport, start, end, KieuCuocGoi, SoDienThoai, DiaChi, ID_DTTD, ID_CS, Line, Vung, NhacMaySau, XeNhan, XeDon, TGDamThoai, TGChuyenDam, KetQua, CachDieu, LoaiKH, Xe, LenhKhachDat, MaDoiTac, CuocChen)); } start = start.AddDays(1); Thread.Sleep(100); } } catch (Exception ex) { LogErrorUtils.WriteLogError("GetReport " + dtAll.Rows.Count, ex); } return(dtAll); //return Inst.ExeStore(spReport, start, end, KieuCuocGoi, SoDienThoai, DiaChi, ID_DTTD, ID_CS, Line, Vung, NhacMaySau, XeNhan, XeDon, TGDamThoai, TGChuyenDam, KetQua, CachDieu, LoaiKH, Xe, LenhKhachDat, MaDoiTac,CuocChen); }
/// <summary> /// Kiem tra xem User co nguoi dung vi tri da check in khong ? /// true : dang check in /// false : may nay hien khong ai check /// </summary> public bool CheckPositionOfUserAndIPAddress(string Username, string IPAddress) { try { int rowAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@IPAddress", SqlDbType.VarChar, 20), new SqlParameter("@Username", SqlDbType.NVarChar, 50), new SqlParameter("@IsExist", SqlDbType.Int) }; parameters[0].Value = IPAddress; parameters[1].Value = Username; parameters[2].Direction = ParameterDirection.Output; this.RunProcedure("[sp_T_CHECKIN_CHECKOUT_CheckUserIPAddressTrust]", parameters, rowAffected); return(int.Parse(parameters[2].Value.ToString()) > 0); } catch (Exception ex) { LogErrorUtils.WriteLogError("CheckPositionOfUserAndIPAddress: ", ex); return(false); } }
public int DeletePOI(string pID) { try { int pId = pID.To <int>(); return(this.ExeStoreNoneQuery("sp_DeletePOI", pId)); } catch (Exception ex) { LogErrorUtils.WriteLogError("DeletePOI", ex); return(-10); } }
/// <summary> /// Xóa một người dùng /// </summary> public int DeleteUser(string mUserName) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@mUSER_ID", SqlDbType.NVarChar, 50) }; parameters[0].Value = mUserName; try { RunProcedure("sp_SYS_USER_DELETE", parameters); return(0); } catch (Exception ex) { LogErrorUtils.WriteLogError("DeleteUser", ex); return(1); } }
/// <summary> /// Cập nhật thông tin thay đổi của người dùng /// </summary> public int UpdateUser(string mUserName, string mEncPassword, string mFullName, string mStatus, string mLDAPAdsPath, int mSecurityLevel, string mEmail, DateTime mNgaySinh, bool mGioiTinh, string mDiaChi, string mQueQuan, string mDienThoai, int mPhongID, int mChucVuID, int mTrungTamID) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@mUSER_ID", SqlDbType.NVarChar, 50), new SqlParameter("@mPASSWORD", SqlDbType.NVarChar, 4000), new SqlParameter("@mFULLNAME", SqlDbType.NVarChar, 100), new SqlParameter("@mSTATUS", SqlDbType.Char, 1), new SqlParameter("@mLDAP_ADS_PATH", SqlDbType.NVarChar, 4000), new SqlParameter("@mSECURITY_LEVEL", SqlDbType.Int), new SqlParameter("@mEmail", SqlDbType.NVarChar, 100), new SqlParameter("@mNgaySinh", SqlDbType.DateTime), new SqlParameter("@mGioiTinh", SqlDbType.Bit), new SqlParameter("@mDiaChi", SqlDbType.NVarChar, 255), new SqlParameter("@mQueQuan", SqlDbType.NVarChar, 255), new SqlParameter("@mDienThoai", SqlDbType.NVarChar, 20), new SqlParameter("@mPhongID", SqlDbType.Int) }; parameters[0].Value = mUserName; parameters[1].Value = mEncPassword; parameters[2].Value = mFullName; parameters[3].Value = mStatus; parameters[4].Value = mLDAPAdsPath; parameters[5].Value = mSecurityLevel; parameters[6].Value = mEmail; parameters[7].Value = mNgaySinh; parameters[8].Value = mGioiTinh; parameters[9].Value = mDiaChi; parameters[10].Value = mQueQuan; parameters[11].Value = mDienThoai; parameters[12].Value = mPhongID; try { RunProcedure("sp_SYS_USER_UPDATE", parameters); return(0); } catch (Exception ex) { LogErrorUtils.WriteLogError("UpdateUser: ", ex); return(1); } }
public bool Delete(string PhoneNumber) { try { int rowAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@PhoneNumber", SqlDbType.VarChar, 11) }; parameters[0].Value = PhoneNumber; rowAffected = this.RunProcedure("sp_T_DANHBA_CONGTY_Delete", parameters, rowAffected); return(rowAffected > 0); } catch (Exception e) { LogErrorUtils.WriteLogError("Delete: ", e); return(false); } }
/// <summary> /// Check out tất cả các user đã đăng nhập vào máy này /// </summary> public bool CheckOut_AllInIP(object Username, string IPAddress) { try { int rowAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Username", SqlDbType.NVarChar, 50), new SqlParameter("@IPAddress", SqlDbType.VarChar, 20) }; parameters[0].Value = Username; parameters[1].Value = IPAddress; rowAffected = RunProcedure("sp_T_CHECKIN_CHECKOUT_CheckOut_Force", parameters, rowAffected); return(rowAffected > 0); } catch (Exception ex) { LogErrorUtils.WriteLogError("CheckOut_AllInIP: ", ex); return(false); } }
public bool Update(string PhoneNumber, string Name, string Address) { try { int rowAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@PhoneNumber", SqlDbType.VarChar, 11), new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@Address", SqlDbType.NVarChar, 255) }; parameters[0].Value = PhoneNumber; parameters[1].Value = Name; parameters[2].Value = Address; rowAffected = this.RunProcedure("[sp_T_DANHBA_CONGTY_Update]", parameters, rowAffected); return(rowAffected > 0); } catch (Exception e) { LogErrorUtils.WriteLogError("Update: ", e); return(false); } }
public bool Update_V2(string MaDoiTac, string Name, string Address, string Phones, string Fax, string Email, float TiLeHoaHongNoiTinh, float TiLeHoaHongDuongDai, string Notes, bool IsActive, string MaNhanVien, string TenNhanVien, int Vung, DateTime NgayKyKet, DateTime NgayKetThuc, string NguoiSua, string SoNha, string TenDuong, string MaDoiTac_Old, float KinhDo, float ViDo, int LoaiDoiTacID, string VietTat, int fk_Step) { try { int rowAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Ma_DoiTac", SqlDbType.VarChar, 10), new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@Address", SqlDbType.NVarChar, 255), new SqlParameter("@Phones", SqlDbType.VarChar, 255), new SqlParameter("@Fax", SqlDbType.Char, 20), new SqlParameter("@Email", SqlDbType.VarChar, 50), new SqlParameter("@TiLeHoaHongNoiTinh", SqlDbType.Float), new SqlParameter("@TiLeHoaHongNgoaiTinh", SqlDbType.Float), new SqlParameter("@Notes", SqlDbType.NVarChar, 255), new SqlParameter("@IsActive", SqlDbType.Char, 1), new SqlParameter("@FK_MaNhanVien", SqlDbType.NVarChar, 50), new SqlParameter("@TenNhanVien", SqlDbType.NVarChar, 50), new SqlParameter("@Vung", SqlDbType.Int), new SqlParameter("@NgayKyKet", SqlDbType.DateTime), new SqlParameter("@NgayKetThuc", SqlDbType.DateTime), new SqlParameter("@UpdatedBy", SqlDbType.NVarChar, 50), new SqlParameter("@SoNha", SqlDbType.NVarChar, 20), new SqlParameter("@TenDuong", SqlDbType.NVarChar, 50), new SqlParameter("@Ma_DoiTac_Old", SqlDbType.VarChar, 10), new SqlParameter("@KinhDo", SqlDbType.Float), new SqlParameter("@ViDo", SqlDbType.Float), new SqlParameter("@LoaiDoiTacID", SqlDbType.Int), new SqlParameter("@VietTat", SqlDbType.VarChar, 10), new SqlParameter("@FK_Step", SqlDbType.Int) }; parameters[0].Value = MaDoiTac; parameters[1].Value = Name; parameters[2].Value = Address; parameters[3].Value = Phones; parameters[4].Value = Fax; parameters[5].Value = Email; parameters[6].Value = TiLeHoaHongNoiTinh; parameters[7].Value = TiLeHoaHongDuongDai; parameters[8].Value = Notes; parameters[9].Value = IsActive == true ? "1" : "0"; parameters[10].Value = MaNhanVien; parameters[11].Value = TenNhanVien; parameters[12].Value = Vung; parameters[13].Value = NgayKyKet; parameters[14].Value = NgayKetThuc; parameters[15].Value = NguoiSua; parameters[16].Value = SoNha; parameters[17].Value = TenDuong; parameters[18].Value = MaDoiTac_Old; parameters[19].Value = KinhDo; parameters[20].Value = ViDo; parameters[21].Value = LoaiDoiTacID; parameters[22].Value = VietTat; parameters[23].Value = fk_Step; rowAffected = this.RunProcedure("spUpdate_T_DOITAC_V4", parameters, rowAffected); return(rowAffected > 0); } catch (Exception ex) { LogErrorUtils.WriteLogError("Update_V2: ", ex); return(false); } }