public ActionResult CreateProduct(ProductMaster proMaster)
        {
            string message = "Saved Succesfull";
            bool   status  = true;
            var    getRm   = _capitaContext.ProductMasters.ToList();

            foreach (var item in getRm)
            {
                if (item.ProductName.Trim().ToLower() == proMaster.ProductName.Trim().ToLower())
                {
                    return(View("CustomerExist"));
                }
            }

            if (proMaster.Id == 0)
            {
                _capitaContext.ProductMasters.Add(proMaster);
            }
            else
            {
                var vendorIbDB = _capitaContext.ProductMasters.Single(v => v.Id == proMaster.Id);

                vendorIbDB.ProductName = proMaster.ProductName;
                vendorIbDB.ShortCode   = proMaster.ShortCode;
            }

            _capitaContext.SaveChanges();
            return(Json(new { status = status, message = message }, JsonRequestBehavior.AllowGet));

            return(RedirectToAction("CreateProduct", "MasterCreation"));
        }
Пример #2
0
        public ActionResult Edit(FinishedGood fg)
        {
            if (fg.Id != 0)
            {
                var vendorIbDB = _capitaContext.FinishedGoods.Single(v => v.Id == fg.Id);
                fg.ProductCode         = fg.ProductName.Substring(0, 4) + "00" + fg.ShortColorCode.Substring(0, 3) + fg.Capacity;
                vendorIbDB.ProductName = fg.ProductName;
                vendorIbDB.ProductCode = fg.ProductCode;
                vendorIbDB.CellType    = fg.CellType;
                vendorIbDB.Capacity    = fg.Capacity;
                vendorIbDB.Color       = fg.Color;
                vendorIbDB.Brand       = fg.Brand;

                vendorIbDB.ShortBrandCode   = fg.ShortBrandCode;
                vendorIbDB.ShortColorCode   = fg.ShortColorCode;
                vendorIbDB.ShortProductName = fg.ShortProductName;
                vendorIbDB.UOM   = fg.UOM;
                vendorIbDB.Stock = fg.Stock;
                vendorIbDB.GST   = fg.GST;

                vendorIbDB.Rate = fg.Rate;
                vendorIbDB.MIN  = fg.MIN;
                vendorIbDB.Max  = fg.Max;
                vendorIbDB.SAC  = fg.SAC;
            }
            _capitaContext.SaveChanges();
            return(RedirectToAction("Index", "FinishedGood"));
        }
        public ActionResult Edit(CustomerMasterVM customer)
        {
            if (customer.customerMaster.S_No != 0)
            {
                var vendorIbDB = _capitaContext.CustomerMasters.Single(v => v.S_No == customer.customerMaster.S_No);

                vendorIbDB.CustomerName    = customer.customerMaster.CustomerName;
                vendorIbDB.CustomerAddress = customer.customerMaster.CustomerAddress;
                vendorIbDB.SuplierGstNo    = customer.customerMaster.SuplierGstNo;
                vendorIbDB.SuplierTypeId   = customer.customerMaster.SuplierTypeId;
                vendorIbDB.ContactPerson   = customer.customerMaster.ContactPerson;
                vendorIbDB.DeliveryFrom    = customer.customerMaster.DeliveryFrom;
                vendorIbDB.ContactNo       = customer.customerMaster.ContactNo;
            }
            _capitaContext.SaveChanges();
            return(RedirectToAction("Index", "CreateCustomer"));
        }
        public ActionResult CreateRM(RMCreationWithCodeVM rmCreations)
        {
            if (rmCreations.rmCreation.MaterialName == null || rmCreations.rmCreation.MaterialGroup == null || rmCreations.rmCreation.Color == null || rmCreations.rmCreation.Model == null || rmCreations.rmCreation.Rate == null || rmCreations.rmCreation.QUOM == null || rmCreations.rmCreation.UOM_1 == null || rmCreations.rmCreation.UOM_2 == null || rmCreations.rmCreation.Type == null || rmCreations.rmCreation.SAC_CODE == null || rmCreations.rmCreation.Stock == null)
            {
                return(View("_partialView/AllFiledInRM"));
            }
            if (rmCreations.isYesNo.Type == "1")
            {
                rmCreations.rmCreation.IsMinMax = "Yes";
            }
            if (rmCreations.isYesNo.Type == "2")
            {
                rmCreations.rmCreation.IsMinMax = "No";
            }
            else if (rmCreations.isYesNo.Type == "0")
            {
                throw new Exception("Invalid Selection");
            }

            rmCreations.rmCreation.UpdatedStock = rmCreations.rmCreation.Stock;
            if (rmCreations.rmCreation.Capacity_AMH == null)
            {
                rmCreations.rmCreation.Capacity_AMH = "0";
            }
            var getRm = _capitaContext.RoleMaterialCreations.ToList();

            foreach (var item in getRm)
            {
                if (item.MaterialName.Trim().ToLower() == rmCreations.rmCreation.MaterialName.Trim().ToLower() && item.Model.Trim().ToLower() == rmCreations.rmCreation.Model.Trim().ToLower() && item.Type.Trim().ToLower() == rmCreations.rmCreation.Type.Trim().ToLower() && item.Capacity_AMH.Trim().ToLower() == rmCreations.rmCreation.Capacity_AMH.Trim().ToLower() && item.Color.Trim().ToLower() == rmCreations.rmCreation.Color.Trim().ToLower())
                {
                    return(View("View"));
                }
            }
            //int cap = Convert.ToInt32(rmCreations.rmCreation.Capacity_AMH);
            //if (Math.Abs(cap) > 999)
            //{
            //    rmCreations.rmCreation.Capacity_AMH = Math.Sign(cap) * (Math.Abs(cap) / 1000) + "k";
            //}
            rmCreations.rmCreation.Code = rmCreations.rmCreation.MaterialName.ToUpper() + rmCreations.rmCreation.Model.ToUpper() + rmCreations.rmCreation.Type.ToUpper() + rmCreations.rmCreation.Color.ToUpper() + rmCreations.rmCreation.Capacity_AMH;

            _capitaContext.RoleMaterialCreations.Add(rmCreations.rmCreation);
            _capitaContext.SaveChanges();
            return(RedirectToAction("Index", "RmCreation"));
        }
