Beispiel #1
0
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="adversarySellModel"></param>
        /// <returns></returns>
        public static int?Insert(AdversarySellModel adversarySellModel)
        {
            int?          id     = null;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into officedba.AdversarySell(");
            strSql.Append("CompanyCD,CustNo,ChanceID,CustID,Project,Price,Power,Advantage,disadvantage,Policy,Remark,Creator,CreatDate,ModifiedDate,ModifiedUserID)");
            strSql.Append(" values (");
            strSql.Append("@CompanyCD,@CustNo,@ChanceID,@CustID,@Project,@Price,@Power,@Advantage,@disadvantage,@Policy,@Remark,@Creator,getdate(),getdate(),@ModifiedUserID)");
            strSql.Append(";select @@IDENTITY");
            #region 参数
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyCD",      SqlDbType.VarChar,    8),
                new SqlParameter("@CustNo",         SqlDbType.VarChar,   50),
                new SqlParameter("@ChanceID",       SqlDbType.Int,        4),
                new SqlParameter("@CustID",         SqlDbType.Int,        4),
                new SqlParameter("@Project",        SqlDbType.VarChar, 2000),
                new SqlParameter("@Price",          SqlDbType.Decimal,    9),
                new SqlParameter("@Power",          SqlDbType.VarChar, 2000),
                new SqlParameter("@Advantage",      SqlDbType.VarChar, 2000),
                new SqlParameter("@disadvantage",   SqlDbType.VarChar, 2000),
                new SqlParameter("@Policy",         SqlDbType.VarChar, 2000),
                new SqlParameter("@Remark",         SqlDbType.VarChar, 2000),
                new SqlParameter("@Creator",        SqlDbType.Int,        4),
                new SqlParameter("@ModifiedUserID", SqlDbType.VarChar, 10)
            };
            parameters[0].Value  = adversarySellModel.CompanyCD;
            parameters[1].Value  = adversarySellModel.CustNo;
            parameters[2].Value  = adversarySellModel.ChanceID;
            parameters[3].Value  = adversarySellModel.CustID;
            parameters[4].Value  = adversarySellModel.Project;
            parameters[5].Value  = adversarySellModel.Price;
            parameters[6].Value  = adversarySellModel.Power;
            parameters[7].Value  = adversarySellModel.Advantage;
            parameters[8].Value  = adversarySellModel.disadvantage;
            parameters[9].Value  = adversarySellModel.Policy;
            parameters[10].Value = adversarySellModel.Remark;
            parameters[11].Value = adversarySellModel.Creator;
            parameters[12].Value = adversarySellModel.ModifiedUserID;
            foreach (SqlParameter para in parameters)
            {
                if (para.Value == null)
                {
                    para.Value = DBNull.Value;
                }
            }
            #endregion

            object obj = SqlHelper.ExecuteScalar(strSql.ToString(), parameters);
            if (obj != null)
            {
                id = Convert.ToInt32(obj);
            }
            return(id);
        }
