ERP渠道活动管理(二十六)

网友投稿 273 2022-09-05

ERP渠道活动管理(二十六)

设计意义:

渠道活动的方式方法多种多样。不过,大至可分为销售型促销与市场型促销(一般来说,销售型促销以完成销售额为唯一目的,以奖励返点为唯一手段,以增大经销商库存为最终结果,短期行为明显。而市场型促销以完成销售额为最终目的—不是唯一目的,以市场的管理工作、市场基础投入、培训导购、终端建设、卖场活性化、现场促销、市场研究等为手段,以市场的良性建康发展为结果。

需求:

1.基本信息:         活动名称,所属渠道,活动时间,活动地点,活动负责人,活动描述,状态。2.相关业务:        活动信息记录,活动信息查询,活动信息修改(改变状态)。

存储过程的封装:

CREATE PROCEDURE BioErpCrmChannelActivity_ADD@ActiveName nvarchar(100),@ChannelID int,@ActivityTime datetime,@ActivityAddress nvarchar(100),@Principal nvarchar(10),@ActivityDesc nvarchar(4000) AS INSERT INTO [BioErpCrmChannelActivity]( [ActiveName],[ChannelID],[ActivityTime],[ActivityAddress],[Principal],[ActivityDesc] )VALUES( @ActiveName,@ChannelID,@ActivityTime,@ActivityAddress,@Principal,@ActivityDesc )

CREATE PROCEDURE BioErpCrmChannelActivity_Update@ActivityID int,@ActiveName nvarchar(100),@ChannelID int,@ActivityTime datetime,@ActivityAddress nvarchar(100),@Principal nvarchar(10),@ActivityDesc nvarchar(4000),@DeleteState bit AS UPDATE [BioErpCrmChannelActivity] SET [ActiveName] = @ActiveName,[ChannelID] = @ChannelID,[ActivityTime] = @ActivityTime,[ActivityAddress] = @ActivityAddress,[Principal] = @Principal,[ActivityDesc] = @ActivityDesc,[DeleteState] = @DeleteState WHERE ActivityID=@ActivityID

创建活动编号返回活动的视图:

CREATE VIEW dbo.View_CRMChannelActivityASSELECT dbo.BioErpCrmManageChannel.ChannelName, dbo.BioErpCrmChannelActivity.*FROM dbo.BioErpCrmChannelActivity INNER JOIN dbo.BioErpCrmManageChannel ON dbo.BioErpCrmChannelActivity.ChannelID = dbo.BioErpCrmManageChannel.ChannelID

BLL层:

///

/// 添加一条活动信息 /// /// /// public int ChannelActiveAdd(BioErpCrmChannelActivity active) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@ChannelID",active.ChannelID), new SqlParameter("@ActiveName",active.ActiveName), new SqlParameter("@ActivityTime",active.ActivityTime), new SqlParameter("@ActivityAddress",active.ActivityAddress), new SqlParameter("@Principal",active.Principal), new SqlParameter("@ActivityDesc",active.ActivityDesc), }; return DAL.DataBaseHelper.ExcuteSqlReturnInt("BioErpCrmChannelActivity_ADD",CommandType.StoredProcedure,pars); } /// /// 修改一条活动信息 /// /// /// public int ChannelActiveUpdate(BioErpCrmChannelActivity active) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@ActivityID",active.ActivityID), new SqlParameter("@ChannelID",active.ChannelID), new SqlParameter("@ActiveName",active.ActiveName), new SqlParameter("@ActivityTime",active.ActivityTime), new SqlParameter("@ActivityAddress",active.ActivityAddress), new SqlParameter("@Principal",active.Principal), new SqlParameter("@ActivityDesc",active.ActivityDesc), }; return DAL.DataBaseHelper.ExcuteSqlReturnInt("BioErpCrmChannelActivity_Update", CommandType.StoredProcedure, pars); } /// /// 根据活动编号返回活动的视图对象 /// /// id /// ViewCRMChannelActivity public ViewCRMChannelActivity getViewActiveityByActivityID(string id) { SqlDataReader reader= SqlComm.GetDataReaderByCondition("View_CRMChannelActivity", "*", " id=" + id); ViewCRMChannelActivity active = null; while (reader.Read()) { active = new ViewCRMChannelActivity() { ActiveName = reader["ActiveName"].ToString(), ActivityAddress = reader["ActivityAddress"].ToString(), ActivityDesc = reader["ActivityDesc"].ToString(), ActivityID =int.Parse( reader["ActivityID"].ToString()), ActivityTime = Convert.ToDateTime(reader["ActivityTime"].ToString()), ChannelID = int.Parse(reader["ChannelID"].ToString()), ChannelName = reader["ChannelName"].ToString(), DeleteState =Convert.ToBoolean( reader["DeleteState"].ToString()), Principal = reader["Principal"].ToString() }; } reader.Close(); return active; }

添加的前端:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelAcitiveAdd.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannelAcitive.ChannelAcitiveAdd" %>

活动信息记录
活动名称
所属渠道
活动负责人
活动时间
活动地点
活动描述

添加的后端代码:

protected void btnSubmit_Click(object sender, EventArgs e) { BioErpCrmChannelActivity activity = new BioErpCrmChannelActivity() { ActiveName = this.txtName.Text, Principal = this.txtPrincipal.Text, ActivityAddress = this.txtAddress.Text, ActivityTime = Convert.ToDateTime(this.txtTime.Text.ToString()), ActivityDesc = this.txtActivityDesc.Text.Trim(), ChannelID = int.Parse(this.txtSuperChannelID.Text.Trim()) }; ChannelActiveBLL activebll = new ChannelActiveBLL(); if (activebll.ChannelActiveAdd(activity) != 0) { Server.Transfer("ChannelAcitiveListShow.aspx"); } else { ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('活动记录提交失败')", true); } } protected void btnReturn_Click(object sender, EventArgs e) { Server.Transfer("ChannelAcitiveListShow.aspx"); }

前端查询和显示的代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelAcitiveListShow.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannelAcitive.ChannelAcitiveListShow" %><%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %><%@ Register src="https://www.apispace.com/news/zb_users/upload/2022/09/20220905124526_65685.gif" onclick="imgbutnSearch_Click" />

查询的代码:

///

/// 查询所有联系人信息 /// private void getallPageList() { string id = Session["Userid"].ToString(); //condition += " and UserID=" + id; //if (UserLogin.user.RoleId == 6) //市场部经理 //{ // condition += " or UserID !=" + id; //} this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("dbo.View_CRMChannelActivity", condition); this.AspNetPager1.PageSize = pagesize; this.GridView1.DataSource = SqlComm.getDataByPageIndex("dbo.View_CRMChannelActivity", "*", "ActivityID", condition, pageindex, pagesize); this.GridView1.DataBind(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { pageindex = this.AspNetPager1.CurrentPageIndex - 1; getallPageList(); } protected void imgbutnSearch_Click(object sender, ImageClickEventArgs e) { pageindex = 0; condition = ""; if (txtName.Text.Trim() != null && this.txtName.Text.Trim().Length != 0) { condition = condition + " and ActiveName like '" + txtName.Text + "%'"; } if (this.txtCName.Text.Trim() != null && this.txtCName.Text.Trim().Length != 0) { condition = condition + " and ChannelName like '" + txtCName.Text + "%'"; } if (this.txtDate.Text.Trim() != null && this.txtDate.Text.Trim().Length!=0) { condition = condition + " and (ActivityTime >= '" + this.txtDate.Text + "' AND ActivityTime< '" + Convert.ToDateTime(this.txtDate.Text).AddDays(1) + "')"; } condition = condition + " and DeleteState=" + this.ddlSate.SelectedValue.ToString(); getallPageList(); }

活动记录显示:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelAcitiveDetial.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannelAcitive.ChannelAcitiveDetial" %>