Exemplo n.º 1
0
 protected void EBtnSubmit_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         M_ModelInfo info = new M_ModelInfo();
         info.ModelID = DataConverter.CLng(this.HdnModelId.Value);
         info.ModelName = this.TxtModelName.Text;
         if (info.ModelID > 0)
         {
             info.TableName = this.TxtTableName.Text;
         }
         else
         {
             info.TableName = this.LblTablePrefix.Text + this.TxtTableName.Text;
         }
         info.ItemName = this.TxtItemName.Text;
         info.ItemUnit = this.TxtItemUnit.Text;
         info.ItemIcon = this.TxtItemIcon.Text;
         info.Description = this.TxtDescription.Text;
         info.ModelType = 1;
         if (info.ModelID == 0)
         {
             if (this.bll.AddModel(info))
                 Response.Redirect("ModelManage.aspx");
         }
         else
         {
             if (this.bll.UpdateModel(info))
                 Response.Redirect("ModelManage.aspx");
         }
     }
 }
Exemplo n.º 2
0
 protected void EBtnSubmit_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         M_ModelInfo info = new M_ModelInfo();
         info.ModelID = DataConverter.CLng(this.HdnModelId.Value);
         info.ModelName = this.TxtModelName.Text.Trim();
         if (info.ModelID > 0)
             info.TableName = this.TxtTableName.Text.Trim();
         else
             info.TableName = this.LblTablePrefix.Text + this.TxtTableName.Text.Trim();
         info.Description = this.TxtDescription.Text.Trim();
         info.ModelType = 3;
         info.ItemName = "";
         info.ItemIcon = "";
         info.ItemUnit = "";
         info.ContentModule = "";
         if (info.ModelID > 0)
             this.bll.UpdateModel(info);
         else
             this.bll.AddUserModel(info);
         Response.Redirect("UserModelManage.aspx");
     }
 }
Exemplo n.º 3
0
 public bool UpdateModel(M_ModelInfo info)
 {
     return dal.Update(info);
 }
Exemplo n.º 4
0
 public bool AddUserModel(M_ModelInfo info)
 {
     return dal.AddUserModel(info);
 }
Exemplo n.º 5
0
 public bool AddModel(M_ModelInfo info)
 {
     return dal.Add(info);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 添加会员模型
 /// </summary>
 /// <param name="ModelInfo"></param>
 /// <returns></returns>
 bool ID_Model.AddUserModel(M_ModelInfo ModelInfo)
 {
     string strSql = "PR_UserModel_Add";
     SqlParameter[] cmdParams = GetParameters(ModelInfo);
     return SqlHelper.ExecuteProc(strSql, cmdParams);
 }
Exemplo n.º 7
0
 /// <summary>
 /// 将模型信息的各属性值传递到参数中
 /// </summary>
 /// <param name="Info"></param>
 /// <returns></returns>
 private static SqlParameter[] GetParameters(M_ModelInfo Info)
 {
     SqlParameter[] parameter = new SqlParameter[] {
         new SqlParameter("@ModelID", SqlDbType.Int, 4),
         new SqlParameter("@ModelName", SqlDbType.NVarChar, 20),
         new SqlParameter("@Description", SqlDbType.NVarChar, 255),
         new SqlParameter("@TableName", SqlDbType.NVarChar, 50),
         new SqlParameter("@ItemName", SqlDbType.NVarChar, 50),
         new SqlParameter("@ItemUnit", SqlDbType.NVarChar, 50),
         new SqlParameter("@ItemIcon", SqlDbType.NVarChar, 50),
         new SqlParameter("@ModelType",SqlDbType.Int)
     };
     parameter[0].Value = Info.ModelID;
     parameter[1].Value = Info.ModelName;
     parameter[2].Value = Info.Description;
     parameter[3].Value = Info.TableName;
     parameter[4].Value = Info.ItemName;
     parameter[5].Value = Info.ItemUnit;
     parameter[6].Value = Info.ItemIcon;
     parameter[7].Value = Info.ModelType;
     return parameter;
 }
Exemplo n.º 8
0
 /// <summary>
 /// 从DataReader中读取模型记录
 /// </summary>
 /// <param name="rdr">DataReader</param>
 /// <returns>M_ModelInfo 模型信息</returns>
 private static M_ModelInfo GetModelFromReader(SqlDataReader rdr)
 {
     M_ModelInfo info = new M_ModelInfo();
     info.ModelID = DataConverter.CLng(rdr["ModelID"].ToString());
     info.ModelName = rdr["ModelName"].ToString();
     info.Description = rdr["Description"].ToString();
     info.TableName = rdr["TableName"].ToString();
     info.ItemName = rdr["ItemName"].ToString();
     info.ItemUnit = rdr["ItemUnit"].ToString();
     info.ItemIcon = rdr["ItemIcon"].ToString();
     info.ContentModule = rdr["ContentTemplate"].ToString();
     info.ModelType = DataConverter.CLng(rdr["ModelType"].ToString());
     return info;
 }