コード例 #1
0
        private ActionResult _Modify(int id)
        {
            SaleEnquiryLine         temp     = _SaleEnquiryLineService.GetSaleEnquiryLine(id);
            SaleEnquiryLineExtended Extended = new SaleEnquiryLineExtendedService(_unitOfWork).Find(id);

            if (temp == null)
            {
                return(HttpNotFound());
            }

            #region DocTypeTimeLineValidation
            try
            {
                TimePlanValidation = DocumentValidation.ValidateDocumentLine(new DocumentUniqueId {
                    LockReason = temp.LockReason
                }, User.Identity.Name, out ExceptionMsg, out Continue);
            }
            catch (Exception ex)
            {
                string message = _exception.HandleException(ex);
                TempData["CSEXCL"] += message;
                TimePlanValidation  = false;
            }

            if (!TimePlanValidation)
            {
                TempData["CSEXCL"] += ExceptionMsg;
            }
            #endregion

            if ((TimePlanValidation || Continue))
            {
                ViewBag.LineMode = "Edit";
            }

            SaleEnquiryHeader H = new SaleEnquiryHeaderService(_unitOfWork).GetSaleEnquiryHeader(temp.SaleEnquiryHeaderId);
            ViewBag.DocNo = H.DocNo;
            SaleEnquiryLineViewModel s = Mapper.Map <SaleEnquiryLine, SaleEnquiryLineViewModel>(temp);

            s.BuyerSpecification  = Extended.BuyerSpecification;
            s.BuyerSpecification1 = Extended.BuyerSpecification1;
            s.BuyerSpecification2 = Extended.BuyerSpecification2;
            s.BuyerSpecification3 = Extended.BuyerSpecification3;
            s.BuyerSku            = Extended.BuyerSku;
            s.BuyerUpcCode        = Extended.BuyerUpcCode;


            var settings = new SaleEnquirySettingsService(_unitOfWork).GetSaleEnquirySettingsForDucument(H.DocTypeId, H.DivisionId, H.SiteId);
            s.SaleEnquirySettings = Mapper.Map <SaleEnquirySettings, SaleEnquirySettingsViewModel>(settings);

            ProductBuyerSettings ProductBuyerSettings = new ProductBuyerSettingsService(_unitOfWork).GetProductBuyerSettings(H.DivisionId, H.SiteId);
            s.ProductBuyerSettings = Mapper.Map <ProductBuyerSettings, ProductBuyerSettingsViewModel>(ProductBuyerSettings);

            PrepareViewBag(H);

            return(PartialView("_Create", s));
        }
コード例 #2
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            SaleEnquiryLine         temp     = _SaleEnquiryLineService.GetSaleEnquiryLine(id);
            SaleEnquiryLineExtended Extended = new SaleEnquiryLineExtendedService(_unitOfWork).Find(id);


            if (temp == null)
            {
                return(HttpNotFound());
            }


            SaleEnquiryHeader H = new SaleEnquiryHeaderService(_unitOfWork).GetSaleEnquiryHeader(temp.SaleEnquiryHeaderId);

            ViewBag.DocNo = H.DocNo;
            SaleEnquiryLineViewModel s = Mapper.Map <SaleEnquiryLine, SaleEnquiryLineViewModel>(temp);

            s.BuyerSpecification  = Extended.BuyerSpecification;
            s.BuyerSpecification1 = Extended.BuyerSpecification1;
            s.BuyerSpecification2 = Extended.BuyerSpecification2;
            s.BuyerSpecification3 = Extended.BuyerSpecification3;
            s.BuyerSku            = Extended.BuyerSku;
            s.BuyerUpcCode        = Extended.BuyerUpcCode;
            s.SaleEnquiryDocNo    = H.DocNo;
            s.SaleToBuyerId       = H.SaleToBuyerId;
            s.SaleEnquiryHeaderId = H.SaleEnquiryHeaderId;



            var settings = new SaleEnquirySettingsService(_unitOfWork).GetSaleEnquirySettingsForDucument(H.DocTypeId, H.DivisionId, H.SiteId);

            s.SaleEnquirySettings = Mapper.Map <SaleEnquirySettings, SaleEnquirySettingsViewModel>(settings);

            ProductBuyerSettings ProductBuyerSettings = new ProductBuyerSettingsService(_unitOfWork).GetProductBuyerSettings(H.DivisionId, H.SiteId);

            s.ProductBuyerSettings = Mapper.Map <ProductBuyerSettings, ProductBuyerSettingsViewModel>(ProductBuyerSettings);

            if (temp.DealUnitId == "MT2")
            {
                string SizeinFeet = "";

                using (SqlConnection sqlConnection = new SqlConnection((string)System.Web.HttpContext.Current.Session["DefaultConnectionString"]))
                {
                    sqlConnection.Open();
                    SqlCommand Totalf = new SqlCommand("SELECT Web.FGetSizeinFeet('" + Extended.BuyerSpecification1 + "')", sqlConnection);

                    SizeinFeet = Convert.ToString(Totalf.ExecuteScalar() == DBNull.Value ? "" : Totalf.ExecuteScalar());
                }

                ViewBag.SizeinFeet = "Feet :" + SizeinFeet;
            }

            return(View("Create", s));
        }