/// <summary> /// 修改 /// </summary> /// <param name="model">保险供应商实体</param> /// <returns></returns> public bool Update(EyouSoft.Model.SupplierStructure.SupplierInsurance model) { bool IsTrue = false; string SupplierInsuranceXML = CreateSupplierInsuranceXML(model.SupplierContact); DbCommand dc = this._db.GetStoredProcCommand("proc_SupplierInsurance_Update"); this._db.AddInParameter(dc, "Id", DbType.Int32, model.Id); this._db.AddInParameter(dc, "AgreementFile", DbType.String, model.AgreementFile); this._db.AddInParameter(dc, "CityId", DbType.Int32, model.CityId); this._db.AddInParameter(dc, "CityName", DbType.String, model.CityName); this._db.AddInParameter(dc, "CompanyId", DbType.Int32, model.CompanyId); this._db.AddInParameter(dc, "OperatorId", DbType.Int32, model.OperatorId); this._db.AddInParameter(dc, "ProvinceId", DbType.Int32, model.ProvinceId); this._db.AddInParameter(dc, "ProvinceName", DbType.String, model.ProvinceName); this._db.AddInParameter(dc, "Remark", DbType.String, model.Remark); this._db.AddInParameter(dc, "SupplierType", DbType.Byte, (int)model.SupplierType); this._db.AddInParameter(dc, "UnitAddress", DbType.String, model.UnitAddress); this._db.AddInParameter(dc, "UnitName", DbType.String, model.UnitName); this._db.AddInParameter(dc, "SupplierInsuranceXML", DbType.String, SupplierInsuranceXML); this._db.AddOutParameter(dc, "Result", DbType.Int32, 4); DbHelper.RunProcedure(dc, this._db); object Result = this._db.GetParameterValue(dc, "Result"); if (!Result.Equals(null)) { IsTrue = int.Parse(Result.ToString()) > 0 ? true : false; } return(IsTrue); }
/// <summary> /// 绑定要修改数据 /// </summary> /// <param name="tid"></param> private void bind() { tid = Utils.GetInt(Utils.GetQueryStringValue("tid")); if (tid > 0) { //获取保险信息 Insurancemodel = Insurancebll.GetModel(tid, SiteUserInfo.CompanyID); this.ucProvince1.ProvinceId = Insurancemodel.ProvinceId; this.ucCity1.CityId = Insurancemodel.CityId; this.ucCity1.ProvinceId = Insurancemodel.ProvinceId; } }
/// <summary> /// 获取所属保险供应商信息集合 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="CompanyId">公司编号</param> /// <param name="SearchInfo">搜索实体</param> /// <returns></returns> public IList <EyouSoft.Model.SupplierStructure.SupplierInsurance> GetList(int PageSize, int PageIndex, ref int RecordCount, int CompanyId, EyouSoft.Model.SupplierStructure.SupplierQuery SearchInfo) { IList <EyouSoft.Model.SupplierStructure.SupplierInsurance> ResultList = null; StringBuilder fields = new StringBuilder(); fields.Append(" id,ProvinceId,ProvinceName,CityId,CityName,UnitName,SupplierType,TradeNum,"); fields.Append("UnitAddress,Commission,AgreementFile,Remark,UnitPolicy,CompanyId,OperatorId,"); fields.Append("IssueTime,(SELECT * FROM tbl_SupplierContact WHERE SupplierId=tbl_CompanySupplier.ID "); fields.Append("FOR XML RAW,ROOT('ROOT')) AS SupplierInsuranceXML "); string TableName = "tbl_CompanySupplier"; string orderByString = " [IssueTime] DESC"; string identityColumnName = "id"; StringBuilder Query = new StringBuilder(); Query.AppendFormat(" CompanyId={0} AND IsDelete=0 AND SupplierType=8", CompanyId); if (!string.IsNullOrEmpty(SearchInfo.UnitName)) { Query.AppendFormat(" AND UnitName LIKE '%{0}%'", SearchInfo.UnitName); } using (IDataReader dr = DbHelper.ExecuteReader(this._db, PageSize, PageIndex, ref RecordCount, TableName, identityColumnName, fields.ToString(), Query.ToString(), orderByString)) { ResultList = new List <EyouSoft.Model.SupplierStructure.SupplierInsurance>(); while (dr.Read()) { EyouSoft.Model.SupplierStructure.SupplierInsurance model = new EyouSoft.Model.SupplierStructure.SupplierInsurance() { Id = dr.GetInt32(dr.GetOrdinal("id")), AgreementFile = dr.IsDBNull(dr.GetOrdinal("AgreementFile")) ? "" : dr.GetString(dr.GetOrdinal("AgreementFile")), CityId = dr.IsDBNull(dr.GetOrdinal("CityId")) ? 0 : dr.GetInt32(dr.GetOrdinal("CityId")), CompanyId = dr.IsDBNull(dr.GetOrdinal("CompanyId")) ? 0 : dr.GetInt32(dr.GetOrdinal("CompanyId")), OperatorId = dr.IsDBNull(dr.GetOrdinal("OperatorId")) ? 0 : dr.GetInt32(dr.GetOrdinal("OperatorId")), ProvinceId = dr.IsDBNull(dr.GetOrdinal("ProvinceId")) ? 0 : dr.GetInt32(dr.GetOrdinal("ProvinceId")), TradeNum = dr.IsDBNull(dr.GetOrdinal("TradeNum")) ? 0 : dr.GetInt32(dr.GetOrdinal("TradeNum")), UnitName = dr.IsDBNull(dr.GetOrdinal("UnitName")) ? "" : dr.GetString(dr.GetOrdinal("UnitName")), CityName = dr.IsDBNull(dr.GetOrdinal("CityName")) ? "" : dr.GetString(dr.GetOrdinal("CityName")), ProvinceName = dr.IsDBNull(dr.GetOrdinal("ProvinceName")) ? "" : dr.GetString(dr.GetOrdinal("ProvinceName")), Remark = dr.IsDBNull(dr.GetOrdinal("Remark")) ? "" : dr.GetString(dr.GetOrdinal("Remark")), UnitAddress = dr.IsDBNull(dr.GetOrdinal("UnitAddress")) ? "" : dr.GetString(dr.GetOrdinal("UnitAddress")), IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime")), SupplierType = (EyouSoft.Model.EnumType.CompanyStructure.SupplierType)Enum.Parse(typeof(EyouSoft.Model.EnumType.CompanyStructure.SupplierType), dr.GetByte(dr.GetOrdinal("SupplierType")).ToString()) }; if (!dr.IsDBNull(dr.GetOrdinal("SupplierInsuranceXML"))) { model.SupplierContact = this.GetContactInfo(dr.GetString(dr.GetOrdinal("SupplierInsuranceXML"))); } ResultList.Add(model); model = null; } } return(ResultList); }
protected bool show = false;//是否查看 #endregion protected void Page_Load(object sender, EventArgs e) { //实例化业务逻辑类和实体类 Insurancemodel = new EyouSoft.Model.SupplierStructure.SupplierInsurance(); Insurancebll = new EyouSoft.BLL.SupplierStructure.SupplierInsurance(); //省份和城市初始化 this.ucProvince1.CompanyId = CurrentUserCompanyID; this.ucProvince1.IsFav = true; this.ucCity1.CompanyId = CurrentUserCompanyID; this.ucCity1.IsFav = true; if (!IsPostBack) { bindProandCity(); if (CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_栏目)) { //操作类型 修改or添加 type = Utils.GetQueryStringValue("type"); switch (type) { case "modify": if (CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_修改)) { bind(); } else { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_保险_修改, false); } break; case "show": show = true; bind(); break; default: if (!CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_新增)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_保险_新增, false); } break; } } } }
private void loadXls() { string data = Utils.GetFormValue("dataxls"); string[] s = data.Split(';'); EyouSoft.BLL.SupplierStructure.SupplierInsurance insurancebll = new EyouSoft.BLL.SupplierStructure.SupplierInsurance(); IList <EyouSoft.Model.SupplierStructure.SupplierInsurance> insurancemodel = new List <EyouSoft.Model.SupplierStructure.SupplierInsurance>(); for (int i = 0; i < s.Length; i++) { string[] smodel = s[i].Split(','); if (smodel.Length == 11 && !string.IsNullOrEmpty(smodel[0]) && !string.IsNullOrEmpty(smodel[1]) && !string.IsNullOrEmpty(smodel[2])) { EyouSoft.Model.SupplierStructure.SupplierInsurance slmodel = new EyouSoft.Model.SupplierStructure.SupplierInsurance(); slmodel.ProvinceName = HttpUtility.UrlDecode(smodel[0]); slmodel.CityName = HttpUtility.UrlDecode(smodel[1]); slmodel.UnitName = HttpUtility.UrlDecode(smodel[2]); slmodel.UnitAddress = HttpUtility.UrlDecode(smodel[3]); slmodel.SupplierContact = new List <EyouSoft.Model.CompanyStructure.SupplierContact>(); EyouSoft.Model.CompanyStructure.SupplierContact scmodel = new EyouSoft.Model.CompanyStructure.SupplierContact(); scmodel.ContactName = HttpUtility.UrlDecode(smodel[4]); scmodel.JobTitle = HttpUtility.UrlDecode(smodel[5]); scmodel.ContactTel = HttpUtility.UrlDecode(smodel[6]); scmodel.ContactMobile = HttpUtility.UrlDecode(smodel[7]); scmodel.QQ = HttpUtility.UrlDecode(smodel[8]); scmodel.Email = HttpUtility.UrlDecode(smodel[9]); scmodel.CompanyId = SiteUserInfo.CompanyID; slmodel.SupplierContact.Add(scmodel); slmodel.Remark = HttpUtility.UrlDecode(smodel[10]); slmodel.OperatorId = SiteUserInfo.ID; slmodel.IssueTime = DateTime.Now; slmodel.CompanyId = CurrentUserCompanyID; slmodel.AgreementFile = string.Empty; slmodel.IsDelete = false; slmodel.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.保险; slmodel.TradeNum = 0; insurancemodel.Add(slmodel); } } int res = 0; res = insurancebll.AddList(insurancemodel); Response.Clear(); Response.Write(string.Format("{{\"res\":{0}}}", res > 0 ? 1 : -1)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //初始化保险业务逻辑类和实体类 Insurancebll = new EyouSoft.BLL.SupplierStructure.SupplierInsurance(); Insurancemodle = new EyouSoft.Model.SupplierStructure.SupplierInsurance(); //权限判断 if (!CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_保险_栏目, true); } grantadd = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_新增); grantdel = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_删除); grantmodify = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_修改); grantto = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_导出); grantload = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_保险_导入); if (!this.Page.IsPostBack) { //操作类型 删除or导出excel action = Utils.GetQueryStringValue("action"); switch (action) { case "toexcel": { if (grantto) { CreateExcel("Insurance" + DateTime.Now.ToShortDateString()); } } break; case "Insurancedel": { if (grantdel) { InsuranceDel(); } } break; default: DataInit(); break; } } }
/// <summary> /// 获取实体 /// </summary> /// <param name="Id">保险供应商编号(主键)</param> /// <param name="CompanyId">所属公司编号</param> /// <returns></returns> public EyouSoft.Model.SupplierStructure.SupplierInsurance GetModel(int Id, int CompanyId) { EyouSoft.Model.SupplierStructure.SupplierInsurance model = null; StringBuilder StrSql = new StringBuilder(); StrSql.Append(" SELECT id,ProvinceId,ProvinceName,CityId,CityName,UnitName,SupplierType,"); StrSql.Append(" UnitAddress,Commission,AgreementFile,Remark,UnitPolicy,CompanyId,OperatorId,"); StrSql.Append(" IssueTime,(SELECT * FROM tbl_SupplierContact WHERE SupplierId=a.ID "); StrSql.Append(" FOR XML RAW,ROOT('ROOT')) AS SupplierInsuranceXML"); StrSql.AppendFormat(" FROM tbl_CompanySupplier a WHERE CompanyId={0} AND id={1} AND SupplierType=8 ", CompanyId, Id); DbCommand dc = this._db.GetSqlStringCommand(StrSql.ToString()); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db)) { if (dr.Read()) { model = new EyouSoft.Model.SupplierStructure.SupplierInsurance() { Id = dr.GetInt32(dr.GetOrdinal("id")), AgreementFile = dr.IsDBNull(dr.GetOrdinal("AgreementFile")) ? "" : dr.GetString(dr.GetOrdinal("AgreementFile")), CityId = dr.IsDBNull(dr.GetOrdinal("CityId")) ? 0 : dr.GetInt32(dr.GetOrdinal("CityId")), CompanyId = dr.IsDBNull(dr.GetOrdinal("CompanyId")) ? 0 : dr.GetInt32(dr.GetOrdinal("CompanyId")), OperatorId = dr.IsDBNull(dr.GetOrdinal("OperatorId")) ? 0 : dr.GetInt32(dr.GetOrdinal("OperatorId")), ProvinceId = dr.IsDBNull(dr.GetOrdinal("ProvinceId")) ? 0 : dr.GetInt32(dr.GetOrdinal("ProvinceId")), //TradeNum = dr.IsDBNull(dr.GetOrdinal("TradeNum")) ? 0 : dr.GetInt32(dr.GetOrdinal("TradeNum")), UnitName = dr.IsDBNull(dr.GetOrdinal("UnitName")) ? "" : dr.GetString(dr.GetOrdinal("UnitName")), CityName = dr.IsDBNull(dr.GetOrdinal("CityName")) ? "" : dr.GetString(dr.GetOrdinal("CityName")), ProvinceName = dr.IsDBNull(dr.GetOrdinal("ProvinceName")) ? "" : dr.GetString(dr.GetOrdinal("ProvinceName")), Remark = dr.IsDBNull(dr.GetOrdinal("Remark")) ? "" : dr.GetString(dr.GetOrdinal("Remark")), UnitAddress = dr.IsDBNull(dr.GetOrdinal("UnitAddress")) ? "" : dr.GetString(dr.GetOrdinal("UnitAddress")), IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime")), SupplierType = (EyouSoft.Model.EnumType.CompanyStructure.SupplierType)Enum.Parse(typeof(EyouSoft.Model.EnumType.CompanyStructure.SupplierType), dr.GetByte(dr.GetOrdinal("SupplierType")).ToString()) }; if (!dr.IsDBNull(dr.GetOrdinal("SupplierInsuranceXML"))) { model.SupplierContact = this.GetContactInfo(dr.GetString(dr.GetOrdinal("SupplierInsuranceXML"))); } } } return(model); }
protected void LinkButton1_Click(object sender, EventArgs e) { tid = Utils.GetInt(Utils.GetFormValue("tid")); if (tid > 0) { //获取保险信息 Insurancemodel = Insurancebll.GetModel(tid, SiteUserInfo.CompanyID); } else { Insurancemodel.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.保险; } //省份编号 int ProvinceId = this.ucProvince1.ProvinceId; string proname = ""; EyouSoft.Model.CompanyStructure.Province proviceModel = new EyouSoft.BLL.CompanyStructure.Province().GetModel(ProvinceId); if (proviceModel != null) { proname = proviceModel.ProvinceName; } //城市编号 int CityId = this.ucCity1.CityId; string Cityname = ""; EyouSoft.Model.CompanyStructure.City cityModel = new EyouSoft.BLL.CompanyStructure.City().GetModel(CityId); if (cityModel != null) { Cityname = cityModel.CityName; } //单位名称 string Unitsname = Utils.GetFormValue("Txtunitsnname"); //单位地址 string Unitaddress = Utils.GetFormValue("TxtAddress"); //合作协议 if (Request.Files.Count > 0) { string litmsg = ""; if (!EyouSoft.Common.Function.UploadFile.CheckFileType(Request.Files, "workAgree", new[] { ".gif", ".jpeg", ".jpg", ".png", ".xls", ".doc", ".docx", ".rar", ".txt" }, null, out litmsg)) { MessageBox.ResponseScript(this, ";alert('" + litmsg + "');"); return; } string filepath = string.Empty; string oldfilename = string.Empty; if (EyouSoft.Common.Function.UploadFile.FileUpLoad(Request.Files["workAgree"], "SupplierControlFile", out filepath, out oldfilename)) { if (filepath.Trim() != "" && oldfilename.Trim() != "") { Insurancemodel.AgreementFile = filepath; } } } //备注 string TxtRemarks = Utils.GetFormValue("TxtRemarks"); //当前公司编号 int CompanyId = this.SiteUserInfo.CompanyID; //当前操作员编号 int OperatorId = this.SiteUserInfo.ID; //联系人信息 Insurancemodel.SupplierContact = new List <EyouSoft.Model.CompanyStructure.SupplierContact>(); string[] accmanname = Utils.GetFormValues("inname"); string[] accmandate = Utils.GetFormValues("indate"); string[] accmanphone = Utils.GetFormValues("inphone"); string[] accmanmobile = Utils.GetFormValues("inmobile"); string[] accmanqq = Utils.GetFormValues("inqq"); string[] accmanemail = Utils.GetFormValues("inemail"); string[] accmanefax = Utils.GetFormValues("inefax"); for (int i = 0; i < accmanname.Length; i++) { EyouSoft.Model.CompanyStructure.SupplierContact scmodel = new EyouSoft.Model.CompanyStructure.SupplierContact(); scmodel.ContactName = accmanname[i]; scmodel.JobTitle = accmandate[i]; scmodel.ContactTel = accmanphone[i]; scmodel.ContactMobile = accmanmobile[i]; scmodel.QQ = accmanqq[i]; scmodel.Email = accmanemail[i]; scmodel.ContactFax = accmanefax[i]; scmodel.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.保险; Insurancemodel.SupplierContact.Add(scmodel); } Insurancemodel.ProvinceId = ProvinceId; Insurancemodel.ProvinceName = proname; Insurancemodel.CityId = CityId; Insurancemodel.CityName = Cityname; Insurancemodel.UnitName = Unitsname; Insurancemodel.UnitAddress = Unitaddress; Insurancemodel.Remark = TxtRemarks; Insurancemodel.CompanyId = CompanyId; Insurancemodel.OperatorId = OperatorId; Insurancemodel.IssueTime = System.DateTime.Now; bool res = false; if (tid > 0) { //修改保险 res = Insurancebll.Update(Insurancemodel); } else { //添加保险 res = Insurancebll.Add(Insurancemodel); } if (res) { MessageBox.ResponseScript(this, string.Format(";alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide(); {2}", "保存成功!", Utils.GetQueryStringValue("iframeId"), tid > 0 ? "window.parent.location.reload();" : "window.parent.location.href='/SupplierControl/Insurance/Insurancelist.aspx';")); } else { MessageBox.ResponseScript(this, ";alert('保存失败!');"); } }
/// <summary> /// 修改 /// </summary> /// <param name="model">保险供应商实体</param> /// <returns></returns> public bool Update(EyouSoft.Model.SupplierStructure.SupplierInsurance model) { return(idal.Update(model)); }
/// <summary> /// 新增 /// </summary> /// <param name="model">保险供应商实体</param> /// <returns></returns> public bool Add(EyouSoft.Model.SupplierStructure.SupplierInsurance model) { return(idal.Add(model)); }