Beispiel #2
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="adversarySellModel"></param>
        public static bool Update(AdversarySellModel adversarySellModel)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update officedba.AdversarySell set ");
            strSql.Append("CustNo=@CustNo,");
            strSql.Append("ChanceID=@ChanceID,");
            strSql.Append("CustID=@CustID,");
            strSql.Append("Project=@Project,");
            strSql.Append("Price=@Price,");
            strSql.Append("Power=@Power,");
            strSql.Append("Advantage=@Advantage,");
            strSql.Append("disadvantage=@disadvantage,");
            strSql.Append("Policy=@Policy,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("ModifiedDate=getdate(),");
            strSql.Append("ModifiedUserID=@ModifiedUserID");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",             SqlDbType.Int,        4),
                new SqlParameter("@CustNo",         SqlDbType.VarChar,   50),
                new SqlParameter("@ChanceID",       SqlDbType.Int,        4),
                new SqlParameter("@CustID",         SqlDbType.Int,        4),
                new SqlParameter("@Project",        SqlDbType.VarChar, 2000),
                new SqlParameter("@Price",          SqlDbType.Decimal,    9),
                new SqlParameter("@Power",          SqlDbType.VarChar, 2000),
                new SqlParameter("@Advantage",      SqlDbType.VarChar, 2000),
                new SqlParameter("@disadvantage",   SqlDbType.VarChar, 2000),
                new SqlParameter("@Policy",         SqlDbType.VarChar, 2000),
                new SqlParameter("@Remark",         SqlDbType.VarChar, 2000),
                new SqlParameter("@ModifiedUserID", SqlDbType.VarChar, 10)
            };
            parameters[0].Value  = adversarySellModel.ID;
            parameters[1].Value  = adversarySellModel.CustNo;
            parameters[2].Value  = adversarySellModel.ChanceID;
            parameters[3].Value  = adversarySellModel.CustID;
            parameters[4].Value  = adversarySellModel.Project;
            parameters[5].Value  = adversarySellModel.Price;
            parameters[6].Value  = adversarySellModel.Power;
            parameters[7].Value  = adversarySellModel.Advantage;
            parameters[8].Value  = adversarySellModel.disadvantage;
            parameters[9].Value  = adversarySellModel.Policy;
            parameters[10].Value = adversarySellModel.Remark;
            parameters[11].Value = adversarySellModel.ModifiedUserID;
            foreach (SqlParameter para in parameters)
            {
                if (para.Value == null)
                {
                    para.Value = DBNull.Value;
                }
            }
            return(SqlHelper.ExecuteTransSql(strSql.ToString(), parameters) == 1 ? true : false);
        }
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        //设置行为参数
        string orderString = hiddExpOrder.Value.Trim();                                                                             //排序
        string order       = "desc";                                                                                                //排序:降序
        string orderBy     = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "CreatDate"; //要排序的字段,如果为空,默认为"ID"

        if (orderString.EndsWith("_a"))
        {
            order = "asc";                                    //排序:升序
        }
        int       pageCount  = int.Parse(hiddExpTotal.Value); //每页显示记录数
        int       pageIndex  = 1;                             //当前页
        int       TotalCount = 0;                             //总记录数
        string    ord        = orderBy + " " + order;         //排序字段
        DataTable dt         = new DataTable();

        AdversarySellModel adversarySellModel = new AdversarySellModel();
        string             strCustNo          = hiddExpCustNo.Value.Trim();
        string             strChanceID        = hiddExpChanceID.Value.Trim();
        string             strCustID          = hiddExpCustID.Value.Trim();



        string CustNo   = strCustNo.Length == 0 ? null : strCustNo;
        int?   ChanceID = strChanceID.Length == 0 ? null : (int?)Convert.ToInt32(strChanceID);
        int?   CustID   = strCustID.Length == 0 ? null : (int?)Convert.ToInt32(strCustID);

        adversarySellModel.CustNo   = CustNo;
        adversarySellModel.ChanceID = ChanceID;
        adversarySellModel.CustID   = CustID;


        dt = AdversarySellBus.GetOrderList(adversarySellModel, pageIndex, pageCount, ord, ref TotalCount);

        //导出标题
        string headerTitle = "对手编号|对手名称|竞争客户|销售机会|创建人|创建日期";

        //string headerTitle = "建档日期|启用状态";
        string[] header = headerTitle.Split('|');

        //导出标题所对应的列字段名称
        string columnFiled = "CustNo|CustName|CustName1|ChanceNo|EmployeeName|CreatDate";

        //string columnFiled = "CreateDate|strUsedStatus";
        string[] field = columnFiled.Split('|');

        XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "销售竞争分析列表");
    }
