public Maticsoft.Model.SNS.StarType DataRowToModel(DataRow row) { Maticsoft.Model.SNS.StarType type = new Maticsoft.Model.SNS.StarType(); if (row != null) { if ((row["TypeID"] != null) && (row["TypeID"].ToString() != "")) { type.TypeID = int.Parse(row["TypeID"].ToString()); } if (row["TypeName"] != null) { type.TypeName = row["TypeName"].ToString(); } if (row["CheckRule"] != null) { type.CheckRule = row["CheckRule"].ToString(); } if (row["Remark"] != null) { type.Remark = row["Remark"].ToString(); } if ((row["Status"] != null) && (row["Status"].ToString() != "")) { type.Status = new int?(int.Parse(row["Status"].ToString())); } } return type; }
protected void btnSave_Click(object sender, EventArgs e) { string msg = ""; if (this.txtTypeName.Text.Trim().Length == 0) { msg = msg + @"达人类型(如新晋达人不能为空!\n"; } if (msg != "") { MessageBox.Show(this, msg); } else { string text = this.txtTypeName.Text; string str3 = this.txtCheckRule.Text; string str4 = this.txtRemark.Text; int num = Globals.SafeInt(this.radlStatus.SelectedValue, 0); Maticsoft.Model.SNS.StarType model = new Maticsoft.Model.SNS.StarType { TypeName = text, CheckRule = str3, Remark = str4, Status = new int?(num) }; Maticsoft.BLL.SNS.StarType type2 = new Maticsoft.BLL.SNS.StarType(); int num2 = 0; num2 = type2.Add(model); if (num2 > 0) { LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "增加达人类型(ID=" + num2 + ")成功", this); MessageBox.ShowSuccessTip(this, "保存成功!", "StarTypeList.aspx"); } } }