コード例 #1
0
 protected void uiButtonUpdate_Click(object sender, EventArgs e)
 {
     DBLayer db = new DBLayer();
     string temp = "";
     string filepath = "";
     DataSet ds = new DataSet();
     if (uiFileUploadPicture.HasFile)
     {
         uiFileUploadPicture.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["OutstandingFilePath"] + uiFileUploadPicture.FileName));
         filepath = ConfigurationManager.AppSettings["OutstandingFilePath"].Substring(1) + uiFileUploadPicture.FileName;
     }
     ds = db.GetOutstanding(CurrentOutStanding);
     if (ds.Tables[0].Rows.Count > 0)
     {
         temp = ds.Tables[0].Rows[0]["PicturePath"].ToString();
     }
     if (CurrentOutStanding != 0)
     {
         if (temp != filepath && string.IsNullOrEmpty(filepath))
             db.UpdateOutstanding(CurrentOutStanding, uiTextBoxEnName.Text, uiTextBoxArName.Text, temp, DateTime.Now, Convert.ToInt32(uiDropDownListClass.SelectedValue), Server.HtmlEncode(uiFCKeditorEnComment.Value), Server.HtmlEncode(uiFCKeditorArComment.Value));
         else
             db.UpdateOutstanding(CurrentOutStanding, uiTextBoxEnName.Text, uiTextBoxArName.Text, filepath, DateTime.Now, Convert.ToInt32(uiDropDownListClass.SelectedValue), Server.HtmlEncode(uiFCKeditorEnComment.Value), Server.HtmlEncode(uiFCKeditorArComment.Value));
     }
     else
     {
         db.AddOutStanding(uiTextBoxEnName.Text, uiTextBoxArName.Text, filepath, DateTime.Now, Convert.ToInt32(uiDropDownListClass.SelectedValue), Server.HtmlEncode(uiFCKeditorEnComment.Value), Server.HtmlEncode(uiFCKeditorArComment.Value));
     }
     CurrentOutStanding = 0;
     uiPanelCurrentOutStanding.Visible = true;
     uiPanelCurrent.Visible = false;
     BindData();
 }