示例#1
0
 public int InsertAreaFact(AreaFactModel areafact)
 {
     SqlParameter[] param = { new SqlParameter("@FactName", SqlDbType.VarChar, 50), new SqlParameter("@MainHead", SqlDbType.VarChar, 20),
                              new SqlParameter("@Tel",SqlDbType.VarChar,13),new SqlParameter("@TypeID",SqlDbType.Int),new SqlParameter("@Memo",SqlDbType.Text)
                            };
     param[0].Value = areafact.FactName;
     param[1].Value = areafact.MainHead;
     param[2].Value = areafact.Tel;
     param[3].Value = areafact.TypeID;
     param[4].Value = areafact.Memo;
     int result = SqlHelp.ExecuteNonQuery("prc_InsertAreaFact", CommandType.StoredProcedure, param);
     return result;
 }
示例#2
0
 public List<AreaFactModel> ShowAllAreafact()
 {
     SqlDataReader dr= SqlHelp.ExecuteReader("prc_ShowAllAreafact", CommandType.StoredProcedure);            
     List<AreaFactModel> list = new List<AreaFactModel>();
     while (dr.Read())
     {
         AreaFactModel arefact = new AreaFactModel();                
         arefact.ID = Convert.ToInt32(dr[0]);
         arefact.FactName = dr[1].ToString();
         arefact.MainHead = dr[2].ToString();
         arefact.Tel = dr[3].ToString();
         arefact.Memo = dr[5].ToString();
         arefact.TypeName = dr[6].ToString();                
         list.Add(arefact);
     }
     dr.Close();
     return list;
 }
示例#3
0
 protected void Add_Click(object sender, EventArgs e)
 {
     AreaFactModel areafact = new AreaFactModel();
     areafact.FactName = txtFactName.Text.Trim();
     areafact.MainHead = txtMainHead.Text.Trim();
     areafact.TypeID = Convert.ToInt32(DDLAreaType.SelectedValue);
     areafact.Tel = txtTelphone.Text.Trim();
     areafact.Memo = ftbMemo.Text.Trim();
     bool flag = afbll.InsertAreaFact(areafact);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加成功');location.href='BaseInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加失败');</script>");
     }
 }
示例#4
0
 public AreaFactModel GetAreaFactByID(int id)
 {
     SqlParameter param = new SqlParameter("@ID", SqlDbType.Int);
     param.Value = id;
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetAreaFactByID", CommandType.StoredProcedure,param);
     AreaFactModel areafact = new AreaFactModel();
     dr.Read();
     if (dr.HasRows)
     {
         areafact.ID = Convert.ToInt32(dr[0]);
         areafact.FactName = dr[1].ToString();
         areafact.MainHead = dr[2].ToString();
         areafact.Tel = dr[3].ToString();
         areafact.Memo = dr[5].ToString();
         areafact.TypeName = dr[6].ToString();
     }
     dr.Close();
     return areafact;
 }
示例#5
0
 protected void Edit_Click(object sender, EventArgs e)
 {
     AreaFactModel areafact = new AreaFactModel();
     areafact.FactName = txtFactName.Text.Trim();
     areafact.MainHead = txtMainHead.Text.Trim();
     areafact.TypeID = Convert.ToInt32(DDLAreaType.SelectedValue);
     areafact.Tel = txtTelphone.Text.Trim();
     areafact.Memo = ftbMemo.Text.Trim();
     areafact.ID = int.Parse(Request.QueryString["ID"]);
     bool flag = afbll.UpdateAreaFact(areafact);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改成功');location.href='AreaFactInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改失败');</script>");
     }
 }
示例#6
0
 public List<AreaFactModel> GetAreaFactByCondition(string condition)
 {
     SqlParameter param = new SqlParameter("@Condition", SqlDbType.VarChar,255);
     param.Value = condition;
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetAreaFactByCondition", CommandType.StoredProcedure, param);
     List<AreaFactModel> list = new List<AreaFactModel>();
     while (dr.Read())
     {
         AreaFactModel arefact = new AreaFactModel();
         arefact.ID = Convert.ToInt32(dr[0]);
         arefact.FactName = dr[1].ToString();
         arefact.MainHead = dr[2].ToString();
         arefact.Tel = dr[3].ToString();
         arefact.Memo = dr[5].ToString();
         arefact.TypeName = dr[6].ToString();
         list.Add(arefact);
     }
     dr.Close();
     return list;
 }
示例#7
0
 public bool UpdateAreaFact(AreaFactModel areafact)
 {
     int result = dal.UpdateAreaFact(areafact);
     return result == 0 ? false : true;
 }
示例#8
0
 public bool InsertAreaFact(AreaFactModel areafact)
 {
     int result = dal.InsertAreaFact(areafact);
     return result == 0 ? false : true;
 }