Esempio n. 1
0
        public string UpdateKitchenRawMaterial(KitchenRawIndentModel model)
        {
            var Path = Server.MapPath("/xmlkot/KitchenRawMaterial.xml");
            var Data = obj.UpdateKitchenRawMaterail(model, Path);

            return(Data);
        }
Esempio n. 2
0
        // Kitchen Raw Indent
        #region
        public KitchenRawIndentModel AddKitchenRawIndent()
        {
            KitchenRawIndentModel model = new KitchenRawIndentModel();

            model.lstofCategorirs            = GetListofCategories();
            model.GetListOfKitchenRawIndents = GetListOfRawIndents();
            model.GetAllAutocomplete         = GetList();
            model.lstofUnits         = GetListofUnits();
            model.lstofRawCategories = GetListofRawCategories();
            return(model);
        }
Esempio n. 3
0
        public string UpdateKitchenRawMaterail(KitchenRawIndentModel model, string path)
        {
            int oulte = 99; //WebSecurity.CurrentUserId;
            //int unitid = Convert.ToInt32(model.Unit);
            XDocument xd = XDocument.Load(path);
            //var unit = _entities.Units.Where(x => x.UnitId == unitid ).SingleOrDefault();

            //var items = from item in xd.Descendants("Items")
            //            where item.Element("UserId").Value == oulte.ToString()
            //            && item.Element("RawCategoryId").Value == model.RawCategoryId.ToString() &&
            //            item.Element("ItemId").Value == model.ItemId.ToString() &&
            //            item.Element("RawMaterialId").Value == RawId.ToString()
            //            select item;
            // if (items.Count() > 0)
            // {
            //     foreach (XElement itemElement in items)
            //     {

            //         itemElement.SetElementValue("UserId", oulte);
            //         itemElement.SetElementValue("RawCategoryId", model.RawCategoryId);
            //         itemElement.SetElementValue("ItemId", model.ItemId);
            //         itemElement.SetElementValue("RawMaterialId", RawId);
            //         itemElement.SetElementValue("Unit", model.Unit);
            //         itemElement.SetElementValue("Quantity", model.Quantity);

            //         xd.Save(path);
            //     }
            // }
            //else
            // {
            var newElement = new XElement("Items",
                                          new XElement("UserId", oulte),
                                          new XElement("RawCategoryId", model.RawCategoryId),
                                          new XElement("ItemId", model.ItemId),
                                          new XElement("RawMaterialId", model.RawMaterialId),
                                          new XElement("Unit", model.Unit),
                                          new XElement("Portion", model.Portion),
                                          new XElement("Quantity", model.Quantity));

            xd.Element("Item").Add(newElement);
            xd.Save(path);
            //}
            return(FillXmlData(path));
        }