public UnifyApiResult Add(TechnicianModel model) { if (model == null) { return(UnifyApiResult.Error("参数不能为空。")); } if (string.IsNullOrEmpty(model.Name)) { return(UnifyApiResult.Error("姓名不能为空。")); } if (string.IsNullOrEmpty(model.Phone)) { return(UnifyApiResult.Error("手机不能为空。")); } TechnicianDAL dal = new TechnicianDAL(); if (dal.GetData(model.Name) != null) { return(UnifyApiResult.Error("姓名不允许重复。")); } dynamic result = dal.Insert(model); return(UnifyApiResult.Sucess(result)); }
public UnifyApiResult FindPageList(string name, int currentPageIndex, int pageSize) { TechnicianDAL dal = new TechnicianDAL(); IEnumerable <dynamic> result = dal.FindPageList(name, currentPageIndex, pageSize, out var total); var enumerable = result as dynamic[] ?? result.ToArray(); return(UnifyApiResult.PageResult(enumerable, total)); }
public UnifyApiResult Remove(string code) { if (string.IsNullOrEmpty(code)) { return(UnifyApiResult.Error("参数不能为空。")); } TechnicianDAL dal = new TechnicianDAL(); dynamic result = dal.Remove(code); return(UnifyApiResult.Sucess(result)); }
public DataTable GetTechnicianNames() { TechnicianDAL techDAL = new TechnicianDAL(); DataTable dtAllTechnicianNames = new DataTable(); dtAllTechnicianNames = techDAL.RetreiveTechnicianNames(); return(dtAllTechnicianNames); //InvoicesDAL invDal = new InvoicesDAL();//this would work as well //return invDal.RetreiveAllInvoiceDates(); }
public Technician GetTechnicanDetails(int techID) { TechnicianDAL techDAL = new TechnicianDAL(); DataTable dtTechDetails = new DataTable(); dtTechDetails = techDAL.RetrieveTechnicianDetails(techID); Technician aTechnician = new Technician(); foreach (DataRow dr in dtTechDetails.Rows) { aTechnician.TechEmail = dr["Email"].ToString(); aTechnician.TechPhone = dr["Phone"].ToString(); } return(aTechnician); }
public UnifyApiResult Edit(TechnicianModel model) { if (model == null) { return(UnifyApiResult.Error("参数不能为空。")); } if (!string.IsNullOrEmpty(model.Name)) { return(UnifyApiResult.Error("姓名不能为空。")); } if (string.IsNullOrEmpty(model.Phone)) { return(UnifyApiResult.Error("手机不能为空。")); } TechnicianDAL dal = new TechnicianDAL(); dynamic result = dal.Modify(model); return(UnifyApiResult.Sucess(result)); }
public Technician GetTechnicianDetails(int techID) { /*this does not need a loop because the code is run every time the user changes the selection * in the text box. * * this method is passed a DataTable which should only contain the phone number and email * of a single technician. * * The method must return a Technician object*/ //instantiate the class TechnicianDAL techDAL = new TechnicianDAL(); //instantiate the entity class that the data table values will be passed to Technician aTechnician = new Technician(); //instantiate the DataTable that will recieve the DataTable from RetrieveTechnicianDetails DataTable dtATechnician = new DataTable(); dtATechnician = techDAL.RetrieveTechnicianDetails(techID); aTechnician.TechEmail = dtATechnician.Rows[0]["Email"].ToString(); aTechnician.TechPhone = dtATechnician.Rows[0]["Phone"].ToString(); //foreach (DataRow dr in dtATechnician.Rows)//can i write this not as a loop??? //{ // aTechnician.TechEmail = dr["Email"].ToString(); // aTechnician.TechPhone = dr["Phone"].ToString(); //} return(aTechnician); }
public DataTable GetTechnicianNames() { TechnicianDAL techDAL = new TechnicianDAL(); return(techDAL.RetrieveTechnicianNames()); }