Exemplo n.º 1
0
        public JsonResult SaveSupplierInfo(FormCollection fc)
        {
            supplierInfo info = new supplierInfo();

            MyUtils.SetFieldValueToModel(fc, info);

            try {
                new ItemSv().SaveSupplierInfo(info, currentAccount);
            }
            catch (Exception ex) {
                return(Json(new SRM(ex)));
            }
            return(Json(new SRM()));
        }
Exemplo n.º 2
0
        public void SaveSupplierInfo(supplierInfo info, string account)
        {
            var inf = db.SupplierInfo.Where(s => s.supplier_number == info.supplierNumber && s.account == account).FirstOrDefault();

            if (inf == null)
            {
                inf = new SupplierInfo();
                inf.supplier_number = info.supplierNumber;
                inf.name            = info.supplierName;
                inf.account         = account;
                db.SupplierInfo.InsertOnSubmit(inf);
            }
            inf.attn_name   = info.supplierAttn;
            inf.address     = info.supplierAddr;
            inf.phone       = info.supplierPhone;
            inf.update_date = DateTime.Now;

            db.SubmitChanges();
        }