public ActionResult GetPageCount(int pageSize, string checkStockID, string goodsID, string sysQty, string qty, string profitLoss) { return(Json(checkStockDetailOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(checkStockID)) { ICriterion criterion = Restrictions.Eq("CheckStockID", PojoUtil.InitPojo <CheckStock>(checkStockID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsID)) { ICriterion criterion = Restrictions.Eq("GoodsID", PojoUtil.InitPojo <GoodsInfo>(goodsID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(sysQty)) { ICriterion criterion = Restrictions.Like("SysQty", sysQty, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(qty)) { ICriterion criterion = Restrictions.Like("Qty", qty, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(profitLoss)) { ICriterion criterion = Restrictions.Like("ProfitLoss", profitLoss, MatchMode.Anywhere); criteria.Add(criterion); } } , pageSize))); }
public ActionResult Get(int pageSize, int pageNum, string roleFlag, string roleId, string modId) { return(Json(empModOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(roleFlag)) { ICriterion criterion = Restrictions.Eq("RoleFlag", roleFlag); criteria.Add(criterion); } if (!string.IsNullOrEmpty(roleId)) { ICriterion criterion = Restrictions.Eq("RoleId", new Guid(roleId)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(modId)) { ICriterion criterion = Restrictions.Eq("Mod", PojoUtil.InitPojo <Mod>(modId)); criteria.Add(criterion); } //创建对象属性别名 criteria.CreateAlias("Mod", "m"); criteria.AddOrder(Order.Asc("m.Name")); } , pageSize, pageNum))); }
public ActionResult GetPageCount(int pageSize, string goodsCode, string goodsName, string barCode, string goodsTypeID, string modelNum) { return(Json(goodsInfoOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(goodsCode)) { ICriterion criterion = Restrictions.Like("GoodsCode", goodsCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsName)) { ICriterion criterion = Restrictions.Like("GoodsName", goodsName, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(barCode)) { ICriterion criterion = Restrictions.Like("BarCode", barCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsTypeID)) { ICriterion criterion = Restrictions.Eq("GoodsType", PojoUtil.InitPojo <GoodsType>(goodsTypeID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(modelNum)) { ICriterion criterion = Restrictions.Like("ModelNum", modelNum, MatchMode.Anywhere); criteria.Add(criterion); } } , pageSize))); }
public ActionResult GetPageCount(int pageSize, string retOrderID, string goodsID, string price, string qty) { return(Json(retOrderDetailOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(retOrderID)) { ICriterion criterion = Restrictions.Eq("RetOrderID", PojoUtil.InitPojo <RetOrder>(retOrderID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsID)) { ICriterion criterion = Restrictions.Eq("GoodsID", PojoUtil.InitPojo <GoodsInfo>(goodsID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(price)) { ICriterion criterion = Restrictions.Like("Price", price, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(qty)) { ICriterion criterion = Restrictions.Like("Qty", qty, MatchMode.Anywhere); criteria.Add(criterion); } } , pageSize))); }
/// <summary> /// 添加客户的地址 /// </summary> /// <param name="cstmrAddr"></param> /// <returns></returns> public ActionResult Add(CustomerAddr cstmrAddr) { CustomerAddr retVal = null; ISession s = null; ITransaction trans = null; try { s = HibernateOper.GetCurrentSession(); trans = s.BeginTransaction(); //查找客户ID if (cstmrAddr.AddrCode != null && !cstmrAddr.AddrCode.Equals("")) { cstmrAddr.Addr = PojoUtil.GetAddrForCode(s, cstmrAddr.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(cstmrAddr.Addr + cstmrAddr.Location); if (loc != null) { cstmrAddr.Lat = loc.lat; cstmrAddr.Lng = loc.lng; } } string openId = cstmrAddr.Cstmr.OpenId; cstmrAddr.Cstmr = PojoUtil.GetCust(s, openId); if (cstmrAddr.Cstmr == null) { if (openId == null || openId.Equals("")) { //客户不存在 throw new Exceptions.CstmrIsNotExistsException(); } Customer cstmr = new Customer(); cstmr.OpenId = openId; s.Save(cstmr); cstmrAddr.Cstmr = cstmr; } s.Save(cstmrAddr); trans.Commit(); retVal = cstmrAddr; } catch (Exception e) { if (trans != null) { trans.Rollback(); } throw e; } return(Json(retVal)); }
public ActionResult GetCustomerScore(int pageSize, int pageNum, string workId) { return(Json(customerScoreOper.Get( delegate(object sender, ICriteria criteria) { ICriterion criterion = Restrictions.Eq("Work", PojoUtil.InitPojo <Work>(workId)); criteria.Add(criterion); criteria.AddOrder(Order.Desc("ModDate")); } , pageSize, pageNum))); }
public ActionResult Update(Garden garden) { //根据地址码获取地址 garden.Addr = PojoUtil.GetAddrForCode(HibernateOper, garden.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(garden.Addr + garden.Location); if (loc != null) { garden.Lat = loc.lat; garden.Lng = loc.lng; } return(Json(gardenOper.Update(garden))); }
public ActionResult Update(Company company) { //根据地址码获取地址 company.Addr = PojoUtil.GetAddrForCode(HibernateOper, company.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(company.Addr + company.Location); if (loc != null) { company.Lat = loc.lat; company.Lng = loc.lng; } return(Json(companyOper.Update(company))); }
public ActionResult GetWorkDetail(int pageSize, int pageNum, string workSubId) { return(Json(workDetailOper.Get( delegate(object sender, ICriteria criteria) { ICriterion criterion = Restrictions.Eq("WorkSub", PojoUtil.InitPojo <WorkSub>(workSubId)); criteria.Add(criterion); criteria.AddOrder(Order.Desc("ModDate")); } , pageSize, pageNum))); }
public ActionResult Get(int pageSize, int pageNum, string retOrderCode, string vendorID, string storeHouseID, string retMember, string approvalID, string approvalTime, string state, string totalMoney) { return(Json(retOrderOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(retOrderCode)) { ICriterion criterion = Restrictions.Like("RetOrderCode", retOrderCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(vendorID)) { ICriterion criterion = Restrictions.Eq("VendorID", PojoUtil.InitPojo <VendorInfo>(vendorID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(storeHouseID)) { ICriterion criterion = Restrictions.Eq("StoreHouseID", PojoUtil.InitPojo <Storehouse>(storeHouseID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(retMember)) { ICriterion criterion = Restrictions.Like("RetMember", retMember, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(approvalID)) { ICriterion criterion = Restrictions.Eq("ApprovalID", PojoUtil.InitPojo <Employee>(approvalID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(approvalTime)) { ICriterion criterion = Restrictions.Like("ApprovalTime", approvalTime, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(state)) { ICriterion criterion = Restrictions.Like("State", state, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(totalMoney)) { ICriterion criterion = Restrictions.Like("TotalMoney", totalMoney, MatchMode.Anywhere); criteria.Add(criterion); } criteria.AddOrder(Order.Asc("RetOrderCode")); } , pageSize, pageNum))); }
public ActionResult Get(int pageSize, int pageNum, string reqOrderCode, string srcHouseID, string destHouseID, string carrier, string approvalID, string oPerTime, string approvalTime, string state) { return(Json(reqOrderOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(reqOrderCode)) { ICriterion criterion = Restrictions.Like("ReqOrderCode", reqOrderCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(srcHouseID)) { ICriterion criterion = Restrictions.Eq("SrcHouseID", PojoUtil.InitPojo <Storehouse>(srcHouseID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(destHouseID)) { ICriterion criterion = Restrictions.Eq("DestHouseID", PojoUtil.InitPojo <Storehouse>(destHouseID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(carrier)) { ICriterion criterion = Restrictions.Like("Carrier", carrier, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(approvalID)) { ICriterion criterion = Restrictions.Eq("ApprovalID", PojoUtil.InitPojo <Employee>(approvalID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(oPerTime)) { ICriterion criterion = Restrictions.Like("OPerTime", oPerTime, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(approvalTime)) { ICriterion criterion = Restrictions.Like("ApprovalTime", approvalTime, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(state)) { ICriterion criterion = Restrictions.Like("State", state, MatchMode.Anywhere); criteria.Add(criterion); } criteria.AddOrder(Order.Asc("ReqOrderCode")); } , pageSize, pageNum))); }
public ActionResult GetPageCount(int pageSize, string rentOrderCode, string storeHouseID, string borrID, string borrDeptID, string oPerTime, string approvalID, string approvalTime, string state) { return(Json(rentOrderOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(rentOrderCode)) { ICriterion criterion = Restrictions.Like("RentOrderCode", rentOrderCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(storeHouseID)) { ICriterion criterion = Restrictions.Eq("StoreHouseID", PojoUtil.InitPojo <Storehouse>(storeHouseID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(borrID)) { ICriterion criterion = Restrictions.Eq("BorrID", PojoUtil.InitPojo <Employee>(borrID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(borrDeptID)) { ICriterion criterion = Restrictions.Eq("BorrDeptID", PojoUtil.InitPojo <Department>(borrID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(oPerTime)) { ICriterion criterion = Restrictions.Like("OPerTime", oPerTime, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(approvalID)) { ICriterion criterion = Restrictions.Eq("ApprovalID", PojoUtil.InitPojo <Employee>(approvalID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(approvalTime)) { ICriterion criterion = Restrictions.Like("ApprovalTime", approvalTime, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(state)) { ICriterion criterion = Restrictions.Like("State", state, MatchMode.Anywhere); criteria.Add(criterion); } } , pageSize))); }
public ActionResult GetPageCount(int pageSize, string storehouseId, string goodsId) { return(Json(stockInitOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(storehouseId)) { ICriterion criterion = Restrictions.Eq("Storehouse", PojoUtil.InitPojo <Storehouse>(storehouseId)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsId)) { ICriterion criterion = Restrictions.Eq("Goods", PojoUtil.InitPojo <GoodsInfo>(goodsId)); criteria.Add(criterion); } } , pageSize))); }
public ActionResult Update(Storehouse storehouse) { //根据地址码获取地址 storehouse.Addr = PojoUtil.GetAddrForCode(HibernateOper, storehouse.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(storehouse.Addr + storehouse.Location); if (loc != null) { storehouse.Lat = loc.lat; storehouse.Lng = loc.lng; } return(Json(storehouseOper.Update(storehouse, delegate(object sender, ISession session) { //判断是否存在库存Code IsExistsCode(session, storehouse); } ))); }
public ActionResult Update(Employee employee) { //根据地址码获取地址 employee.Addr = PojoUtil.GetAddrForCode(HibernateOper, employee.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(employee.Addr + employee.Location); if (loc != null) { employee.Lat = loc.lat; employee.Lng = loc.lng; } return(Json(employeeOper.Update(employee, delegate(object sender, ISession session) { //判断是否存在部门Code IsExistsCode(session, employee); } ))); }
public ActionResult Get(int pageSize, int pageNum, string storehouseID, string goodsID) { return(Json(sellPriceInfoOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(storehouseID)) { ICriterion criterion = Restrictions.Eq("Storehouse", PojoUtil.InitPojo <Storehouse>(storehouseID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsID)) { ICriterion criterion = Restrictions.Eq("Goods", PojoUtil.InitPojo <GoodsInfo>(goodsID)); criteria.Add(criterion); } } , pageSize, pageNum))); }
public ActionResult Update(Department department) { //根据地址码获取地址 department.Addr = PojoUtil.GetAddrForCode(HibernateOper, department.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(department.Addr + department.Location); if (loc != null) { department.Lat = loc.lat; department.Lng = loc.lng; } return(Json(departmentOper.Update(department, delegate(object sender, ISession session) { //判断是否存在部门Code IsExistsCode(session, department); } ))); }
public ActionResult Update(VendorInfo vendorInfo) { //根据地址码获取地址 vendorInfo.Addr = PojoUtil.GetAddrForCode(HibernateOper, vendorInfo.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(vendorInfo.Addr + vendorInfo.Location); if (loc != null) { vendorInfo.Lat = loc.lat; vendorInfo.Lng = loc.lng; } return(Json(vendorInfoOper.Update(vendorInfo, delegate(object sender, ISession session) { //判断是否存在部门Code IsExistsCode(session, vendorInfo); } ))); }
public ActionResult GetPageCount(int pageSize, string purOrderCode, string vendorID, string storeHouseID, string buyer, string approvalTime, string state, string totalMoney) { return(Json(purOrderOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(purOrderCode)) { ICriterion criterion = Restrictions.Like("PurOrderCode", purOrderCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(vendorID)) { ICriterion criterion = Restrictions.Eq("VendorID", PojoUtil.InitPojo <VendorInfo>(vendorID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(storeHouseID)) { ICriterion criterion = Restrictions.Eq("StoreHouseID", PojoUtil.InitPojo <Storehouse>(storeHouseID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(buyer)) { ICriterion criterion = Restrictions.Like("Buyer", buyer, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(approvalTime)) { ICriterion criterion = Restrictions.Like("ApprovalTime", approvalTime, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(state)) { ICriterion criterion = Restrictions.Like("State", state, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(totalMoney)) { ICriterion criterion = Restrictions.Like("TotalMoney", approvalTime, MatchMode.Anywhere); criteria.Add(criterion); } } , pageSize))); }
/// <summary> /// 客户的地址 /// </summary> /// <returns></returns> public ActionResult Get(Customer cstmr) { IList <CustomerAddr> retVal = null; ISession s = null; ITransaction trans = null; try { s = HibernateOper.GetCurrentSession(); trans = s.BeginTransaction(); //查找客户ID string openId = cstmr.OpenId; cstmr = PojoUtil.GetCust(s, openId); if (cstmr == null) { //客户不存在 throw new Exceptions.CstmrIsNotExistsException(); } else { //查找客户的所有地址 ICriteria criteria = s.CreateCriteria(typeof(CustomerAddr)); criteria.Add(Restrictions.Eq("Cstmr", cstmr)); retVal = criteria.List <CustomerAddr>(); } trans.Commit(); } catch (Exception e) { if (trans != null) { trans.Rollback(); } throw e; } return(Json(retVal)); }
public ActionResult Get(int pageSize, int pageNum, string sellOrderID, string goodsID, string qty, string sellPrice, string realSellPrice, string totalMoney) { return(Json(sellOrderDetailOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(sellOrderID)) { ICriterion criterion = Restrictions.Eq("SellOrderID", PojoUtil.InitPojo <SellOrder>(sellOrderID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsID)) { ICriterion criterion = Restrictions.Eq("GoodsID", PojoUtil.InitPojo <GoodsInfo>(goodsID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(qty)) { ICriterion criterion = Restrictions.Like("Qty", qty, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(sellPrice)) { ICriterion criterion = Restrictions.Like("SellPrice", sellPrice, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(realSellPrice)) { ICriterion criterion = Restrictions.Like("RealSellPrice", realSellPrice, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(totalMoney)) { ICriterion criterion = Restrictions.Like("TotalMoney", totalMoney, MatchMode.Anywhere); criteria.Add(criterion); } criteria.AddOrder(Order.Asc("SellOrderID")); } , pageSize, pageNum))); }
public ActionResult Get(int pageSize, int pageNum, string storehouseId, string goodsId) { return(Json(stockInitOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(storehouseId)) { ICriterion criterion = Restrictions.Eq("Storehouse", PojoUtil.InitPojo <Storehouse>(storehouseId)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsId)) { ICriterion criterion = Restrictions.Eq("Goods", PojoUtil.InitPojo <GoodsInfo>(goodsId)); criteria.Add(criterion); } //创建对象属性别名 criteria.CreateAlias("Storehouse", "sh"); criteria.AddOrder(Order.Asc("sh.StoreName")); } , pageSize, pageNum))); }
public ActionResult Get(int pageSize, int pageNum, string sellOrderCode, string storeHouseID, string salespersonID, string salespersonDeptID, string sellDateTime, string totalMoney) { return(Json(sellOrderOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(sellOrderCode)) { ICriterion criterion = Restrictions.Like("SellOrderCode", sellOrderCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(storeHouseID)) { ICriterion criterion = Restrictions.Eq("StoreHouseID", PojoUtil.InitPojo <Storehouse>(storeHouseID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(salespersonID)) { ICriterion criterion = Restrictions.Eq("SalespersonID", PojoUtil.InitPojo <Employee>(salespersonID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(salespersonDeptID)) { ICriterion criterion = Restrictions.Eq("SalespersonDeptID", PojoUtil.InitPojo <Department>(salespersonDeptID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(sellDateTime)) { ICriterion criterion = Restrictions.Like("SellDateTime", sellDateTime, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(totalMoney)) { ICriterion criterion = Restrictions.Like("TotalMoney", totalMoney, MatchMode.Anywhere); criteria.Add(criterion); } criteria.AddOrder(Order.Asc("SellOrderCode")); } , pageSize, pageNum))); }
public ActionResult GetPageCount(int pageSize, string roleFlag, string roleId, string modId) { return(Json(empModOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(roleFlag)) { ICriterion criterion = Restrictions.Eq("RoleFlag", roleFlag); criteria.Add(criterion); } if (!string.IsNullOrEmpty(roleId)) { ICriterion criterion = Restrictions.Eq("RoleId", new Guid(roleId)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(modId)) { ICriterion criterion = Restrictions.Eq("Mod", PojoUtil.InitPojo <Mod>(modId)); criteria.Add(criterion); } } , pageSize))); }
/// <summary> /// 查询仓库登记页数 /// </summary> /// <param name="pageSize"></param> /// <returns></returns> //[PowerActionFilterAttribute(FuncName = PowerActionFilterAttribute.FuncEnum.Get)] public ActionResult GetPageCount(int pageSize, string storeCode, string storeName, string deptID) { return(Json(storehouseOper.GetPageCount( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(storeCode)) { ICriterion criterion = Restrictions.Like("StoreCode", storeCode, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(storeName)) { ICriterion criterion = Restrictions.Like("StoreName", storeName, MatchMode.Anywhere); criteria.Add(criterion); } if (!string.IsNullOrEmpty(deptID)) { ICriterion criterion = Restrictions.Eq("Dept", PojoUtil.InitPojo <Department>(deptID)); criteria.Add(criterion); } } , pageSize))); }
/// <summary> /// 根据类型1获取所有类型2 /// </summary> /// <param name="workCodeType1"></param> /// <returns></returns> public ActionResult GetWorkCodeType2ForWeiXin(string workCodeType1Id) { IList <WorkCodeType> wcts = workCodeTypeOper.Get(delegate(object sender, ICriteria criteria) { ICriterion criterion = Restrictions.Eq("Type1", PojoUtil.InitPojo <WorkCodeType1>(workCodeType1Id)); criteria.Add(criterion); ICriteria criteria2 = criteria.CreateCriteria("Type2", "t2"); criteria2.AddOrder(Order.Asc("Code")); }); IList <WorkCodeType2> retVal = new List <WorkCodeType2>(); if (wcts.Count > 0) { foreach (WorkCodeType wct in wcts) { retVal.Add(wct.Type2); } } wcts.Clear(); return(Json(retVal)); }
public ActionResult Get(int pageSize, int pageNum, string retRentIOrderD, string goodsID, string qty) { return(Json(retRentOrderDetailOper.Get( delegate(object sender, ICriteria criteria) { if (!string.IsNullOrEmpty(retRentIOrderD)) { ICriterion criterion = Restrictions.Eq("RetRentIOrderD", PojoUtil.InitPojo <RetRentOrder>(retRentIOrderD)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(goodsID)) { ICriterion criterion = Restrictions.Eq("GoodsID", PojoUtil.InitPojo <GoodsInfo>(goodsID)); criteria.Add(criterion); } if (!string.IsNullOrEmpty(qty)) { ICriterion criterion = Restrictions.Like("Qty", qty, MatchMode.Anywhere); criteria.Add(criterion); } criteria.AddOrder(Order.Asc("RetRentIOrderD")); } , pageSize, pageNum))); }
//查找地址码 public ActionResult Add(WorkAndWorkTypeDetails wawtd) { bool retVal = false; Work work = wawtd.Work; //主工单 WorkSub workSub = wawtd.WorkSub; //子工单 if (workSub == null) { workSub = new WorkSub(); } IList <WorkTypeDetail> workTypeDetails = wawtd.WorkTypeDetails; //子工单维修类型 IList <WorkPic> workPics = wawtd.WorkPics; //子工单图片 ISession s = null; ITransaction trans = null; try { s = HibernateOper.GetCurrentSession(); trans = s.BeginTransaction(); //如果主工单的ID不存在则新建主工单,有可能是在原来的主工单基础上追加的子工单就会把主工单的ID传过来 if (work.Id == Guid.Empty) { //生成工单编号 work.Code = DateTime.Now.ToString("yyyyMMddHHmmssfffff"); //查找客户ID string openId = work.Cstmr.OpenId; work.Cstmr = PojoUtil.GetCust(s, openId); if (work.Cstmr == null) { Customer cstmr = new Customer(); cstmr.OpenId = openId; s.Save(cstmr); work.Cstmr = cstmr; } //保存工单 s.Save(work); } else { //根据工单ID找到工单 work = s.Get <Work>(work.Id); if (work == null) { //工单不存在 throw new Exceptions.WorkIsNotFoundException(); } } //保存子工单 //如果子工单的下单员工存在 if (workSub.OrderEmp != null) { //如果子工单的下单员ID存在 if (workSub.OrderEmp.Id != Guid.Empty) { workSub.OrderEmp = s.Get <Employee>(workSub.OrderEmp.Id); } //如果子工单的下单员工号存在 if (workSub.OrderEmp.Code != null && !workSub.OrderEmp.Code.ToString().Equals("")) { workSub.OrderEmp = PojoUtil.GetEmployee(s, workSub.OrderEmp.Code); } if (workSub.OrderEmp == null) { //该下单员不存在 throw new Exceptions.EmployeeIsNotFoundException(); } } workSub.Work = work; //根据工单地址自动分配任务到分店 workSub.Dept = PojoUtil.GetMinDistDept(s, work); s.Save(workSub); //保存维修类型 if (workTypeDetails != null) { foreach (WorkTypeDetail wtd in workTypeDetails) { wtd.WorkSub = workSub; s.Save(wtd); } } else { //维修类型明细不存在 throw new Exceptions.WorkTypeDetailIsNotFoundException(); } //保存图片 if (workPics != null) { foreach (WorkPic wp in workPics) { wp.WorkSub = workSub; s.Save(wp); } } trans.Commit(); retVal = true; } catch (Exception e) { if (trans != null) { trans.Rollback(); } throw e; } return(Json(retVal)); }