private void btn_save(object sender, EventArgs e) { DevExpress.XtraEditors.SimpleButton simpbtn = (DevExpress.XtraEditors.SimpleButton)sender; if (simpbtn.Tag.Equals("Simbtn_save_basic")) { if (!txt_jdmc.Text.Equals(common_file.common_app.qymc) || !txt_yydh.Text.Equals(common_file.common_app.yydh) || !txt_SoftName.Text.Equals(common_file.common_app.SoftName)) { common_file.common_app.get_czsj(); Model.Xqyxx qyxx = new Hotel_app.Model.Xqyxx(); BLL.Xqyxx bll = new Hotel_app.BLL.Xqyxx(); List <Model.Xqyxx> list = bll.GetModelList(" id>=0 and yydh='" + common_file.common_app.yydh + "'"); if (list != null && list.Count > 0) { qyxx = list[0]; int id = qyxx.id; qyxx.qymc = txt_jdmc.Text; qyxx.yydh = txt_yydh.Text; qyxx.Softname = txt_SoftName.Text; qyxx.id = id; if (bll.Update(qyxx)) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "更新酒店基本信息成功"); } } } } if (simpbtn.Tag.Equals("Simbtn_save_zdInfo")) { if (!cb_jzd.SelectedItem.Equals(jzd_now) || !cb_yjd.SelectedItem.Equals(yjd_now) || !cb_djb.SelectedItem.Equals(djb_now) || !txt_yqsts.Value.Equals(tqts)) { jzd_now = cb_jzd.Text.Equals("A4") ? "11" : "21"; yjd_now = cb_yjd.Text.Equals("A4") ? "11" : "21"; djb_now = cb_djb.Text.Equals("A4") ? "11" : "21"; BLL.Qcounter bll = new Hotel_app.BLL.Qcounter(); Model.Qcounter counter = new Hotel_app.Model.Qcounter(); List <Model.Qcounter> list = bll.GetModelList(" id>=0 and yydh='" + common_file.common_app.yydh + "'"); if (list != null && list.Count > 0) { counter = list[0]; int id = counter.ID; counter.printzdpd = int.Parse(jzd_now + yjd_now + djb_now); counter.ID = id; if (bll.Update(counter)) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "更新成功,你现在可以直接连接打印机打印您设置的账单"); } } } } }
//判断yydh是否等于本地yydh public static bool Isyydh(string yydh) { bool f = false; BLL.Xqyxx B_Yxydw = new Hotel_app.BLL.Xqyxx(); Model.Xqyxx M_Yxydw = new Hotel_app.Model.Xqyxx(); DataSet ds = B_Yxydw.GetList("yydh='" + yydh + "'"); if (ds.Tables[0].Rows.Count > 0) { f = true; } return(f); }
/// <summary> /// 得到一个对象实体 /// </summary> public Hotel_app.Model.Xqyxx GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,qy_type,yydh,qymc,zjm,gj,sf,sb,qybh,qydh,qycz,Email,nxr,qydz,xtyysj,hyxs,lx,qymcyw,wz,qydzyw,hyjfrx,Softname from Xqyxx "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Hotel_app.Model.Xqyxx model = new Hotel_app.Model.Xqyxx(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public string Xqyxx_add_edit(string id, string yydh, string qymc, string zjm, string qybh, string qydh, string qycz, string email, string nxr, string qydz, string add_edit_delete, string xxzs) { string s = common_file.common_app.get_failure; BLL.Xqyxx B_Xqyxx = new Hotel_app.BLL.Xqyxx(); Model.Xqyxx M_Xqyxx = new Hotel_app.Model.Xqyxx(); if (xxzs == common_file.common_app.xxzs_xxvalue) { } if (xxzs == common_file.common_app.xxzs_zsvalue) { } if (add_edit_delete == common_file.common_app.get_add) { M_Xqyxx.yydh = yydh; M_Xqyxx.qymc = qymc; M_Xqyxx.zjm = zjm; M_Xqyxx.qybh = qybh; M_Xqyxx.qydh = qydh; M_Xqyxx.qycz = qycz; M_Xqyxx.Email = email; M_Xqyxx.nxr = nxr; M_Xqyxx.qydz = qydz; if (B_Xqyxx.Add(M_Xqyxx) > 0) { s = common_file.common_app.get_suc; } } else if (add_edit_delete == common_file.common_app.get_edit) { M_Xqyxx = B_Xqyxx.GetModel(Convert.ToInt32(id)); M_Xqyxx.zjm = zjm; M_Xqyxx.qybh = qybh; M_Xqyxx.qydh = qydh; M_Xqyxx.qycz = qycz; M_Xqyxx.Email = email; M_Xqyxx.nxr = nxr; M_Xqyxx.qydz = qydz; if (B_Xqyxx.Update(M_Xqyxx)) { s = common_file.common_app.get_suc; } } else if (add_edit_delete == common_file.common_app.get_delete) { if (id != "") { B_Xqyxx.Delete(Convert.ToInt32(id)); s = common_file.common_app.get_suc; } } return(s); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hotel_app.Model.Xqyxx model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Xqyxx("); strSql.Append("qy_type,yydh,qymc,zjm,gj,sf,sb,qybh,qydh,qycz,Email,nxr,qydz,xtyysj,hyxs,lx,qymcyw,wz,qydzyw,hyjfrx,Softname)"); strSql.Append(" values ("); strSql.Append("@qy_type,@yydh,@qymc,@zjm,@gj,@sf,@sb,@qybh,@qydh,@qycz,@Email,@nxr,@qydz,@xtyysj,@hyxs,@lx,@qymcyw,@wz,@qydzyw,@hyjfrx,@Softname)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@qy_type", SqlDbType.VarChar, 50), new SqlParameter("@yydh", SqlDbType.VarChar, 50), new SqlParameter("@qymc", SqlDbType.VarChar, 50), new SqlParameter("@zjm", SqlDbType.VarChar, 50), new SqlParameter("@gj", SqlDbType.VarChar, 50), new SqlParameter("@sf", SqlDbType.VarChar, 50), new SqlParameter("@sb", SqlDbType.VarChar, 50), new SqlParameter("@qybh", SqlDbType.VarChar, 50), new SqlParameter("@qydh", SqlDbType.VarChar, 50), new SqlParameter("@qycz", SqlDbType.VarChar, 50), new SqlParameter("@Email", SqlDbType.VarChar, 50), new SqlParameter("@nxr", SqlDbType.VarChar, 50), new SqlParameter("@qydz", SqlDbType.VarChar, 50), new SqlParameter("@xtyysj", SqlDbType.DateTime), new SqlParameter("@hyxs", SqlDbType.VarChar, 50), new SqlParameter("@lx", SqlDbType.VarChar, 50), new SqlParameter("@qymcyw", SqlDbType.VarChar, 50), new SqlParameter("@wz", SqlDbType.VarChar, 50), new SqlParameter("@qydzyw", SqlDbType.VarChar, 300), new SqlParameter("@hyjfrx", SqlDbType.VarChar, 50), new SqlParameter("@Softname", SqlDbType.VarChar, 50) }; parameters[0].Value = model.qy_type; parameters[1].Value = model.yydh; parameters[2].Value = model.qymc; parameters[3].Value = model.zjm; parameters[4].Value = model.gj; parameters[5].Value = model.sf; parameters[6].Value = model.sb; parameters[7].Value = model.qybh; parameters[8].Value = model.qydh; parameters[9].Value = model.qycz; parameters[10].Value = model.Email; parameters[11].Value = model.nxr; parameters[12].Value = model.qydz; parameters[13].Value = model.xtyysj; parameters[14].Value = model.hyxs; parameters[15].Value = model.lx; parameters[16].Value = model.qymcyw; parameters[17].Value = model.wz; parameters[18].Value = model.qydzyw; parameters[19].Value = model.hyjfrx; parameters[20].Value = model.Softname; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Hotel_app.Model.Xqyxx DataRowToModel(DataRow row) { Hotel_app.Model.Xqyxx model = new Hotel_app.Model.Xqyxx(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["qy_type"] != null) { model.qy_type = row["qy_type"].ToString(); } if (row["yydh"] != null) { model.yydh = row["yydh"].ToString(); } if (row["qymc"] != null) { model.qymc = row["qymc"].ToString(); } if (row["zjm"] != null) { model.zjm = row["zjm"].ToString(); } if (row["gj"] != null) { model.gj = row["gj"].ToString(); } if (row["sf"] != null) { model.sf = row["sf"].ToString(); } if (row["sb"] != null) { model.sb = row["sb"].ToString(); } if (row["qybh"] != null) { model.qybh = row["qybh"].ToString(); } if (row["qydh"] != null) { model.qydh = row["qydh"].ToString(); } if (row["qycz"] != null) { model.qycz = row["qycz"].ToString(); } if (row["Email"] != null) { model.Email = row["Email"].ToString(); } if (row["nxr"] != null) { model.nxr = row["nxr"].ToString(); } if (row["qydz"] != null) { model.qydz = row["qydz"].ToString(); } if (row["xtyysj"] != null && row["xtyysj"].ToString() != "") { model.xtyysj = DateTime.Parse(row["xtyysj"].ToString()); } if (row["hyxs"] != null) { model.hyxs = row["hyxs"].ToString(); } if (row["lx"] != null) { model.lx = row["lx"].ToString(); } if (row["qymcyw"] != null) { model.qymcyw = row["qymcyw"].ToString(); } if (row["wz"] != null) { model.wz = row["wz"].ToString(); } if (row["qydzyw"] != null) { model.qydzyw = row["qydzyw"].ToString(); } if (row["hyjfrx"] != null) { model.hyjfrx = row["hyjfrx"].ToString(); } if (row["Softname"] != null) { model.Softname = row["Softname"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hotel_app.Model.Xqyxx model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Xqyxx set "); strSql.Append("qy_type=@qy_type,"); strSql.Append("yydh=@yydh,"); strSql.Append("qymc=@qymc,"); strSql.Append("zjm=@zjm,"); strSql.Append("gj=@gj,"); strSql.Append("sf=@sf,"); strSql.Append("sb=@sb,"); strSql.Append("qybh=@qybh,"); strSql.Append("qydh=@qydh,"); strSql.Append("qycz=@qycz,"); strSql.Append("Email=@Email,"); strSql.Append("nxr=@nxr,"); strSql.Append("qydz=@qydz,"); strSql.Append("xtyysj=@xtyysj,"); strSql.Append("hyxs=@hyxs,"); strSql.Append("lx=@lx,"); strSql.Append("qymcyw=@qymcyw,"); strSql.Append("wz=@wz,"); strSql.Append("qydzyw=@qydzyw,"); strSql.Append("hyjfrx=@hyjfrx,"); strSql.Append("Softname=@Softname"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@qy_type", SqlDbType.VarChar, 50), new SqlParameter("@yydh", SqlDbType.VarChar, 50), new SqlParameter("@qymc", SqlDbType.VarChar, 50), new SqlParameter("@zjm", SqlDbType.VarChar, 50), new SqlParameter("@gj", SqlDbType.VarChar, 50), new SqlParameter("@sf", SqlDbType.VarChar, 50), new SqlParameter("@sb", SqlDbType.VarChar, 50), new SqlParameter("@qybh", SqlDbType.VarChar, 50), new SqlParameter("@qydh", SqlDbType.VarChar, 50), new SqlParameter("@qycz", SqlDbType.VarChar, 50), new SqlParameter("@Email", SqlDbType.VarChar, 50), new SqlParameter("@nxr", SqlDbType.VarChar, 50), new SqlParameter("@qydz", SqlDbType.VarChar, 50), new SqlParameter("@xtyysj", SqlDbType.DateTime), new SqlParameter("@hyxs", SqlDbType.VarChar, 50), new SqlParameter("@lx", SqlDbType.VarChar, 50), new SqlParameter("@qymcyw", SqlDbType.VarChar, 50), new SqlParameter("@wz", SqlDbType.VarChar, 50), new SqlParameter("@qydzyw", SqlDbType.VarChar, 300), new SqlParameter("@hyjfrx", SqlDbType.VarChar, 50), new SqlParameter("@Softname", SqlDbType.VarChar, 50), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.qy_type; parameters[1].Value = model.yydh; parameters[2].Value = model.qymc; parameters[3].Value = model.zjm; parameters[4].Value = model.gj; parameters[5].Value = model.sf; parameters[6].Value = model.sb; parameters[7].Value = model.qybh; parameters[8].Value = model.qydh; parameters[9].Value = model.qycz; parameters[10].Value = model.Email; parameters[11].Value = model.nxr; parameters[12].Value = model.qydz; parameters[13].Value = model.xtyysj; parameters[14].Value = model.hyxs; parameters[15].Value = model.lx; parameters[16].Value = model.qymcyw; parameters[17].Value = model.wz; parameters[18].Value = model.qydzyw; parameters[19].Value = model.hyjfrx; parameters[20].Value = model.Softname; parameters[21].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }