public void Add1()
 {
     try
     {
         T_Infor_Indent model = new T_Infor_Indent()
         {
             //ICode = Convert.ToInt64(Request.Form["Code"]),
             IContent        = Request.Form["Content"],
             ISigningDate    = Convert.ToDateTime(Request.Form["SigningDate"]),
             IExpirationDate = Convert.ToDateTime(Request.Form["ExpirationDate"]),
             IDeliveryDate   = Convert.ToDateTime(Request.Form["DeliveryDate"]),
             IRemarks        = Request.Form["Remarks"],
             IState          = Convert.ToInt32(Request.Form["State"])
         };
         //查询ICode最大值
         long maxcode = db.T_Infor_Indent.Select(o => o.ICode).Max();
         model.ICode = ++maxcode;
         db.T_Infor_Indent.Add(model);
         int res = db.SaveChanges();
         if (res == 1)
         {
             Response.Write("<script>alert('添加成功!'); window.location='/Indent/Main/1'</script>");
         }
     }
     catch (Exception)
     {
         Response.Write("<script>alert('出现错误!'); window.location='/Indent/Main/1'</script>");
     }
 }
        public void Modify()
        {
            string         date  = "20" + Request.Form["IDeliveryDate"].Trim() + ":00";
            T_Infor_Indent model = new T_Infor_Indent()
            {
                Iid           = Convert.ToInt32(Request.Form["Iid"]),
                IDeliveryDate = Convert.ToDateTime(Request.Form["IDeliveryDate"].Trim() + ":00"),
                IState        = Convert.ToInt32(Request.Form["IState"]),
                IRemarks      = Request.Form["IRemarks"]
            };
            DbEntityEntry <T_Infor_Indent> entry = db.Entry <T_Infor_Indent>(model);

            entry.State = EntityState.Unchanged;
            entry.Property("IState").IsModified        = true;
            entry.Property("IDeliveryDate").IsModified = true;
            entry.Property("IRemarks").IsModified      = true;
            int res = db.SaveChanges();

            if (res == 1)
            {
                Response.Write("<script>alert('修改成功!');window.location='/Indent/Main/1'</script>");
            }
            else
            {
                Response.Write("<script>alert('修改失败!');window.location='/Indent/Main/1'</script>");
            }
        }
Exemple #3
0
        public void Add(T_Infor_Indent model)
        {
            //查询ICode最大值
            long maxcode = Handle.db.T_Infor_Indent.Select(c => c.ICode).Max();

            model.ICode = maxcode;
            int res = Handle.Add(model);

            if (res == 1)
            {
                Response.Write("<script>alert('添加成功!'); window.location='/Indent/Main/1'</script>");
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        public void Delete(int id)
        {
            T_Infor_Indent indent = new T_Infor_Indent()
            {
                Iid = id
            };
            DbEntityEntry <T_Infor_Indent> entry = db.Entry <T_Infor_Indent>(indent);

            entry.State = EntityState.Deleted;
            int res = db.SaveChanges();

            if (res == 1)
            {
                Response.Write("<script>alert('删除成功!'); window.location='/Indent/Main/1';</script>");
            }
        }
Exemple #5
0
        public void Modify()
        {
            //string date = "20" + Request.Form["IDeliveryDate"].Trim() + ":00";
            T_Infor_Indent model = new T_Infor_Indent()
            {
                Iid           = Convert.ToInt32(Request.Form["Iid"]),
                IDeliveryDate = Convert.ToDateTime(Request.Form["IDeliveryDate"].Trim() + ":00"),
                IState        = Convert.ToInt32(Request.Form["IState"]),
                IRemarks      = Request.Form["IRemarks"]
            };
            int res = Handle.Modify(model, "Iid", "IDeliveryDate", "IState", "IRemarks");

            if (res == 1)
            {
                Response.Write("<script>alert('修改成功!');window.location='/Indent/Main/1'</script>");
            }
            else
            {
                Response.Write("<script>alert('修改失败!');window.location='/Indent/Main/1'</script>");
            }
        }