/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.tb_churu model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_churu set "); if (model.cr_oid != null) { strSql.Append("cr_oid=" + model.cr_oid + ","); } else { strSql.Append("cr_oid= null ,"); } if (model.cr_pid != null) { strSql.Append("cr_pid=" + model.cr_pid + ","); } else { strSql.Append("cr_pid= null ,"); } if (model.cr_time != null) { strSql.Append("cr_time='" + model.cr_time + "',"); } else { strSql.Append("cr_time= null ,"); } if (model.cr_type != null) { strSql.Append("cr_type=" + model.cr_type + ","); } else { strSql.Append("cr_type= null ,"); } if (model.cr_num != null) { strSql.Append("cr_num=" + model.cr_num + ","); } else { strSql.Append("cr_num= null ,"); } if (model.cr_yan != null) { strSql.Append("cr_yan=" + model.cr_yan + ","); } else { strSql.Append("cr_yan= null ,"); } if (model.cr_price != null) { strSql.Append("cr_price=" + model.cr_price + ","); } else { strSql.Append("cr_price= null ,"); } if (model.cr_remark != null) { strSql.Append("cr_remark='" + model.cr_remark + "',"); } else { strSql.Append("cr_remark= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where cr_id=" + model.cr_id + ""); int rowsAffected = DbSQL.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到最大ID /// </summary> public int GetMaxId() { return(DbSQL.GetMaxID("p_id", "tb_pan")); }
/// <summary> /// 得到最大ID /// </summary> public int GetMaxId() { return(DbSQL.GetMaxID("t_id", "tb_type")); }
/// <summary> /// 得到最大ID /// </summary> public int GetMaxId() { return(DbSQL.GetMaxID("k_id", "tb_ku")); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.tb_pan model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_pan set "); if (model.p_pid != null) { strSql.Append("p_pid=" + model.p_pid + ","); } else { strSql.Append("p_pid= null ,"); } if (model.p_time != null) { strSql.Append("p_time='" + model.p_time + "',"); } else { strSql.Append("p_time= null ,"); } if (model.p_user != null) { strSql.Append("p_user='******',"); } else { strSql.Append("p_user= null ,"); } if (model.p_numold != null) { strSql.Append("p_numold=" + model.p_numold + ","); } else { strSql.Append("p_numold= null ,"); } if (model.p_numnow != null) { strSql.Append("p_numnow=" + model.p_numnow + ","); } else { strSql.Append("p_numnow= null ,"); } if (model.p_remark != null) { strSql.Append("p_remark='" + model.p_remark + "',"); } else { strSql.Append("p_remark= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where p_id=" + model.p_id + ""); int rowsAffected = DbSQL.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
public Model.tb_user GetModel(string log, string pwd) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 "); strSql.Append(" u_id,u_log,u_pwd,u_no,u_name,u_tel,u_email,u_type,u_sex,u_address,u_adddate "); strSql.Append(" from tb_user "); strSql.Append(" where u_log='" + log + "' and u_pwd='" + pwd + "' "); Model.tb_user model = new Model.tb_user(); DataSet ds = DbSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["u_id"] != null && ds.Tables[0].Rows[0]["u_id"].ToString() != "") { model.u_id = int.Parse(ds.Tables[0].Rows[0]["u_id"].ToString()); } if (ds.Tables[0].Rows[0]["u_log"] != null && ds.Tables[0].Rows[0]["u_log"].ToString() != "") { model.u_log = ds.Tables[0].Rows[0]["u_log"].ToString(); } if (ds.Tables[0].Rows[0]["u_pwd"] != null && ds.Tables[0].Rows[0]["u_pwd"].ToString() != "") { model.u_pwd = ds.Tables[0].Rows[0]["u_pwd"].ToString(); } if (ds.Tables[0].Rows[0]["u_no"] != null && ds.Tables[0].Rows[0]["u_no"].ToString() != "") { model.u_no = ds.Tables[0].Rows[0]["u_no"].ToString(); } if (ds.Tables[0].Rows[0]["u_name"] != null && ds.Tables[0].Rows[0]["u_name"].ToString() != "") { model.u_name = ds.Tables[0].Rows[0]["u_name"].ToString(); } if (ds.Tables[0].Rows[0]["u_tel"] != null && ds.Tables[0].Rows[0]["u_tel"].ToString() != "") { model.u_tel = ds.Tables[0].Rows[0]["u_tel"].ToString(); } if (ds.Tables[0].Rows[0]["u_email"] != null && ds.Tables[0].Rows[0]["u_email"].ToString() != "") { model.u_email = ds.Tables[0].Rows[0]["u_email"].ToString(); } if (ds.Tables[0].Rows[0]["u_type"] != null && ds.Tables[0].Rows[0]["u_type"].ToString() != "") { model.u_type = int.Parse(ds.Tables[0].Rows[0]["u_type"].ToString()); } if (ds.Tables[0].Rows[0]["u_sex"] != null && ds.Tables[0].Rows[0]["u_sex"].ToString() != "") { model.u_sex = ds.Tables[0].Rows[0]["u_sex"].ToString(); } if (ds.Tables[0].Rows[0]["u_address"] != null && ds.Tables[0].Rows[0]["u_address"].ToString() != "") { model.u_address = ds.Tables[0].Rows[0]["u_address"].ToString(); } if (ds.Tables[0].Rows[0]["u_adddate"] != null && ds.Tables[0].Rows[0]["u_adddate"].ToString() != "") { model.u_adddate = ds.Tables[0].Rows[0]["u_adddate"].ToString(); } return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.tb_user model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.u_log != null) { strSql1.Append("u_log,"); strSql2.Append("'" + model.u_log + "',"); } if (model.u_pwd != null) { strSql1.Append("u_pwd,"); strSql2.Append("'" + model.u_pwd + "',"); } if (model.u_no != null) { strSql1.Append("u_no,"); strSql2.Append("'" + model.u_no + "',"); } if (model.u_name != null) { strSql1.Append("u_name,"); strSql2.Append("'" + model.u_name + "',"); } if (model.u_tel != null) { strSql1.Append("u_tel,"); strSql2.Append("'" + model.u_tel + "',"); } if (model.u_email != null) { strSql1.Append("u_email,"); strSql2.Append("'" + model.u_email + "',"); } if (model.u_type != null) { strSql1.Append("u_type,"); strSql2.Append("" + model.u_type + ","); } if (model.u_sex != null) { strSql1.Append("u_sex,"); strSql2.Append("'" + model.u_sex + "',"); } if (model.u_address != null) { strSql1.Append("u_address,"); strSql2.Append("'" + model.u_address + "',"); } if (model.u_adddate != null) { strSql1.Append("u_adddate,"); strSql2.Append("'" + model.u_adddate + "',"); } strSql.Append("insert into tb_user("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); strSql.Append(";select @@IDENTITY"); object obj = DbSQL.GetSingle(strSql.ToString()); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.tb_user model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_user set "); if (model.u_log != null) { strSql.Append("u_log='" + model.u_log + "',"); } else { strSql.Append("u_log= null ,"); } if (model.u_pwd != null) { strSql.Append("u_pwd='" + model.u_pwd + "',"); } else { strSql.Append("u_pwd= null ,"); } if (model.u_no != null) { strSql.Append("u_no='" + model.u_no + "',"); } else { strSql.Append("u_no= null ,"); } if (model.u_name != null) { strSql.Append("u_name='" + model.u_name + "',"); } else { strSql.Append("u_name= null ,"); } if (model.u_tel != null) { strSql.Append("u_tel='" + model.u_tel + "',"); } else { strSql.Append("u_tel= null ,"); } if (model.u_email != null) { strSql.Append("u_email='" + model.u_email + "',"); } else { strSql.Append("u_email= null ,"); } if (model.u_type != null) { strSql.Append("u_type=" + model.u_type + ","); } else { strSql.Append("u_type= null ,"); } if (model.u_sex != null) { strSql.Append("u_sex='" + model.u_sex + "',"); } else { strSql.Append("u_sex= null ,"); } if (model.u_address != null) { strSql.Append("u_address='" + model.u_address + "',"); } else { strSql.Append("u_address= null ,"); } if (model.u_adddate != null) { strSql.Append("u_adddate='" + model.u_adddate + "',"); } else { strSql.Append("u_adddate= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where u_id=" + model.u_id + ""); int rowsAffected = DbSQL.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到最大ID /// </summary> public int GetMaxId() { return(DbSQL.GetMaxID("u_id", "tb_user")); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.tb_proc model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.p_no != null) { strSql1.Append("p_no,"); strSql2.Append("'" + model.p_no + "',"); } if (model.p_name != null) { strSql1.Append("p_name,"); strSql2.Append("'" + model.p_name + "',"); } if (model.p_tyid != null) { strSql1.Append("p_tyid,"); strSql2.Append("" + model.p_tyid + ","); } if (model.p_pinpai != null) { strSql1.Append("p_pinpai,"); strSql2.Append("'" + model.p_pinpai + "',"); } if (model.p_model != null) { strSql1.Append("p_model,"); strSql2.Append("'" + model.p_model + "',"); } if (model.p_shang != null) { strSql1.Append("p_shang,"); strSql2.Append("'" + model.p_shang + "',"); } if (model.p_price != null) { strSql1.Append("p_price,"); strSql2.Append("'" + model.p_price + "',"); } if (model.p_unit != null) { strSql1.Append("p_unit,"); strSql2.Append("'" + model.p_unit + "',"); } if (model.p_sx != null) { strSql1.Append("p_sx,"); strSql2.Append("'" + model.p_sx + "',"); } if (model.p_xx != null) { strSql1.Append("p_xx,"); strSql2.Append("'" + model.p_xx + "',"); } if (model.p_desc != null) { strSql1.Append("p_desc,"); strSql2.Append("'" + model.p_desc + "',"); } if (model.p_addtime != null) { strSql1.Append("p_addtime,"); strSql2.Append("'" + model.p_addtime + "',"); } if (model.p_ckid != null) { strSql1.Append("p_ckid,"); strSql2.Append("" + model.p_ckid + ","); } if (model.p_kqid != null) { strSql1.Append("p_kqid,"); strSql2.Append("" + model.p_kqid + ","); } if (model.p_num != null) { strSql1.Append("p_num,"); strSql2.Append("" + model.p_num + ","); } if (model.p_rzfid != null) { strSql1.Append("p_rzfid,"); strSql2.Append("" + model.p_rzfid + ","); } strSql.Append("insert into tb_proc("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); strSql.Append(";select @@IDENTITY"); object obj = DbSQL.GetSingle(strSql.ToString()); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.tb_proc GetModel(int p_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 "); strSql.Append(" p_id,p_no,p_name,p_tyid,p_pinpai,p_model,p_shang,p_price,p_unit,p_sx,p_xx,p_desc,p_addtime,p_ckid,p_kqid,p_num,p_rzfid "); strSql.Append(" from tb_proc "); strSql.Append(" where p_id=" + p_id + ""); Model.tb_proc model = new Model.tb_proc(); DataSet ds = DbSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["p_id"] != null && ds.Tables[0].Rows[0]["p_id"].ToString() != "") { model.p_id = int.Parse(ds.Tables[0].Rows[0]["p_id"].ToString()); } if (ds.Tables[0].Rows[0]["p_no"] != null && ds.Tables[0].Rows[0]["p_no"].ToString() != "") { model.p_no = ds.Tables[0].Rows[0]["p_no"].ToString(); } if (ds.Tables[0].Rows[0]["p_name"] != null && ds.Tables[0].Rows[0]["p_name"].ToString() != "") { model.p_name = ds.Tables[0].Rows[0]["p_name"].ToString(); } if (ds.Tables[0].Rows[0]["p_tyid"] != null && ds.Tables[0].Rows[0]["p_tyid"].ToString() != "") { model.p_tyid = int.Parse(ds.Tables[0].Rows[0]["p_tyid"].ToString()); } if (ds.Tables[0].Rows[0]["p_pinpai"] != null && ds.Tables[0].Rows[0]["p_pinpai"].ToString() != "") { model.p_pinpai = ds.Tables[0].Rows[0]["p_pinpai"].ToString(); } if (ds.Tables[0].Rows[0]["p_model"] != null && ds.Tables[0].Rows[0]["p_model"].ToString() != "") { model.p_model = ds.Tables[0].Rows[0]["p_model"].ToString(); } if (ds.Tables[0].Rows[0]["p_shang"] != null && ds.Tables[0].Rows[0]["p_shang"].ToString() != "") { model.p_shang = ds.Tables[0].Rows[0]["p_shang"].ToString(); } if (ds.Tables[0].Rows[0]["p_price"] != null && ds.Tables[0].Rows[0]["p_price"].ToString() != "") { model.p_price = ds.Tables[0].Rows[0]["p_price"].ToString(); } if (ds.Tables[0].Rows[0]["p_unit"] != null && ds.Tables[0].Rows[0]["p_unit"].ToString() != "") { model.p_unit = ds.Tables[0].Rows[0]["p_unit"].ToString(); } if (ds.Tables[0].Rows[0]["p_sx"] != null && ds.Tables[0].Rows[0]["p_sx"].ToString() != "") { model.p_sx = ds.Tables[0].Rows[0]["p_sx"].ToString(); } if (ds.Tables[0].Rows[0]["p_xx"] != null && ds.Tables[0].Rows[0]["p_xx"].ToString() != "") { model.p_xx = ds.Tables[0].Rows[0]["p_xx"].ToString(); } if (ds.Tables[0].Rows[0]["p_desc"] != null && ds.Tables[0].Rows[0]["p_desc"].ToString() != "") { model.p_desc = ds.Tables[0].Rows[0]["p_desc"].ToString(); } if (ds.Tables[0].Rows[0]["p_addtime"] != null && ds.Tables[0].Rows[0]["p_addtime"].ToString() != "") { model.p_addtime = ds.Tables[0].Rows[0]["p_addtime"].ToString(); } if (ds.Tables[0].Rows[0]["p_ckid"] != null && ds.Tables[0].Rows[0]["p_ckid"].ToString() != "") { model.p_ckid = int.Parse(ds.Tables[0].Rows[0]["p_ckid"].ToString()); } if (ds.Tables[0].Rows[0]["p_kqid"] != null && ds.Tables[0].Rows[0]["p_kqid"].ToString() != "") { model.p_kqid = int.Parse(ds.Tables[0].Rows[0]["p_kqid"].ToString()); } if (ds.Tables[0].Rows[0]["p_num"] != null && ds.Tables[0].Rows[0]["p_num"].ToString() != "") { model.p_num = int.Parse(ds.Tables[0].Rows[0]["p_num"].ToString()); } if (ds.Tables[0].Rows[0]["p_rzfid"] != null && ds.Tables[0].Rows[0]["p_rzfid"].ToString() != "") { model.p_rzfid = int.Parse(ds.Tables[0].Rows[0]["p_rzfid"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.tb_proc model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_proc set "); if (model.p_no != null) { strSql.Append("p_no='" + model.p_no + "',"); } else { strSql.Append("p_no= null ,"); } if (model.p_name != null) { strSql.Append("p_name='" + model.p_name + "',"); } else { strSql.Append("p_name= null ,"); } if (model.p_tyid != null) { strSql.Append("p_tyid=" + model.p_tyid + ","); } else { strSql.Append("p_tyid= null ,"); } if (model.p_pinpai != null) { strSql.Append("p_pinpai='" + model.p_pinpai + "',"); } else { strSql.Append("p_pinpai= null ,"); } if (model.p_model != null) { strSql.Append("p_model='" + model.p_model + "',"); } else { strSql.Append("p_model= null ,"); } if (model.p_shang != null) { strSql.Append("p_shang='" + model.p_shang + "',"); } else { strSql.Append("p_shang= null ,"); } if (model.p_price != null) { strSql.Append("p_price='" + model.p_price + "',"); } else { strSql.Append("p_price= null ,"); } if (model.p_unit != null) { strSql.Append("p_unit='" + model.p_unit + "',"); } else { strSql.Append("p_unit= null ,"); } if (model.p_sx != null) { strSql.Append("p_sx='" + model.p_sx + "',"); } else { strSql.Append("p_sx= null ,"); } if (model.p_xx != null) { strSql.Append("p_xx='" + model.p_xx + "',"); } else { strSql.Append("p_xx= null ,"); } if (model.p_desc != null) { strSql.Append("p_desc='" + model.p_desc + "',"); } else { strSql.Append("p_desc= null ,"); } if (model.p_addtime != null) { strSql.Append("p_addtime='" + model.p_addtime + "',"); } else { strSql.Append("p_addtime= null ,"); } if (model.p_ckid != null) { strSql.Append("p_ckid=" + model.p_ckid + ","); } else { strSql.Append("p_ckid= null ,"); } if (model.p_kqid != null) { strSql.Append("p_kqid=" + model.p_kqid + ","); } else { strSql.Append("p_kqid= null ,"); } if (model.p_num != null) { strSql.Append("p_num=" + model.p_num + ","); } else { strSql.Append("p_num= null ,"); } if (model.p_rzfid != null) { strSql.Append("p_rzfid=" + model.p_rzfid + ","); } else { strSql.Append("p_rzfid= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where p_id=" + model.p_id + ""); int rowsAffected = DbSQL.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到最大ID /// </summary> public int GetMaxId() { return(DbSQL.GetMaxID("r_id", "tb_ruzhu")); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.tb_ruzhu model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_ruzhu set "); if (model.r_no != null) { strSql.Append("r_no='" + model.r_no + "',"); } else { strSql.Append("r_no= null ,"); } if (model.r_name != null) { strSql.Append("r_name='" + model.r_name + "',"); } if (model.r_uname != null) { strSql.Append("r_uname='" + model.r_uname + "',"); } else { strSql.Append("r_uname= null ,"); } if (model.r_utel != null) { strSql.Append("r_utel='" + model.r_utel + "',"); } else { strSql.Append("r_utel= null ,"); } if (model.r_address != null) { strSql.Append("r_address='" + model.r_address + "',"); } else { strSql.Append("r_address= null ,"); } if (model.r_desc != null) { strSql.Append("r_desc='" + model.r_desc + "',"); } else { strSql.Append("r_desc= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where r_id=" + model.r_id + ""); int rowsAffected = DbSQL.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }