Ejemplo n.º 1
0
        public ActionResult Add(CUSTOMER model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    etMgr.AddToCUSTOMER(model);
                    if (etMgr.SaveChanges() != 0)
                    {

                        return RedirectToAction("CusList");
                    }
                    else
                    {
                        return RedirectToAction("Add");
                    }
                }
                else
                {
                    return RedirectToAction("Add");
                }
            }
            catch (Exception ex)
            {
                Com.Mxm.WriteTxt.WriteText(DateTime.Now.ToString() + "\t\n" + ex.Message + ex.StackTrace);
                return View();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 用于向 CUSTOMER EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToCUSTOMER(CUSTOMER cUSTOMER)
 {
     base.AddObject("CUSTOMER", cUSTOMER);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 创建新的 CUSTOMER 对象。
 /// </summary>
 /// <param name="cUSTOMER_ID">CUSTOMER_ID 属性的初始值。</param>
 /// <param name="cUSTOMER_NAME">CUSTOMER_NAME 属性的初始值。</param>
 public static CUSTOMER CreateCUSTOMER(global::System.Int32 cUSTOMER_ID, global::System.String cUSTOMER_NAME)
 {
     CUSTOMER cUSTOMER = new CUSTOMER();
     cUSTOMER.CUSTOMER_ID = cUSTOMER_ID;
     cUSTOMER.CUSTOMER_NAME = cUSTOMER_NAME;
     return cUSTOMER;
 }
Ejemplo n.º 4
0
        public ActionResult Edit(int id, CUSTOMER model)
        {
            try
            {
                CUSTOMER customer = etMgr.CUSTOMER.FirstOrDefault(x => x.CUSTOMER_ID == id);
                customer.CUSTOMER_NAME = model.CUSTOMER_NAME;
                customer.TEL = model.TEL;
                customer.REMARK = model.REMARK;
                customer.ADDRESS = model.ADDRESS;
                customer.CORPERATION = model.CORPERATION;
                customer.CREATE_TIME = DateTime.Now;
                customer.CUSTOM_TYPE = 0;
                customer.EMAIL = model.EMAIL;
                customer.FAX = model.FAX;
                customer.LINKMAN = model.LINKMAN;
                customer.MOBILE = model.MOBILE;
                customer.POSTCODE = model.POSTCODE;
                customer.QQ = model.QQ;
                customer.SERVICE_USER = model.SERVICE_USER;
                customer.SEX = model.SEX;
                customer.UPDATE_TIME = DateTime.Now;
                customer.USER_STATE = 1;
                customer.USER_FROM = 1;
                customer.WEBURL = model.WEBURL;

                int reVal= etMgr.SaveChanges();
                if (reVal > 0)
                {
                    return RedirectToAction("CusList");
                }
                else
                {
                    return RedirectToAction("Edit");
                }
            }
            catch
            {
                return View();
            }
        }