/// <summary> /// 初始化页面 /// </summary> private void InitPageData() { if (CommunityAdvisorId <= 0) { raSex.SelectedValue = "1"; return; } EyouSoft.Model.CommunityStructure.CommunityAdvisor model = EyouSoft.BLL.CommunityStructure.CommunityAdvisor.CreateInstance().GetCommunityAdvisor(CommunityAdvisorId); if (model.Equals(null)) { MessageBox.ShowAndRedirect(this, "没有找到要修改的信息!", "/SupplierManage/CommunityAdvisor.aspx"); return; } txtName.Value = model.ContactName; raSex.SelectedValue = model.Sex ? "1" : "0"; txtCompany.Value = model.CompanyName; txtMobile.Value = model.ContactTel; txtQQ.Value = model.QQ; txtJob.Value = model.Job; ltrOldImg.Text = string.Format("<a href=\"{0}\"target='_blank' title=\"点击查看\">{1}</a>", Domain.FileSystem + model.ImgPath, model.ImgPath.Substring(model.ImgPath.LastIndexOf('/') + 1)); hdfOldImgPath.Value = model.ImgPath; txtAchieve.Value = model.Achieve; }
/// <summary> /// 修改顾问团队 /// </summary> /// <param name="model">顾问团队实体</param> /// <returns>返回受影响行数</returns> public virtual int UpdateCommunityAdvisor(EyouSoft.Model.CommunityStructure.CommunityAdvisor model) { if (model == null) { return(0); } DbCommand dc = base.SystemStore.GetSqlStringCommand(SQL_DELETEDFILE_UPDATEMOVE + Sql_CommunityAdvisor_Update); #region 参数赋值 base.SystemStore.AddInParameter(dc, "ContactName", DbType.String, model.ContactName); base.SystemStore.AddInParameter(dc, "Sex", DbType.String, model.Sex ? "1" : "0"); base.SystemStore.AddInParameter(dc, "Age", DbType.Int32, model.Age); base.SystemStore.AddInParameter(dc, "CompanyName", DbType.String, model.CompanyName); base.SystemStore.AddInParameter(dc, "ContactTel", DbType.String, model.ContactTel); base.SystemStore.AddInParameter(dc, "QQ", DbType.String, model.QQ); base.SystemStore.AddInParameter(dc, "Job", DbType.String, model.Job); base.SystemStore.AddInParameter(dc, "ImgPath", DbType.String, model.ImgPath); base.SystemStore.AddInParameter(dc, "Achieve", DbType.String, model.Achieve); base.SystemStore.AddInParameter(dc, "Honour", DbType.String, model.Honour); base.SystemStore.AddInParameter(dc, "IsCheck", DbType.String, model.IsCheck ? "1" : "0"); base.SystemStore.AddInParameter(dc, "OperatorId", DbType.String, model.OperatorId); base.SystemStore.AddInParameter(dc, "SysOperatorId", DbType.Int32, model.SysOperatorId); base.SystemStore.AddInParameter(dc, "ID", DbType.Int32, model.ID); #endregion return(DbHelper.ExecuteSql(dc, base.SystemStore)); }
/// <summary> /// 获取顾问团队 /// </summary> /// <param name="TopNum">取得顾问团队的数量(小于等于0取所有)</param> /// <param name="IsShow">是否前台显示 =null返回全部</param> /// <returns>返回顾问团队实体集合</returns> public virtual IList <EyouSoft.Model.CommunityStructure.CommunityAdvisor> GetCommunityAdvisorList(int TopNum, bool?IsShow) { IList <EyouSoft.Model.CommunityStructure.CommunityAdvisor> List = new List <EyouSoft.Model.CommunityStructure.CommunityAdvisor>(); string StrSql = string.Format(Sql_CommunityAdvisor_Select, TopNum > 0 ? string.Format(" top {0}", TopNum) : string.Empty); if (IsShow.HasValue) { StrSql += string.Format(" where IsShow='{0}' ", IsShow.Value ? "1" : "0"); } StrSql += " order by ID desc"; DbCommand dc = base.SystemStore.GetSqlStringCommand(StrSql); using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore)) { EyouSoft.Model.CommunityStructure.CommunityAdvisor model = null; while (dr.Read()) { model = new EyouSoft.Model.CommunityStructure.CommunityAdvisor(); if (!string.IsNullOrEmpty(dr["ID"].ToString())) { model.ID = int.Parse(dr["ID"].ToString()); } model.ContactName = dr["ContactName"].ToString(); if (!string.IsNullOrEmpty(dr["Sex"].ToString()) && dr["Sex"].ToString().Equals("1")) { model.Sex = true; } if (!string.IsNullOrEmpty(dr["Age"].ToString())) { model.Age = int.Parse(dr["Age"].ToString()); } model.CompanyName = dr["CompanyName"].ToString(); model.ContactTel = dr["ContactTel"].ToString(); model.QQ = dr["QQ"].ToString(); model.Job = dr["Job"].ToString(); model.ImgPath = dr["ImgPath"].ToString(); model.Achieve = dr["Achieve"].ToString(); model.Honour = dr["Honour"].ToString(); if (!string.IsNullOrEmpty(dr["IsCheck"].ToString()) && dr["IsCheck"].ToString().Equals("1")) { model.IsCheck = true; } model.OperatorId = dr["OperatorId"].ToString(); if (!string.IsNullOrEmpty(dr["SysOperatorId"].ToString())) { model.SysOperatorId = int.Parse(dr["SysOperatorId"].ToString()); } if (!string.IsNullOrEmpty(dr["IsShow"].ToString()) && dr["IsShow"].ToString().Equals("1")) { model.IsShow = true; } List.Add(model); } } return(List); }
/// <summary> /// 保存顾问团队信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strName = Utils.InputText(txtName.Value.Trim()); string strMobile = Utils.InputText(txtMobile.Value.Trim()); string NewImgPath = Utils.GetFormValue("ctl00$ctl00$Main$SupplierMain$txtPhoto$hidFileName"); System.Text.StringBuilder strErr = new System.Text.StringBuilder(); if (string.IsNullOrEmpty(strName)) { strErr.Append("请填写姓名!\\n"); } if (string.IsNullOrEmpty(strMobile) || Utils.IsMobilePhone(strMobile) == false) { strErr.Append("请填写正确的手机号码!\\n"); } if (!string.IsNullOrEmpty(strErr.ToString())) { MessageBox.ShowAndReturnBack(this, strErr.ToString(), 1); return; } EyouSoft.Model.CommunityStructure.CommunityAdvisor model = new EyouSoft.Model.CommunityStructure.CommunityAdvisor(); model.ContactName = strName; if (raSex.SelectedValue == "1") { model.Sex = true; } else { model.Sex = false; } model.CompanyName = Utils.InputText(txtCompany.Value.Trim()); model.ContactTel = strMobile; model.QQ = Utils.InputText(txtQQ.Value.Trim()); model.Job = Utils.InputText(txtJob.Value.Trim()); model.Achieve = Utils.InputText(txtAchieve.Value.Trim()); model.ImgPath = NewImgPath; model.IsCheck = false; model.IsShow = false; model.OperatorId = SiteUserInfo == null ? string.Empty : SiteUserInfo.ID; model.SysOperatorId = 0; int Result = 0; Result = EyouSoft.BLL.CommunityStructure.CommunityAdvisor.CreateInstance().AddCommunityAdvisor(model); if (Result > 0) { MessageBox.ShowAndRedirect(this, "您的申请已经提交,请等待审核!", "/SupplierInfo/HonoredGuest.aspx"); } else { MessageBox.ShowAndRedirect(this, "申请提交失败!", "/SupplierInfo/HonoredGuest.aspx"); } }
/// <summary> /// 修改顾问团队 /// </summary> /// <param name="model">顾问团队实体</param> /// <returns>0:Error;1:Success</returns> public int UpdateCommunityAdvisor(EyouSoft.Model.CommunityStructure.CommunityAdvisor model) { if (model == null) { return(0); } return(dal.UpdateCommunityAdvisor(model) > 0 ? 1 : 0); }
/// <summary> /// 分页获取顾问团队 /// </summary> /// <param name="PageSize">每页条数</param> /// <param name="PageIndex">当前页数</param> /// <param name="RecordCount">总记录数</param> /// <param name="IsShow">是否前台显示 =null返回全部</param> /// <returns>返回顾问团队实体集合</returns> public virtual IList <EyouSoft.Model.CommunityStructure.CommunityAdvisor> GetCommunityAdvisorList(int PageSize, int PageIndex, ref int RecordCount, bool?IsShow) { IList <EyouSoft.Model.CommunityStructure.CommunityAdvisor> List = new List <EyouSoft.Model.CommunityStructure.CommunityAdvisor>(); string strFiles = " [ID],[ContactName],[Sex],[Age],[CompanyName],[ContactTel],[QQ],[Job],[ImgPath],[Achieve],[Honour],[IsCheck],[IsShow],[OperatorId],[SysOperatorId] "; string strOrder = " ID desc "; string strWhere = string.Empty; if (IsShow.HasValue) { strWhere = string.Format(" IsShow='{0}' ", IsShow.Value?"1":"0"); } using (IDataReader dr = DbHelper.ExecuteReader(base.SystemStore, PageSize, PageIndex, ref RecordCount, "tbl_CommunityAdvisor", "[ID]", strFiles, strWhere, strOrder)) { EyouSoft.Model.CommunityStructure.CommunityAdvisor model = null; while (dr.Read()) { model = new EyouSoft.Model.CommunityStructure.CommunityAdvisor(); if (!string.IsNullOrEmpty(dr["ID"].ToString())) { model.ID = int.Parse(dr["ID"].ToString()); } model.ContactName = dr["ContactName"].ToString(); if (!string.IsNullOrEmpty(dr["Sex"].ToString()) && dr["Sex"].ToString().Equals("1")) { model.Sex = true; } if (!string.IsNullOrEmpty(dr["Age"].ToString())) { model.Age = int.Parse(dr["Age"].ToString()); } model.CompanyName = dr["CompanyName"].ToString(); model.ContactTel = dr["ContactTel"].ToString(); model.QQ = dr["QQ"].ToString(); model.Job = dr["Job"].ToString(); model.ImgPath = dr["ImgPath"].ToString(); model.Achieve = dr["Achieve"].ToString(); model.Honour = dr["Honour"].ToString(); if (!string.IsNullOrEmpty(dr["IsCheck"].ToString()) && dr["IsCheck"].ToString().Equals("1")) { model.IsCheck = true; } model.OperatorId = dr["OperatorId"].ToString(); if (!string.IsNullOrEmpty(dr["SysOperatorId"].ToString())) { model.SysOperatorId = int.Parse(dr["SysOperatorId"].ToString()); } if (!string.IsNullOrEmpty(dr["IsShow"].ToString()) && dr["IsShow"].ToString().Equals("1")) { model.IsShow = true; } List.Add(model); } } return(List); }
/// <summary> /// 获取顾问团队实体 /// </summary> /// <param name="CommunityAdvisorId">顾问团队</param> /// <returns>获取顾问团队实体</returns> public virtual Model.CommunityStructure.CommunityAdvisor GetCommunityAdvisor(int CommunityAdvisorId) { if (CommunityAdvisorId <= 0) { return(null); } EyouSoft.Model.CommunityStructure.CommunityAdvisor model = new EyouSoft.Model.CommunityStructure.CommunityAdvisor(); string strSql = string.Format(" SELECT [ID],[ContactName],[Sex],[Age],[CompanyName],[ContactTel],[QQ],[Job],[ImgPath],[Achieve],[Honour],[IsCheck],[IsShow],[OperatorId],[SysOperatorId] FROM [tbl_CommunityAdvisor] where ID = {0} ", CommunityAdvisorId); DbCommand dc = base.SystemStore.GetSqlStringCommand(strSql); using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore)) { if (dr.Read()) { model = new EyouSoft.Model.CommunityStructure.CommunityAdvisor(); if (!string.IsNullOrEmpty(dr["ID"].ToString())) { model.ID = int.Parse(dr["ID"].ToString()); } model.ContactName = dr["ContactName"].ToString(); if (!string.IsNullOrEmpty(dr["Sex"].ToString()) && dr["Sex"].ToString().Equals("1")) { model.Sex = true; } if (!string.IsNullOrEmpty(dr["Age"].ToString())) { model.Age = int.Parse(dr["Age"].ToString()); } model.CompanyName = dr["CompanyName"].ToString(); model.ContactTel = dr["ContactTel"].ToString(); model.QQ = dr["QQ"].ToString(); model.Job = dr["Job"].ToString(); model.ImgPath = dr["ImgPath"].ToString(); model.Achieve = dr["Achieve"].ToString(); model.Honour = dr["Honour"].ToString(); if (!string.IsNullOrEmpty(dr["IsCheck"].ToString()) && dr["IsCheck"].ToString().Equals("1")) { model.IsCheck = true; } model.OperatorId = dr["OperatorId"].ToString(); if (!string.IsNullOrEmpty(dr["SysOperatorId"].ToString())) { model.SysOperatorId = int.Parse(dr["SysOperatorId"].ToString()); } if (!string.IsNullOrEmpty(dr["IsShow"].ToString()) && dr["IsShow"].ToString().Equals("1")) { model.IsShow = true; } } } return(model); }
/// <summary> /// 保存顾问团队信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strName = Utils.InputText(txtName.Value.Trim()); string strMobile = Utils.InputText(txtMobile.Value.Trim()); string NewImgPath = Utils.GetFormValue("txtPhoto$hidFileName"); string OldImgPath = Utils.InputText(hdfOldImgPath.Value); System.Text.StringBuilder strErr = new System.Text.StringBuilder(); if (string.IsNullOrEmpty(strName)) { strErr.Append("请填写姓名!\\n"); } if (string.IsNullOrEmpty(strMobile) || Utils.IsMobilePhone(strMobile) == false) { strErr.Append("请填写正确的手机号码!\\n"); } if (!string.IsNullOrEmpty(strErr.ToString())) { MessageBox.ShowAndReturnBack(this, strErr.ToString(), 1); return; } EyouSoft.Model.CommunityStructure.CommunityAdvisor model = new EyouSoft.Model.CommunityStructure.CommunityAdvisor(); model.ContactName = strName; if (raSex.SelectedValue == "1") { model.Sex = true; } else { model.Sex = false; } model.CompanyName = Utils.InputText(txtCompany.Value.Trim()); model.ContactTel = strMobile; model.QQ = Utils.InputText(txtQQ.Value.Trim()); model.Job = Utils.InputText(txtJob.Value.Trim()); model.Achieve = Utils.InputText(txtAchieve.Value.Trim()); if (CommunityAdvisorId > 0) { if (string.IsNullOrEmpty(NewImgPath)) { model.ImgPath = OldImgPath; } else { model.ImgPath = NewImgPath; } } else if (CommunityAdvisorId <= 0) { model.ImgPath = NewImgPath; } model.IsCheck = true; model.IsShow = true; model.OperatorId = MasterUserInfo.ID.ToString(); model.SysOperatorId = MasterUserInfo.ID; int Result = 0; if (CommunityAdvisorId > 0) { model.ID = CommunityAdvisorId; Result = EyouSoft.BLL.CommunityStructure.CommunityAdvisor.CreateInstance().UpdateCommunityAdvisor(model); } else { Result = EyouSoft.BLL.CommunityStructure.CommunityAdvisor.CreateInstance().AddCommunityAdvisor(model); } if (Result > 0) { MessageBox.ShowAndRedirect(this, "保存成功!", "/SupplierManage/CommunityAdvisor.aspx"); } else { MessageBox.ShowAndRedirect(this, "保存失败!", "/SupplierManage/CommunityAdvisor.aspx"); } }