public ActionResult _Edit(Region region)
        {

            if (ModelState.IsValid)
            {
                genericMgr.Update(region);
                SaveSuccessMessage(Resources.MD.Region.Region_Updated);
            }
            ViewBag.PartyCode = region.Code;
            return PartialView(region);
        }
 public ActionResult New(Region region)
 {
     if (ModelState.IsValid)
     {
         //判断描述不能重复
         if (this.genericMgr.FindAll<long>(CodeDuiplicateVerifyStatement, new object[] { region.Code })[0] > 0)
         {
             base.SaveErrorMessage(Resources.MD.Region.Region_Errors_Existing_Code, region.Code);
         }
         else
         {
             partyMgr.Create(region);
             SaveSuccessMessage(Resources.MD.Region.Region_Added);
             return RedirectToAction("Edit/" + region.Code);
         }
     }
     return View(region);
 }
Example #3
0
 public ActionResult New(Region region)
 {
     if (ModelState.IsValid)
     {
         //判断描述不能重复
         if (base.genericMgr.FindAll<long>(selectCountRegionStatement, new object[] { region.Code })[0] > 0)
         {
             base.SaveErrorMessage(Resources.MD.Region.Region_Errors_Existing_Code, region.Code);
         }
         else if (base.genericMgr.FindAll<long>(selectCountSupplierStatement, new object[] { region.Code })[0] > 0)
         {
             base.SaveErrorMessage(Resources.MD.Party.Party_Errors_Exists_Code_UserdBySupplier, region.Code);
         }
         else if (base.genericMgr.FindAll<long>(selectCountCustomerStatement, new object[] { region.Code })[0] > 0)
         {
             base.SaveErrorMessage(Resources.MD.Party.Party_Errors_Exists_Code_UserdByCustomer, region.Code);
         }
         else 
         {
             partyMgr.Create(region);
             SaveSuccessMessage(Resources.MD.Region.Region_Added);
             return RedirectToAction("Edit/" + region.Code);
         }
     }
     return View(region);
 }
Example #4
0
        public ActionResult _ManufacturePartyComboBox(string controlName, string controlId, string selectedValue, bool? enable, bool? isChange)
        {
            ViewBag.ControlName = controlName;
            ViewBag.ControlId = controlId;
            ViewBag.Enable = enable;
            ViewBag.IsChange = isChange;

            string hql = "select p from Region p where p.Code in(select distinct m.PartyFrom from FlowMaster as m where m.Type=" + (int)com.Sconit.CodeMaster.OrderType.Production + ")";

            IList<Region> regionList = base.genericMgr.FindAll<Region>(hql);
            if (regionList == null)
            {
                regionList = new List<Region>();
            }

            IList<Supplier> supplierList = base.genericMgr.FindAll<Supplier>("from Supplier as s");

            if (supplierList.Count > 0)
            {
                foreach (Supplier item in supplierList)
                {
                    Region region = new Region();
                    region.Code = item.Code;
                    region.Name = item.Name;
                    regionList.Add(region);
                }
            }

            return PartialView(new SelectList(regionList, "Code", "CodeDescription", selectedValue));
        }
Example #5
0
        public KanbanCard GenerateToDb(KanbanCard cardWithoutCardNoAndSeq, Boolean useNextSeq, int nextSeq, User calcUser, Boolean isAlternative, Region region)
        {
            int currentSeq = 0;
            if (cardWithoutCardNoAndSeq.MultiSupplyGroup == null)
            {
                cardWithoutCardNoAndSeq.MultiSupplyGroup = string.Empty;
            }

            //if (String.IsNullOrEmpty(region.KbStandardCode) || String.IsNullOrEmpty(region.KbAlternativeCode))
            //{
            //    throw new BusinessException("区域KB标准或异常代码未设置,区域=" + region.Code);
            //}

            //   string kbcode = isAlternative ? region.KbAlternativeCode : region.KbStandardCode;

            string nextSeqString = "";
            if (useNextSeq)
            {
                nextSeqString = nextSeq.ToString();
            }
            else
            {
                currentSeq = GetCurrentKanbanNum(cardWithoutCardNoAndSeq.Region, cardWithoutCardNoAndSeq.Supplier, cardWithoutCardNoAndSeq.Item, cardWithoutCardNoAndSeq.MultiSupplyGroup);
                nextSeqString = (currentSeq + 1).ToString();
            }
            if (currentSeq == 999)
            {
                throw new BusinessException("看板当前为999张,不能新增看板");
            }
            if (nextSeqString.Length < 3)
            {
                nextSeqString = nextSeqString.PadLeft(3, '0');
            }


            cardWithoutCardNoAndSeq.CardNo = cardWithoutCardNoAndSeq.Flow.Trim() + cardWithoutCardNoAndSeq.Item.Trim() + nextSeqString;
            cardWithoutCardNoAndSeq.Sequence = nextSeqString;
            cardWithoutCardNoAndSeq.TotalCount = currentSeq + 1;
            cardWithoutCardNoAndSeq.NeedReprint = true;
            this.genericMgr.Create(cardWithoutCardNoAndSeq);

            this.kanbanTransactionMgr.RecordKanbanTransaction(cardWithoutCardNoAndSeq, calcUser, DateTime.Now, KBTransType.Initialize);

            return cardWithoutCardNoAndSeq;
        }