Exemplo n.º 1
1
        // CRUD FUNCTION
        // ADD NEW ITEM USING AJAX
        public int AddData(string Name, Nullable<int> UOM, string Remarks, string BarCode,
            Nullable<bool> WithSerial, Nullable<int> Reorder, string Code, Nullable<int> G230, Nullable<int> G233, Nullable<int> G234, 
            string Model)
        {
            var allItem = from m in db.PDs select m;
            if (allItem.Any(c => c.Name.ToLower().Equals(Name.ToLower())))
            {
                Response.Write("Item with the name '" + Name + "' already exists");
                Response.StatusCode = 404;
                Response.End();
                return -1;
            }

            var pushPDS = new PD();
            pushPDS.Name = Name;
            pushPDS.UOM = UOM;
            pushPDS.Remarks = Remarks;
            pushPDS.BarCode = BarCode;
            pushPDS.WithSerial = WithSerial;
            pushPDS.Reorder = Reorder;
            pushPDS.Code = Code;
            pushPDS.G230 = G230;
            pushPDS.G233 = G233;
            pushPDS.G234 = G234;
            pushPDS.Model = Model;

            db.PDs.InsertOnSubmit(pushPDS);
            db.SubmitChanges();

            //Response.End();
            return pushPDS.ID;
        }
Exemplo n.º 2
0
 partial void UpdatePD(PD instance);
Exemplo n.º 3
0
 partial void DeletePD(PD instance);
Exemplo n.º 4
0
 partial void InsertPD(PD instance);