Ejemplo n.º 1
0
 public Maticsoft.Model.SNS.AlbumType DataRowToModel(DataRow row)
 {
     Maticsoft.Model.SNS.AlbumType type = new Maticsoft.Model.SNS.AlbumType();
     if (row != null)
     {
         if ((row["ID"] != null) && (row["ID"].ToString() != ""))
         {
             type.ID = int.Parse(row["ID"].ToString());
         }
         if ((row["TypeName"] != null) && (row["TypeName"].ToString() != ""))
         {
             type.TypeName = row["TypeName"].ToString();
         }
         if ((row["IsMenu"] != null) && (row["IsMenu"].ToString() != ""))
         {
             if ((row["IsMenu"].ToString() == "1") || (row["IsMenu"].ToString().ToLower() == "true"))
             {
                 type.IsMenu = true;
             }
             else
             {
                 type.IsMenu = false;
             }
         }
         if ((row["MenuIsShow"] != null) && (row["MenuIsShow"].ToString() != ""))
         {
             if ((row["MenuIsShow"].ToString() == "1") || (row["MenuIsShow"].ToString().ToLower() == "true"))
             {
                 type.MenuIsShow = true;
             }
             else
             {
                 type.MenuIsShow = false;
             }
         }
         if ((row["MenuSequence"] != null) && (row["MenuSequence"].ToString() != ""))
         {
             type.MenuSequence = int.Parse(row["MenuSequence"].ToString());
         }
         if ((row["AlbumsCount"] != null) && (row["AlbumsCount"].ToString() != ""))
         {
             type.AlbumsCount = new int?(int.Parse(row["AlbumsCount"].ToString()));
         }
         if ((row["Status"] != null) && (row["Status"].ToString() != ""))
         {
             type.Status = int.Parse(row["Status"].ToString());
         }
         if ((row["Remark"] != null) && (row["Remark"].ToString() != ""))
         {
             type.Remark = row["Remark"].ToString();
         }
     }
     return type;
 }
Ejemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str = this.txtTypeName.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.SNS.AlbumType model = new Maticsoft.Model.SNS.AlbumType {
                 TypeName = str,
                 IsMenu = this.chkIsMenu.Checked,
                 MenuIsShow = this.chkMenuIsShow.Checked,
                 MenuSequence = Globals.SafeInt(this.txtMenuSequence.Text, 1),
                 AlbumsCount = new int?(Globals.SafeInt(this.txtAlbumsCount.Text, 1)),
                 Status = Globals.SafeInt(this.radlStatus.SelectedValue, 0),
                 Remark = str2
             };
             Maticsoft.BLL.SNS.AlbumType type2 = new Maticsoft.BLL.SNS.AlbumType();
             int num = type2.Add(model);
             if (num > 0)
             {
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加专辑类型(id=" + num + ")成功", this);
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK, "TypeList.aspx");
             }
             else
             {
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加专辑类型(id=" + num + ")失败", this);
                 MessageBox.ShowServerBusyTip(this, Site.TooltipSaveError);
             }
         }
     }
 }