Beispiel #4
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="adversarySellModel"></param>
        public static bool Update(AdversarySellModel adversarySellModel)
        {
            bool isSucc = false;//是否添加成功
            //定义变量
            string remark = string.Empty;

            try
            {
                isSucc = AdversarySellDBHelper.Update(adversarySellModel);
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            catch (Exception ex)
            {
                //输出日志
                SellLogCommon.WriteSystemLog(ex, LogInfo.LogType.SYSTEM, LogInfo.SystemLogKind.SYSTEM_ERROR, ConstUtil.MODULE_ID_ADVERSARYSELL_ADD);
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_FAILED;
            }
            SellLogCommon.InsertLog(adversarySellModel.CustNo, ConstUtil.MODULE_ID_ADVERSARYSELL_ADD, ConstUtil.CODING_RULE_TABLE_ADVERSARYSELL, remark, ConstUtil.LOG_PROCESS_UPDATE);
            return(isSucc);
        }
Beispiel #5
0
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="adversarySellModel"></param>
        /// <returns></returns>
        public static int?Insert(AdversarySellModel adversarySellModel)
        {
            int?id = null;

            string remark = string.Empty;

            try
            {
                id = AdversarySellDBHelper.Insert(adversarySellModel);
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            catch (Exception ex)
            {
                //输出日志
                SellLogCommon.WriteSystemLog(ex, LogInfo.LogType.SYSTEM, LogInfo.SystemLogKind.SYSTEM_ERROR, ConstUtil.MODULE_ID_ADVERSARYSELL_ADD);
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_FAILED;
            }
            SellLogCommon.InsertLog(adversarySellModel.CustNo, ConstUtil.MODULE_ID_ADVERSARYSELL_ADD, ConstUtil.CODING_RULE_TABLE_ADVERSARYSELL, remark, ConstUtil.LOG_PROCESS_INSERT);

            return(id);
        }
Beispiel #6
0
        /// <summary>
        /// 获取单据列表
        /// </summary>
        /// <param name="sellContractModel">sellContractModel表实体</param>
        /// <param name="FlowStatus">审批状态</param>
        /// <returns></returns>
        public static DataTable GetOrderList(AdversarySellModel adversarySellModel, int pageIndex, int pageCount, string ord, ref int TotalCount)
        {
            string strSql       = string.Empty;
            string strCompanyCD = string.Empty;//单位编号

            strCompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

            strSql  = "SELECT a.CustNo,a.ModifiedDate, CONVERT(varchar(100), a.CreatDate, 23) AS CreatDate, ";
            strSql += "c.CustNo AS CustNo1,isnull(c.CustName,'') as CustName1, ISNULL(e.EmployeeName, '') AS EmployeeName, s.ChanceNo, ";
            strSql += "ad.CustName, a.ID FROM officedba.AdversarySell AS a LEFT OUTER JOIN ";
            strSql += "officedba.AdversaryInfo AS ad ON a.CustNo = ad.CustNo AND a.CompanyCD = ad.CompanyCD ";
            strSql += "LEFT OUTER JOIN officedba.CustInfo AS c ON a.CustID = c.ID LEFT OUTER JOIN ";
            strSql += "officedba.EmployeeInfo AS e ON a.Creator = e.ID LEFT OUTER JOIN ";
            strSql += "officedba.SellChance AS s ON a.ChanceID = s.ID  where  a.CompanyCD=@CompanyCD";

            ArrayList arr = new ArrayList();

            arr.Add(new SqlParameter("@CompanyCD", strCompanyCD));

            if (adversarySellModel.ChanceID != null)
            {
                strSql += " and a.ChanceID= @ChanceID ";
                arr.Add(new SqlParameter("@ChanceID", adversarySellModel.ChanceID));
            }
            if (adversarySellModel.CustID != null)
            {
                strSql += " and a.CustID= @CustID ";
                arr.Add(new SqlParameter("@CustID", adversarySellModel.CustID));
            }
            if (adversarySellModel.CustNo != null)
            {
                strSql += " and a.CustNo like @CustNo ";
                arr.Add(new SqlParameter("@CustNo", "%" + adversarySellModel.CustNo + "%"));
            }
            return(SqlHelper.CreateSqlByPageExcuteSqlArr(strSql.ToString(), pageIndex, pageCount, ord, arr, ref TotalCount));
        }
Beispiel #7
0
 /// <summary>
 /// 获取单据列表
 /// </summary>
 /// <param name="sellContractModel">sellContractModel表实体</param>
 /// <param name="FlowStatus">审批状态</param>
 /// <returns></returns>
 public static DataTable GetOrderList(AdversarySellModel adversarySellModel, int pageIndex, int pageCount, string ord, ref int TotalCount)
 {
     return(AdversarySellDBHelper.GetOrderList(adversarySellModel, pageIndex, pageCount, ord, ref TotalCount));
 }
    protected void LoadPrintInfo()
    {
        PrintParameterSettingModel model = new PrintParameterSettingModel();

        model.CompanyCD     = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        model.BillTypeFlag  = int.Parse(ConstUtil.BILL_TYPEFLAG_SALE);
        model.PrintTypeFlag = ConstUtil.PRINTBILL_ADVERSARYSELL;

        AdversarySellModel modelMRP = new AdversarySellModel();

        modelMRP.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        modelMRP.CustNo    = this.OfferNo;

        /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/
        string[,] aBase =
        {
            { "对手编号",    "CustNo"         },
            { "销售机会",    "ChanceNo"       },
            { "竞争客户",    "CustName"       },

            { "对手产品报价",  "Price"          },

            { "竞争产品/方案", "Project"        },

            { "竞争能力",    "Power"          },

            { "竞争优势",    "Advantage"      },

            { "竞争劣势",    "disadvantage"   },

            { "应对策略",    "Policy"         },

            { "制单人",     "EmployeeName"   },

            { "制单日期",    "CreatDate"      },

            { "最后更新人",   "ModifiedUserID" },

            { "最后更新日期",  "ModifiedDate"   },

            { "备注",      "Remark"         },
        };

        string[,] aDetail = { { "", "" } };


        DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model);
        DataTable dtMRP   = AdversarySellBus.GetRepOrder(OfferNo); //SellOfferBus.GetRepOrder(OfferNo);

        string strBaseFields = "";

        if (dbPrint.Rows.Count > 0)
        {
            isSeted.Value = "1";
            strBaseFields = dbPrint.Rows[0]["BaseFields"].ToString();
        }
        else
        {
            isSeted.Value = "0";
            strBaseFields = "CustNo|ChanceNo|CustName|Price|Project|Power|Advantage|disadvantage|Policy|EmployeeName|CreatDate|ModifiedUserID|ModifiedDate|Remark";
        }

        #region 主表信息
        if (!string.IsNullOrEmpty(strBaseFields))
        {
            tableBase.InnerHtml = WritePrintPageTable("销售竞争分析", strBaseFields, "", aBase, aDetail, dtMRP, null, true);
        }
        #endregion

        #region 明细信息
        //if (!string.IsNullOrEmpty(strDetailFields))
        //{
        //    tableDetail.InnerHtml = WritePrintPageTable("销售合同", strBaseFields, strDetailFields, aBase, aDetail, dtMRP, dtDetail, false);
        //}
        #endregion
    }