public static string GetNextMaDoiTac_V3(string MaMG_Group) { try { string strMaxKey = new Data.DM.DoiTac().GetNextMaDoiTac_v3(MaMG_Group); if (strMaxKey.Length >= 6) { string sID = strMaxKey.Substring(3, strMaxKey.Length - 3); long ID = long.Parse(sID); ID += 1; string sID_Temp = ID.ToString(); while (sID_Temp.Length < sID.Length) { sID_Temp = "0" + sID_Temp; } return(MaMG_Group + sID_Temp); } else { return(MaMG_Group + "0001"); // ma dau tien } } catch (Exception ex) { return(string.Empty); } }
public static List <DoiTac> GetDoiTacs(string strSQL) { try { List <DoiTac> lstDoiTac = new List <DoiTac>(); DataTable dt = new DataTable(); dt = new Data.DM.DoiTac().GetDoiTacs(strSQL); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { lstDoiTac.Add(DoiTac.GetDoiTacByRow(dr)); } } dt.Dispose(); dt = null; return(lstDoiTac); } catch (Exception ex) { LogError.WriteLogError("GetDoiTacs: ", ex); return(new List <DoiTac>()); } }
/// <summary> /// Ma doi tac bang rong thi se xoa toan bo T_DOITAC /// </summary> /// <returns></returns> //public bool DeleteAllDoiTac() //{ // return new Data.DM.DoiTac().Delete(string.Empty); //} /// <summary> /// Sinh ma doi tac, neuchua co thi gan la ID0001 /// Neu co roi thi lay max + 1 /// </summary> /// <returns>Ma tiep theo</returns> public static string GetNextMaDoiTac(int CongTyID) { try { string prefixCongTyID = ""; if (CongTyID == 1) { prefixCongTyID = "A"; // HN } else if (CongTyID == 2) { prefixCongTyID = "B"; // CP } else if (CongTyID == 3) { prefixCongTyID = "C"; //Tou } else if (CongTyID == 4) { prefixCongTyID = "D"; } else if (CongTyID == 5) { prefixCongTyID = "E"; } string strMaxKey = new Data.DM.DoiTac().GetNextMaDoiTac(CongTyID); // 'D00001' string strNextKey = string.Empty; if (strMaxKey.Length >= 6) { string sID = strMaxKey.Substring(1, 5); long ID = long.Parse(sID); ID += 1; sID = ID.ToString(); while (sID.ToString().Length < 5) { sID = "0" + sID; } return(prefixCongTyID + sID); } else { return(prefixCongTyID + "00001"); // ma dau tien } } catch (Exception ex) { return(string.Empty); } }
public DoiTac GetDoiTacByMaDoiTac(string MaDoiTac) { DoiTac objDoiTac = new DoiTac(); DataTable dt = new DataTable(); dt = new Data.DM.DoiTac().GetCacDoiTacs(MaDoiTac); if (dt.Rows.Count == 1) { objDoiTac = DoiTac.GetDoiTacByRow(dt.Rows[0]); } return(objDoiTac); }
/// <summary> /// Tra ve thong tin cua doi tac du vao so dien thoai /// </summary> /// <param name="PhoneNumber">So dien thoai</param> /// <returns>Du lieu doi tac</returns> public static DoiTac GetDoiTacByOPhoneNumber(string PhoneNumber) { DoiTac objDoiTac = null; DataTable dt = new DataTable(); dt = new Data.DM.DoiTac().GetDoiTacByOPhoneNumber(PhoneNumber); if (dt.Rows.Count >= 1) { objDoiTac = DoiTac.GetDoiTacByRow(dt.Rows[0]); } dt.Dispose(); return(objDoiTac); }
public static DoiTac GetDoiTacByOPhoneNumber_KhacMaMoiGioi(string MaMoiGioi, string PhoneNumber) { DoiTac objDoiTac = new DoiTac(); DataTable dt = new DataTable(); dt = new Data.DM.DoiTac().GetDoiTacByOPhoneNumber_KhongCungMa(MaMoiGioi, PhoneNumber); if (dt.Rows.Count >= 1) { objDoiTac = DoiTac.GetDoiTacByRow(dt.Rows[0]); } dt.Dispose(); dt = null; return(objDoiTac); }
public List <DoiTac> GetListOfDoiTacs_ByNhanVien(string MaNhanVien) { List <DoiTac> lstDoiTac = new List <DoiTac>(); DataTable dt = new DataTable(); dt = new Data.DM.DoiTac().GetListOfDoiTacs_ByNhanVien(MaNhanVien);// lay ta ca if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { lstDoiTac.Add(DoiTac.GetDoiTacByRow(dr)); } } return(lstDoiTac); }
public List <DoiTac> GetListOfDoiTacs() { List <DoiTac> lstDoiTac = new List <DoiTac>(); try { DataTable dt = new DataTable(); dt = new Data.DM.DoiTac().GetCacDoiTacs(string.Empty);// lay tat ca if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { lstDoiTac.Add(GetDoiTacByRow(dr)); } } } catch (Exception ex) { LogError.WriteLogError("GetListOfDoiTacs: ", ex); } return(lstDoiTac); }
public List <DoiTac> GetCacDoiTacs_LastUpdate(DateTime LastUpdate) { try { List <DoiTac> lstDoiTac = new List <DoiTac>(); var dt = new DataTable(); dt = new Data.DM.DoiTac().GetCacDoiTacs_LastUpdate(LastUpdate);// lay ta ca if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { lstDoiTac.Add(DoiTac.GetDoiTacByRow(dr)); } } return(lstDoiTac); } catch (Exception ex) { LogError.WriteLogError("GetCacDoiTacs_LastUpdate: ", ex); return(new List <DoiTac>()); } }
public List <DoiTac> GetListOfDoiTacs(bool isActive) { try { List <DoiTac> lstDoiTac = new List <DoiTac>(); DataTable dt = new DataTable(); dt = new Data.DM.DoiTac().GetDSDoiTacs(isActive);// lay ta ca if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { lstDoiTac.Add(DoiTac.GetDoiTacByRow(dr)); } } return(lstDoiTac); } catch (Exception ex) { LogError.WriteLogError("GetListOfDoiTacs: ", ex); return(new List <DoiTac>()); } }