/// <summary> /// 保存OEM版本发布的在线服务 /// </summary> /// <param name="company">公司Id</param> /// <param name="role">平台的角色</param> /// <param name="operatorAccount">操作员帐号</param> public static void SaveOEM(Guid company, OnLineCustomerView view, string operatorAccount) { var reposity = Factory.CreateOnLineCustomerRepository(); reposity.SaveOnLine(company, PublishRoles.OEM, view); // 记录日志 string content = string.Format("标题:{0},内容:{1},公司Id{2},发布角色{3}", view.Title, view.Content, company, OperatorRole.Provider.GetDescription()); saveAddLog("在线客服", content, OperatorRole.Provider, company.ToString(), operatorAccount); }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); if (!IsPostBack) { OnLineCustomerView view = OnLineCustomerService.Query(this.CurrentCompany.CompanyId); if (view != null) { this.txtTitle.Text = view.Title; this.ftbContent.Text = view.Content; } } BindMember(); }
public int SaveOnLine(Guid company, PublishRoles role, OnLineCustomerView view) { string sql = "IF EXISTS(SELECT NULL FROM [dbo].[T_OnLineCustomer] WHERE [Company]=@Company) UPDATE[dbo].[T_OnLineCustomer] SET [Title]=@Title," + "[Content]=@Content,[PublishRole]=@PublishRole WHERE [Company]=@Company ELSE INSERT INTO [dbo].[T_OnLineCustomer](Title,Content,PublishRole,Company)" + " VALUES(@Title,@Content,@PublishRole,@Company)"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("Company", company); dbOperator.AddParameter("Title", view.Title); dbOperator.AddParameter("Content", view.Content); dbOperator.AddParameter("PublishRole", (int)role); return(dbOperator.ExecuteNonQuery(sql)); } }
public OnLineCustomerView Query(Guid company) { OnLineCustomerView view = null; string sql = "SELECT [Title],[Content] FROM [dbo].[T_OnLineCustomer] WHERE [Company]=@Company"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("Company", company); using (var reader = dbOperator.ExecuteReader(sql)) { while (reader.Read()) { view = new OnLineCustomerView(); view.Title = reader.GetString(0); view.Content = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); } } } return(view); }
protected void btnSave_Click(object sender, EventArgs e) { string title = ""; string content = ""; if (!string.IsNullOrWhiteSpace(this.txtTitle.Text)) { title = this.txtTitle.Text.ToLower().Replace("script", "").Replace("eval", "").Replace(" ", " ").Trim(); if (title.IndexOf('<') != -1 || title.IndexOf('>') != -1) { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('客服服务标题禁止包含 < > 特殊符号!请重新输入');", true); return; } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('客服服务标题不能为空');", true); return; } if (!string.IsNullOrWhiteSpace(this.ftbContent.Text)) { content = ftbContent.Text.ToLower().Replace("script", "").Replace("eval", "").Replace(" ", " ").Trim(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('客服服务内容不能为空');", true); return; } try { OnLineCustomerView view = new OnLineCustomerView(); view.Title = title; view.Content = content; OnLineCustomerService.SavePlatForm(this.CurrentCompany.CompanyId, view, this.CurrentUser.Name, ChinaPay.B3B.Service.Organization.OEMService.QueryOEM(CurrentCompany.CompanyId) != null ? PublishRoles.OEM : PublishRoles.平台); RegisterScript("alert('保存成功');window.location.href='OnLineServiceSet.aspx';", false); }catch (Exception ex) { ShowExceptionMessage(ex, "保存"); } }