Пример #5
0
        public ActionResult CreateVendor(VendorMasterModel vendor)
        {
            var getRm = _capitaContext.VendorMasters.ToList();

            foreach (var item in getRm)
            {
                if (item.VendorName.Trim().ToLower() == vendor.vendorMaster.VendorName.Trim().ToLower())
                {
                    return(View("VendorExist"));
                }
            }


            if (vendor.vendorMaster.S_No == 0)
            {
                vendor.vendorMaster.VendorCode = vendor.vendorMaster.VendorName.Substring(0, 4) + "00" + vendor.vendorMaster.SuplierGstNo.Substring(0, 3);
                var vendorVM = new VendorMasterModel
                {
                    vendorMaster  = vendor.vendorMaster,
                    supplierTypes = _capitaContext.SuplierTypes.ToList()
                };

                _capitaContext.VendorMasters.Add(vendor.vendorMaster);
            }
            else
            {
                var vendorIbDB = _capitaContext.VendorMasters.Single(v => v.S_No == vendor.vendorMaster.S_No);
                vendor.vendorMaster.VendorCode = vendor.vendorMaster.VendorName.Substring(0, 4) + "00" + vendor.vendorMaster.SuplierGstNo.Substring(0, 3);
                vendorIbDB.VendorName          = vendor.vendorMaster.VendorName;
                vendorIbDB.VendorCode          = vendor.vendorMaster.VendorCode;
                vendorIbDB.VendorAddress       = vendor.vendorMaster.VendorAddress;
                vendorIbDB.SuplierGstNo        = vendor.vendorMaster.SuplierGstNo;
                vendorIbDB.SuplierTypeId       = vendor.vendorMaster.SuplierTypeId;
                vendorIbDB.ContactPerson       = vendor.vendorMaster.ContactPerson;
            }

            _capitaContext.SaveChanges();
            return(RedirectToAction("CreateVendor", "Vendor"));
        }