public HttpResponseMessage getAllManpowerCustomer(GetAllCustomer customer) { HttpResponseMessage message; try { // OverAllAttendanceDataAccessLayer dal = new OverAllAttendanceDataAccessLayer(); var dynObj = new { result = _Attentance.GetAllManpowerCustomer(customer) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" }); ErrorLog.CreateErrorMessage(ex, "OverAllAttendance", "getAllManpowerCustomer"); } return(message); }
//public List<GetManpowerList> GetManpowerBySite(GetManpower objManpower) //{ // List<GetManpowerList> manpower = new List<GetManpowerList>(); // using (DbLayer dbLayer = new DbLayer()) // { // SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByManpower"); // SqlCmd.CommandType = CommandType.StoredProcedure; // SqlCmd.Parameters.AddWithValue("@CustomerId", objManpower.CustomerId); // SqlCmd.Parameters.AddWithValue("@BranchId", objManpower.BranchId); // SqlCmd.Parameters.AddWithValue("@SiteId", objManpower.SiteId); // SqlCmd.Parameters.AddWithValue("@ActionBy", objManpower.ActionBy); // manpower = dbLayer.GetEntityList<GetManpowerList>(SqlCmd); // } // return manpower; //} //public List<GetCustomerList> GetAllCustomer(GetAllCustomer objCustomer) //{ // List<GetCustomerList> customer = new List<GetCustomerList>(); // using (DbLayer dbLayer = new DbLayer()) // { // SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByCustomer"); // SqlCmd.CommandType = CommandType.StoredProcedure; // SqlCmd.Parameters.AddWithValue("@ActionBy", objCustomer.ActionBy); // customer = dbLayer.GetEntityList<GetCustomerList>(SqlCmd); // } // return customer; //} //public List<GetBranchList> GetAllBranch(GetAllBranch objBranch) //{ // List<GetBranchList> branch = new List<GetBranchList>(); // using (DbLayer dbLayer = new DbLayer()) // { // SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByCustomer"); // SqlCmd.CommandType = CommandType.StoredProcedure; // SqlCmd.Parameters.AddWithValue("@CustomerId", objBranch.CustomerId); // SqlCmd.Parameters.AddWithValue("@ActionBy", objBranch.ActionBy); // branch = dbLayer.GetEntityList<GetBranchList>(SqlCmd); // } // return branch; //} //public List<GetSiteList> GetAllSite(GetAllSite objBranch) //{ // List<GetSiteList> site = new List<GetSiteList>(); // using (DbLayer dbLayer = new DbLayer()) // { // SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByCustomer"); // SqlCmd.CommandType = CommandType.StoredProcedure; // SqlCmd.Parameters.AddWithValue("@CustomerId", objBranch.CustomerId); // SqlCmd.Parameters.AddWithValue("@BranchId", objBranch.BranchId); // SqlCmd.Parameters.AddWithValue("@ActionBy", objBranch.ActionBy); // site = dbLayer.GetEntityList<GetSiteList>(SqlCmd); // } // return site; //} public GetAllManpowerCustomerList GetAllManpowerCustomer(GetAllCustomer objManpower) { GetAllManpowerCustomerList getAllDetails = new GetAllManpowerCustomerList(); List <GetCustomerList> customer = new List <GetCustomerList>(); List <GetManpowerList> manpower = new List <GetManpowerList>(); using (DbLayer dbLayer = new DbLayer()) { SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByCustomer"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@ActionBy", objManpower.ActionBy); customer = dbLayer.GetEntityList <GetCustomerList>(SqlCmd); getAllDetails.CustomerList = customer; } using (DbLayer dbLayer = new DbLayer()) { SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByManpower"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@ActionBy", objManpower.ActionBy); manpower = dbLayer.GetEntityList <GetManpowerList>(SqlCmd); getAllDetails.ManpowerList = manpower; } return(getAllDetails); }
///<summary> ///查询所有客户及默认地址 ///</summary> ///<returns></returns> public List <CustomerEntity> GetAllCustomer(int nums, int begin, out int total) { List <CustomerEntity> list = new List <CustomerEntity>(); total = 0; try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("whCode=").Append(GlobeSettings.LoginedUser.WarehouseCode).Append("&"); if (begin == 0) { loStr.Append("beginRow=").Append("&"); loStr.Append("rows="); } else { loStr.Append("beginRow=").Append(begin).Append("&"); loStr.Append("rows=").Append(nums); } string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetAllCustomer); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 GetAllCustomer bill = JsonConvert.DeserializeObject <GetAllCustomer>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (GetAllCustomerResult jbr in bill.result) { CustomerEntity asnEntity = new CustomerEntity(); #region 0-10 asnEntity.Address = jbr.address; asnEntity.AreaID = jbr.areaId; asnEntity.AreaName = jbr.arName; asnEntity.CustomerCode = jbr.cCode; asnEntity.CustomerName = jbr.cName; asnEntity.Contact = jbr.contact; asnEntity.Distance = Convert.ToDecimal(jbr.distance); asnEntity.IsActive = jbr.isActive; asnEntity.isOwn = jbr.isOwn; asnEntity.CustomerNameS = jbr.nameS; #endregion #region 11-20 asnEntity.Phone = jbr.phone; asnEntity.PostCode = jbr.postcode; asnEntity.Remark = jbr.remark; asnEntity.RouteCode = jbr.rtCode; asnEntity.RouteName = jbr.rtName; asnEntity.SortOrder = Convert.ToInt32(jbr.sortOrder); asnEntity.UpdateBy = jbr.updateBy; asnEntity.WHCode = jbr.whCode; try { if (!string.IsNullOrEmpty(jbr.updateDate)) { asnEntity.UpdateDate = Convert.ToDateTime(jbr.updateDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("FrmListPickPlan+GetPickPlan", msg); } #endregion list.Add(asnEntity); } total = bill.total; return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }