Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (idInspect != 0)//修改
         {
             btn_Add.Text = "确认修改";
             //回填
             try
             {
                 Inspect ins = Inspect.FindById(idInspect);
                 input_RegisterDate.Value = DateTime.Compare((DateTime)ins.Time, new DateTime(1900, 1, 1)) > 0 ? ((DateTime)ins.Time).ToString("yyyy/MM/dd") : "";
                 TextBox1.Text            = ins.Unit;
                 tb_PublishPeriod.Text    = ins.Result;
                 if (!ins.PhotoName.IsNullOrEmpty())
                 {
                     hide_PhotoName.Value = ins.PhotoName;
                     Photo.ImageUrl       = "../../upload/photos/" + ins.PhotoName;
                 }
             }
             catch (Exception ex)
             {
                 text(ex.ToString());
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true);
             }
         }
     }
 }
Example #2
0
 public static bool DeleteInspect(int inspectId)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             Inspect st  = Inspect.FindById(inspectId);
             st.IsDelete = true;
             st.Save();
         });
     }
     catch { return(false); }
     return(true);
 }
Example #3
0
 public static bool UpdateInspect(int inspectId, DateTime time, string unit, string result, string photoName)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             Inspect st   = Inspect.FindById(inspectId);
             st.Time      = time;
             st.Unit      = unit;
             st.Result    = result;
             st.PhotoName = photoName;
             st.Save();
         });
     }
     catch { return(false); }
     return(true);
 }