Beispiel #1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Maticsoft.Model.Tao.UsersApprove> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.Tao.UsersApprove> modelList = new List<Maticsoft.Model.Tao.UsersApprove>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Maticsoft.Model.Tao.UsersApprove model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Maticsoft.Model.Tao.UsersApprove();
             if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
             {
                 model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
             }
             if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
             {
                 model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
             }
             if (dt.Rows[n]["ApproveType"] != null && dt.Rows[n]["ApproveType"].ToString() != "")
             {
                 model.ApproveType = int.Parse(dt.Rows[n]["ApproveType"].ToString());
             }
             if (dt.Rows[n]["ImgURL"] != null && dt.Rows[n]["ImgURL"].ToString() != "")
             {
                 model.ImgURL = dt.Rows[n]["ImgURL"].ToString();
             }
             if (dt.Rows[n]["CreatedDate"] != null && dt.Rows[n]["CreatedDate"].ToString() != "")
             {
                 model.CreatedDate = DateTime.Parse(dt.Rows[n]["CreatedDate"].ToString());
             }
             if (dt.Rows[n]["Status"] != null && dt.Rows[n]["Status"].ToString() != "")
             {
                 model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
             }
             if (dt.Rows[n]["ApprovedTime"] != null && dt.Rows[n]["ApprovedTime"].ToString() != "")
             {
                 model.ApprovedTime = DateTime.Parse(dt.Rows[n]["ApprovedTime"].ToString());
             }
             if (dt.Rows[n]["ApprovedUserID"] != null && dt.Rows[n]["ApprovedUserID"].ToString() != "")
             {
                 model.ApprovedUserID = int.Parse(dt.Rows[n]["ApprovedUserID"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Beispiel #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(ddlUserID.SelectedValue.Trim()) &&
        !string.IsNullOrEmpty(ddlApproveType.SelectedValue.Trim()) &&
        !string.IsNullOrEmpty(ddlStatus.SelectedValue.Trim())
         )
     {
         this.lblUserID.Text = "";
         if ("0" == ddlUserID.SelectedValue.Trim())
         {
             this.lblUserID.Text = "*请选择用户!";
             return;
         }
         this.lblApproveType.Text = "";
         if ("0" == ddlApproveType.SelectedValue.Trim())
         {
             this.lblApproveType.Text = "*请选择认证资料类型!";
             return;
         }
         this.lblStatus.Text = "";
         if ("-1" == ddlStatus.SelectedValue.Trim())
         {
             this.lblStatus.Text = "*请选择审核状态!";
             return;
         }
         this.lblfileImgURL.Text = "";
         if (string.IsNullOrEmpty(UploadImage(fileImgURL, 2)))
         {
             this.lblfileImgURL.Text = "*请选择上传认证资料!";
             return;
         }
         Maticsoft.Model.Tao.UsersApprove model = new Maticsoft.Model.Tao.UsersApprove();
         model.UserID = int.Parse(ddlUserID.SelectedValue);
         model.ApproveType = int.Parse(ddlApproveType.SelectedValue);
         model.ImgURL = UploadImage(fileImgURL, 2);
         model.CreatedDate = System.DateTime.Now;
         model.Status = int.Parse(ddlStatus.SelectedValue);
         model.ApprovedTime = System.DateTime.Now;
         model.ApprovedUserID = CurrentUser.UserID;
         UsersApproveBLL.Add(model);
         Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "List.aspx");
     }
 }