public ActionResult Edit(CostEstimationOfArticle costestimationofarticlemaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(costestimationofarticlemaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(costestimationofarticlemaster));
 }
        public ActionResult Details(int id = 0)
        {
            CostEstimationOfArticle barcodemaster = db.CostEstimationOfArticles.Find(id);

            if (barcodemaster == null)
            {
                return(HttpNotFound());
            }
            return(View(barcodemaster));
        }
        public ActionResult Create([ModelBinder(typeof(CostEstimationCustomBinder))] CostEstimationOfArticle cost)
        {
            if (ModelState.IsValid)
            {
                _icostestimationarticleservice.CreateClientcode(cost);
                var sizelast = _icostestimationarticleservice.getLastInsertedClientcode();
                int sizeid   = sizelast.clientId;
                return(RedirectToAction("Details/" + sizeid, "CostEstimation"));
            }

            return(View());
        }
        public ActionResult Create()
        {
            CostEstimationOfArticle costmaster = new CostEstimationOfArticle();
            //IEnumerable<ClientMaster> clientnames = _iclientservice.getAllClients();
            //costmaster.clientname = clientnames;
            IEnumerable <Category> categorylist = _categoryservice.getActiveCategory();

            costmaster.categorylist = categorylist;

            IEnumerable <SizeMaster> suppliername = _isizemasterservice.getallsize();

            costmaster.sizematerial = suppliername;


            IEnumerable <UnitMaster> unitname = _iunitmasterservice.getallsize();

            costmaster.itemunittype = unitname;
            CostEstimationOfArticle size = _icostestimationarticleservice.getLastInsertedClientcode();

            int catVal = 0;
            int length = 0;

            if (size != null)
            {
                catVal = size.clientId;
                catVal = catVal + 1;
                length = catVal.ToString().Length;
            }
            else
            {
                catVal = 1;
                length = 1;
            }
            string catCode = _iutiltyservice.getName("CLI", length, catVal);

            costmaster.clientCode = catCode;



            return(View(costmaster));
        }
        public JsonResult getSizes(string code)
        {
            if (!string.IsNullOrEmpty(code))
            {
                //var coderesult = _categoryservice.getCategoryByCode(code);
                //var itemname = _itemmasterservice.getItemByShortName(coderesult.categoryShortName);
                var designnmae = _idesignservice.getdesignbyitemname(code);

                CostEstimationOfArticle cost = new CostEstimationOfArticle();
                cost.designname = designnmae;
                var modelData = cost.designname.Select(m => new SelectListItem()
                {
                    Text  = m.designName,
                    Value = m.designName
                });

                return(Json(modelData, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var modelData = string.Empty;
                return(Json(modelData, JsonRequestBehavior.AllowGet));
            }
        }