예제 #1
0
        public static void Validate_ItemUnitIsNotNull_DoesNotHaveError(
            ItemUnitModel itemUnit,
            CreateOrderItemModelValidator validator)
        {
            var model = new CreateOrderItemModel {
                ItemUnit = itemUnit
            };

            var result = validator.TestValidate(model);

            result.ShouldNotHaveValidationErrorFor(m => m.ItemUnit);
        }
예제 #2
0
 private CreateOrderItemModelBuilder()
 {
     _serviceRecipient = new ServiceRecipientModel
     {
         OdsCode = "AB1234"
     };
     _catalogueSolutionId   = "10000-001";
     _catalogueSolutionName = "Some solution name";
     _deliveryDate          = DateTime.UtcNow;
     _quantity         = 123;
     _estimationPeriod = "month";
     _provisioningType = "Patient";
     _type             = "Flat";
     _currencyCode     = "EUR";
     _itemUnitModel    = new ItemUnitModel
     {
         Name        = "patients",
         Description = "per patients"
     };
     _price = 25.1m;
 }
예제 #3
0
        public ActionResult SetInbound(INinboundSet InboundItem, STstockInventoryDetail stockdetails, ItemUnitModel itemunit)
        {
            InboundItem.Is_Deleted  = false;
            InboundItem.Create_Date = DateTime.Now;
            InboundItem.Create_User = user.UserID;
            InboundItem.Update_Date = DateTime.Now;
            InboundItem.Update_User = user.UserID;
            string DateID      = DateTime.Now.ToString("yyyyMMdd");
            string gencode     = string.Empty;
            string lastgencode = (from u in db.INinboundSets.ToList()
                                  orderby u.InboundNoResult descending
                                  select u.InboundNoResult).FirstOrDefault();

            if (lastgencode == null)
            {
                gencode = DateID + "INR0000001";
            }
            else
            {
                gencode = lastgencode.Substring(11);
                int upId = Convert.ToInt32(gencode.TrimStart(new char[] { '0' })) + 1;
                gencode = DateID + string.Format("INR{0}", upId.ToString().PadLeft(7, '0'));
            }
            InboundItem.InboundNoResult = gencode;
            try
            {
                db.INinboundSets.Add(InboundItem);
                db.SaveChanges();

                string gencodes     = string.Empty;
                string lastgencodes = (from u in db.STstockInventoryDetails.ToList()
                                       orderby u.StockDetailCode descending
                                       select u.StockDetailCode).FirstOrDefault();
                if (lastgencodes == null)
                {
                    gencodes = DateID + "STD0000001";
                }
                else
                {
                    gencodes = lastgencodes.Substring(11);
                    int upId = Convert.ToInt32(gencodes.TrimStart(new char[] { '0' })) + 1;
                    gencodes = DateID + string.Format("STD{0}", upId.ToString().PadLeft(7, '0'));
                }

                INinboundPlan inboundplan      = (from c in db.INinboundPlans where c.InboundPlanCode == InboundItem.InboundPlanCode select c).FirstOrDefault();
                mItem         itemcurrent_main = (from c in db.mItems where c.ItemCode == InboundItem.ItemCode select c).FirstOrDefault();
                INinboundItem inboundplanitem  = (from c in db.INinboundItems where c.InboundPlanCode == InboundItem.InboundPlanCode && c.ItemCode == itemcurrent_main.ItemCode select c).FirstOrDefault();

                stockdetails.StockCode        = (from c in db.STstockInventories where c.InboundPlanCode == InboundItem.InboundPlanCode select c.StockCode).FirstOrDefault();
                stockdetails.InboundPlanNo    = inboundplan.InboundPlanCode;
                stockdetails.InboundNoResult  = gencode;  //Inbound result Gen code
                stockdetails.StockDetailCode  = gencodes; //Stock Details Code
                stockdetails.ItemCode         = inboundplanitem.ItemCode;
                stockdetails.ExpiredDate      = inboundplanitem.ExpirationDate;
                stockdetails.InboundDate      = inboundplan.InboundPlanDate;
                stockdetails.ActualStockQty   = InboundItem.ActualReceived;
                stockdetails.AllocatedQty     = 0;
                stockdetails.PickedQty        = 0;
                stockdetails.LocationCode     = InboundItem.Location;
                stockdetails.LocationSubCode  = InboundItem.SubLocation;
                stockdetails.LotNo            = inboundplanitem.LotNo;
                stockdetails.PONo             = inboundplanitem.PoNo;
                stockdetails.SupplierCode     = itemcurrent_main.CusSupCode;
                stockdetails.SupplierCode     = itemcurrent_main.CusSupCode;
                stockdetails.OriginalItemCode = itemcurrent_main.ItemCode;
                stockdetails.CaseQty          = itemunit.pqc_q;
                stockdetails.QtyPerCase       = itemunit.QtyPerCase;
                stockdetails.InnerCaseQty     = itemunit.qpic_q;
                stockdetails.InnerQtyPerCase  = itemunit.QtyPerInnerCase;
                stockdetails.UnitQty          = itemunit.QtyPerUnit;
                //stockdetails.NW = (itemunit.QtyPerCase + itemunit.QtyPerInnerCase + itemunit.QtyPerUnit) * itemcurrent_unit.Where(c => c.Type == "") sa sunod na to
                stockdetails.LastInboundDate = DateTime.Now;
                //stockdetails.LastOutboundDate = DateTime.Now;
                stockdetails.SlipClass   = inboundplan.SlipClass;
                stockdetails.SlipDate    = inboundplan.SlipDate;
                stockdetails.SlipNo      = inboundplan.SlipNo;
                stockdetails.SlipRemarks = inboundplan.Remarks;
                stockdetails.Is_Deleted  = false;
                stockdetails.Create_Date = DateTime.Now;
                stockdetails.Create_User = user.UserID;
                stockdetails.Update_Date = DateTime.Now;
                stockdetails.Update_User = user.UserID;
                db.STstockInventoryDetails.Add(stockdetails);
                db.SaveChanges();
            }
            catch (Exception err) { }
            return(Json(new { result = "success", InboundItem = InboundItem }, JsonRequestBehavior.AllowGet));
        }