Esempio n. 1
0
 public Maticsoft.Model.Shop.Package.PackageCategory DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Shop.Package.PackageCategory category = new Maticsoft.Model.Shop.Package.PackageCategory();
     if (row != null)
     {
         if ((row["CategoryId"] != null) && (row["CategoryId"].ToString() != ""))
         {
             category.CategoryId = int.Parse(row["CategoryId"].ToString());
         }
         if ((row["Name"] != null) && (row["Name"].ToString() != ""))
         {
             category.Name = row["Name"].ToString();
         }
         if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != ""))
         {
             category.CreatedDate = new DateTime?(DateTime.Parse(row["CreatedDate"].ToString()));
         }
         if ((row["Status"] != null) && (row["Status"].ToString() != ""))
         {
             category.Status = new int?(int.Parse(row["Status"].ToString()));
         }
         if ((row["Remark"] != null) && (row["Remark"].ToString() != ""))
         {
             category.Remark = row["Remark"].ToString();
         }
     }
     return category;
 }
Esempio n. 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str = this.txtName.Text.Trim();
     if (str.Length == 0)
     {
         MessageBox.ShowServerBusyTip(this, "包装类型的名称不能为空!");
     }
     else
     {
         string str2 = this.txtRemark.Text.Trim();
         if (str2.Length > 200)
         {
             MessageBox.ShowServerBusyTip(this, "备注不能超过200个字符!");
         }
         else
         {
             Maticsoft.Model.Shop.Package.PackageCategory model = new Maticsoft.Model.Shop.Package.PackageCategory {
                 Name = str,
                 Remark = str2
             };
             Maticsoft.BLL.Shop.Package.PackageCategory category2 = new Maticsoft.BLL.Shop.Package.PackageCategory();
             int num = category2.Add(model);
             if (num > 0)
             {
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加包装类型(id=" + num + ")成功", this);
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK, "CategoryList.aspx");
                 base.Response.Redirect("CategoryList.aspx");
             }
             else
             {
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加包装类型(id=" + num + ")失败", this);
                 MessageBox.ShowServerBusyTip(this, Site.TooltipSaveError);
             }
         }
     }
 }