예제 #1
0
        public Response UpdateManufacturerDetails(ManufacturerUnitDetails obj)
        {
            var IsExist = entities.manufacturerunits.Where(x => x.id == obj.id).ToList();

            if (IsExist.Count != 0)
            {
                var itemObj = entities.manufacturerunits.Where(x => x.id == obj.id).FirstOrDefault();

                itemObj.id          = obj.id;
                itemObj.name        = obj.name;
                itemObj.productid   = obj.productid;
                itemObj.productname = obj.productname;
                itemObj.quantity    = obj.quantity;
                itemObj.createdOn   = DateTime.Now;
                entities.SaveChanges();
                return(new Response {
                    IsSuccess = true, Message = "Manufacturer details updated successfully "
                });
            }
            else
            {
                return new Response {
                           IsSuccess = false, Message = "Manufacturer already exists"
                }
            };
        }
예제 #2
0
        public Response SaveManufacturerDetails(ManufacturerUnitDetails obj)
        {
            manufacturerunit itemObj = new manufacturerunit();

            itemObj.id          = obj.id;
            itemObj.name        = obj.name;
            itemObj.productid   = obj.productid;
            itemObj.productname = obj.productname;
            itemObj.quantity    = obj.quantity;
            itemObj.createdOn   = DateTime.Now;
            entities.manufacturerunits.Add(itemObj);
            entities.SaveChanges();
            return(new Response {
                IsSuccess = true, Message = "Manufacturer details added successfully"
            });
        }
예제 #3
0
        public ActionResult OrderManufacturers(string id, string name, string productname, string productid, string quantity, string actualQuantity, string distributorName, string distributorId)
        {
            if (id == "" || id == null)
            {
                id = "0";
            }
            if (productid == "" || productid == null)
            {
                productid = "0";
            }
            if (quantity == "" || quantity == null)
            {
                quantity = "0";
            }
            if (distributorId == "" || distributorId == null)
            {
                distributorId = "0";
            }
            Response                res        = new Response();
            List <object>           resultList = new List <object>();
            var                     idFlag     = Int32.Parse(id);
            ManufacturerUnitDetails item       = new ManufacturerUnitDetails();

            item.name        = name;
            item.productid   = Int32.Parse(productid);
            item.productname = productname;
            item.quantity    = Int32.Parse(actualQuantity);
            item.id          = idFlag;
            DistributorUnitDetails distItem = new DistributorUnitDetails();

            distItem.id            = Int32.Parse(distributorId);
            distItem.name          = distributorName;
            distItem.productid     = Int32.Parse(productid);
            distItem.productname   = productname;
            distItem.distributorId = Int32.Parse(distributorId);
            distItem.quantity      = Int32.Parse(quantity);
            masterDal.UpdateManufacturerDetails(item);
            res = masterDal.SaveDisctributorDetails(distItem);
            resultList.Add(res);
            resultList.Add(GetAllManufacturerDetails());
            return(Json(resultList, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public ActionResult SaveManufacturers(string id, string name, string productname, string productid, string quantity)
        {
            if (id == "" || id == null)
            {
                id = "0";
            }
            if (productid == "" || productid == null)
            {
                productid = "0";
            }
            if (quantity == "" || quantity == null)
            {
                quantity = "0";
            }
            Response                res        = new Response();
            List <object>           resultList = new List <object>();
            var                     idFlag     = Int32.Parse(id);
            ManufacturerUnitDetails item       = new ManufacturerUnitDetails();

            item.name        = name;
            item.productid   = Int32.Parse(productid);
            item.productname = productname;
            item.quantity    = Int32.Parse(quantity);
            item.id          = idFlag;
            if (idFlag == 0)
            {
                res = masterDal.SaveManufacturerDetails(item);
            }
            else
            {
                res = masterDal.UpdateManufacturerDetails(item);
            }
            resultList.Add(res);
            resultList.Add(GetAllManufacturerDetails());
            return(Json(resultList, JsonRequestBehavior.AllowGet));
        }