public List <DepartmentItem> GetDepartmentItemNeeded(String itemName)
        {
            var retrievalItemList = new List <DepartmentItem>();
            var list = context.DepartmentRequisitions.Where(d => d.Status != StatusType.Pending.ToString() &&
                                                            d.Status != StatusType.Completed.ToString() && d.Item.ItemName == itemName)
                       .GroupBy(d => d.DepartmentId);
            var itemId  = context.Items.Where(it => it.ItemName == itemName).FirstOrDefault().ItemId;
            var lastBal = GetStockCardBalance(itemId);

            foreach (var group in list)
            {
                var item = new DepartmentItem();
                foreach (var value in group)
                {
                    item.DepartmentId   = value.DepartmentId;
                    item.ItemId         = value.Item.ItemId;
                    item.NeededQuantity = group.Select(g => g.Needed - g.Actual).Sum();

                    if (lastBal >= item.NeededQuantity)
                    {
                        item.ActualQuantity = item.NeededQuantity;
                        lastBal            -= item.NeededQuantity;
                    }
                    else
                    {
                        item.ActualQuantity = (int)lastBal;
                        lastBal            -= item.ActualQuantity;
                    }

                    item.DepartmentRequisitionId = group.Select(g => g.DepartmentRequisitionId).Last();
                }
                retrievalItemList.Add(item);
            }
            return(retrievalItemList);
        }
コード例 #2
0
        /// <summary>
        /// 修改部门
        /// </summary>
        /// <param name="department">新部门对象</param>
        /// <returns>成功返回新对象,否则null</returns>
        public DepartmentItem updDepartmentService(DepartmentItem department)
        {
            department.company = account.company;
            int result = departmentModel.updDepartment(department.getParent());

            return(result > 0 ? department : null);
        }
コード例 #3
0
 public string update(string newDepartmentJson)
 {
     try
     {
         //创建service层实例
         departmentService = new DepartmentService();
         //处理json
         DepartmentItem departmentItem = FinanceJson.getFinanceJson().toObject <DepartmentItem>(newDepartmentJson);
         //修改操作
         departmentItem = departmentService.updDepartmentService(departmentItem);
         if (departmentItem != null)
         {
             return(FinanceResultData.getFinanceResultData().success(200, departmentItem, "成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "删除失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
コード例 #4
0
 public DN_Department UpdateBase(DN_Department department, DepartmentItem departmentItem)
 {
     department.AgencyID    = departmentItem.AgencyID;
     department.Name        = departmentItem.Name;
     department.Description = departmentItem.Description;
     department.IsShow      = departmentItem.IsShow;
     department.Sort        = departmentItem.Sort;
     department.IsDelete    = departmentItem.IsDelete;
     return(department);
 }
コード例 #5
0
        public ActionResult AjaxForm()
        {
            var department = new DepartmentItem();

            if (DoAction == ActionType.Edit)
            {
                department = _departmentApi.GetDepartmentItemById(UserItem.AgencyID, ArrId.FirstOrDefault());
            }
            ViewData.Model     = department;
            ViewBag.Action     = DoAction;
            ViewBag.ActionText = ActionText;
            return(View());
        }
コード例 #6
0
 public void SetDepartmentData(List <Department> depList)
 {
     for (int i = 0; i < depList.Count; i++)
     {
         GameObject     Obj  = InstantiateLine();
         DepartmentItem item = Obj.GetComponent <DepartmentItem>();
         item.ShowDepartmentItemInfo(depList[i], DepartList, grid, DepSelected.text, pegeNumText.text);
         if (i % 2 == 0)
         {
             item.GetComponent <Image>().sprite = DoubleImage;
         }
         else
         {
             item.GetComponent <Image>().sprite = OddImage;
         }
     }
     //  ToggleAuthoritySet();
 }
コード例 #7
0
        public ActionResult Actions()
        {
            var msg           = new JsonMessage();
            var department    = new DepartmentItem();
            var lstDepartment = new List <DepartmentItem>();
            var json          = "";
            var lstId         = Request["itemId"];

            switch (DoAction)
            {
            case ActionType.Add:
                UpdateModel(department);
                department.IsDelete = false;
                json = new JavaScriptSerializer().Serialize(department);
                msg  = _departmentApi.Add(UserItem.AgencyID, json);
                break;

            case ActionType.Edit:
                UpdateModel(department);
                department.IsDelete = false;
                json = new JavaScriptSerializer().Serialize(department);
                msg  = _departmentApi.Update(UserItem.AgencyID, json, ArrId.FirstOrDefault());
                break;

            case ActionType.Delete:
                var lst1 = string.Join(",", ArrId);
                msg = _departmentApi.Delete(lst1);
                break;

            default:
                msg.Message = "Bạn không được phân quyền cho chức năng này.";
                msg.Erros   = true;
                break;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
コード例 #8
0
ファイル: StubStoreCatalog.cs プロジェクト: avieru/dwpds
 public IEnumerable<ProductItem> get_products_for(DepartmentItem department)
 {
     return Enumerable.Range(1, 100).Select(x => new ProductItem { name = x.ToString("Product 0") });
 }
コード例 #9
0
ファイル: StubStoreCatalog.cs プロジェクト: avieru/dwpds
 public IEnumerable<DepartmentItem> get_departments_for(DepartmentItem department)
 {
   return Enumerable.Range(1, 100).Select(x => new DepartmentItem {name = x.ToString("Sub Department 0")});
 }
コード例 #10
0
 public IEnumerable <ProductItem> get_products_in(DepartmentItem testdepartment)
 {
     return(Enumerable.Range(1, 100).Select(x => new ProductItem {
         name = x.ToString("Product 0")
     }));
 }
コード例 #11
0
 public IEnumerable <DepartmentItem> get_departments_in(DepartmentItem selected_department)
 {
     return(Enumerable.Range(1, 100).Select(x => new DepartmentItem {
         name = x.ToString("Sub Department 0")
     }));
 }
コード例 #12
0
            InputModel IContainRequestInformation.map <InputModel>()
            {
                object department = new DepartmentItem();

                return((InputModel)department);
            }