Ejemplo n.º 1
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string    strOldDeptName = ((Label)this.GridView1.Rows[e.RowIndex].Cells[9].Controls[1]).Text;
            Hashtable htapp          = (Hashtable)Application["appconf"];
            string    strcons        = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);
            try
            {
                bool success = busiq.DeleteDeptInfo(strOldDeptName);
                if (!success)
                {
                    this.SetErrorMsgPageBydir("门店信息删除出错,请重试!");
                    return;
                }
                else
                {
                    this.Query();
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("门店信息删除错误,请重试!");
                return;
            }
        }
Ejemplo n.º 2
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string strSerial = this.GridView1.Rows[e.RowIndex].Cells[0].Text;
            string strDeptId = this.GridView1.Rows[e.RowIndex].Cells[11].Text;

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);
            try
            {
                bool success = busiq.DeleteConsItemUndo(strSerial, strDeptId);
                if (!success)
                {
                    this.SetErrorMsgPageBydir("取消撤销出错,请重试!");
                    return;
                }
                else
                {
                    this.btQuery_Click(null, null);
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("取消撤销错误,请重试!");
                return;
            }
        }
Ejemplo n.º 3
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string month     = GridView1.Rows[e.RowIndex].Cells[2].Text;
            string deptId    = GridView1.Rows[e.RowIndex].Cells[3].Text;
            string strAmount = (GridView1.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox).Text;

            if (string.IsNullOrEmpty(strAmount))
            {
                this.Popup("请输入指标");
                return;
            }
            if (!this.JudgeIsNum(strAmount))
            {
                this.Popup("指标请输入数字");
                return;
            }

            decimal amount = Convert.ToDecimal(strAmount);

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);

            if (!busiq.UpdateKPI(month, deptId, amount))
            {
                this.Popup("编辑指标失败,请重试!");
            }
            else
            {
                GridView1.EditIndex = -1;
                Button1_Click(null, null);
            }
        }
Ejemplo n.º 4
0
        private void Query()
        {
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);

            try
            {
                DataTable dtout = busiq.DeptInfoQuery();
                if (dtout == null)
                {
                    this.SetErrorMsgPageBydir("查询出错,请重试!");
                    return;
                }
                else
                {
                    this.GridView1.DataSource = dtout;
                    this.GridView1.DataBind();
                    Session["DeptInfo"] = dtout;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
Ejemplo n.º 5
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string strSerial = this.GridView1.Rows[e.RowIndex].Cells[0].Text;
            string strDeptId = this.GridView1.Rows[e.RowIndex].Cells[11].Text;
            string strFlag   = this.GridView1.Rows[e.RowIndex].Cells[8].Text;

            if (strFlag != "正常消费")
            {
                this.Popup("撤销已审核");
                return;
            }
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);
            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
            try
            {
                busiq.CheckConsItemUndo(strSerial, strDeptId, ls1.strLoginID);
                this.btQuery_Click(null, null);
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("审核出错,请重试!");
                return;
            }
        }
Ejemplo n.º 6
0
        private void DBBind()
        {
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            BusiComm.BusiQuery bq = new BusiComm.BusiQuery(strcons);
            DataTable          dt = bq.GetExpInvList();

            Session["ExpInvList"]     = dt;
            this.DataGrid1.DataSource = dt;
            this.DataGrid1.PageSize   = 10;
            this.DataGrid1.DataBind();
        }
Ejemplo n.º 7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //查询
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);

            DataTable dtout = busiq.GetKPIOfMonth(ddlMonth.SelectedValue, ddlDeptId.SelectedValue);

            this.DataTableConvert(dtout, "vcDeptId", "tbCommCode", "vcCommSign='MD'");
            this.GridView1.DataSource = dtout;
            this.GridView1.DataBind();
        }
Ejemplo n.º 8
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string strDeptName     = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[0].Controls[1]).Text;
            string strAddress      = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[1]).Text;
            string strTel          = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[1]).Text;
            string strManager      = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[1]).Text;
            string strManagerPhone = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[4].Controls[1]).Text;
            string strAdsl         = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[5].Controls[1]).Text;
            string strAdslPwd      = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[6].Controls[1]).Text;
            string strVpn          = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[7].Controls[1]).Text;
            string strVpnPwd       = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[8].Controls[1]).Text;
            string strOldDeptName  = ((Label)this.GridView1.Rows[e.RowIndex].Cells[9].Controls[1]).Text;

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);
            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
            try
            {
                bool exist = busiq.ExistDeptInfo(strDeptName);
                if (strDeptName != strOldDeptName && exist)
                {
                    this.Popup("门店已存在");
                    return;
                }
                bool success = busiq.UpdateDeptInfo(strOldDeptName, strDeptName, strAddress, strTel, strManager, strManagerPhone, strAdsl, strAdslPwd, strVpn, strVpnPwd);
                if (!success)
                {
                    this.SetErrorMsgPageBydir("门店信息修改出错,请重试!");
                    return;
                }
                else
                {
                    this.GridView1.EditIndex = -1;
                    this.Query();
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("门店信息修改错误,请重试!");
                return;
            }
        }
Ejemplo n.º 9
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ddlMonth.SelectedValue))
            {
                this.Popup("请选择月份");
                return;
            }
            if (string.IsNullOrEmpty(ddlDeptId.SelectedValue))
            {
                this.Popup("请选择门店");
                return;
            }
            if (string.IsNullOrEmpty(txtAmount.Text))
            {
                this.Popup("请输入指标");
                return;
            }
            if (!this.JudgeIsNum(txtAmount.Text))
            {
                this.Popup("指标请输入数字");
                return;
            }
            //添加
            string  month  = ddlMonth.SelectedValue;
            string  deptId = ddlDeptId.SelectedValue;
            decimal amount = Convert.ToDecimal(txtAmount.Text);

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);
            if (busiq.ExistKPI(month, deptId))
            {
                this.Popup("指标已存在,请重新选择!");
                return;
            }
            if (!busiq.InsertKPI(month, deptId, amount))
            {
                this.Popup("添加指标失败,请重试!");
            }
            else
            {
                Button1_Click(null, null);
            }
        }
Ejemplo n.º 10
0
        protected void btQuery_Click(object sender, EventArgs e)
        {
            if (this.txtBegin.Text == "" || this.txtEnd.Text == "")
            {
                this.SetErrorMsgPageBydir("时间不能为空,请重新选择时间!");
                return;
            }

            string strBeginDate = Convert.ToDateTime(this.txtBegin.Text).ToString("yyyy-MM-dd");
            string strEndDate   = Convert.ToDateTime(this.txtEnd.Text).AddDays(1).ToString("yyyy-MM-dd");


            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);

            string strSerial   = txtSerial.Text.Trim();
            string strOperName = ddlOper.SelectedValue;
            string strDeptID   = ddlDept.SelectedValue;
            string strIsUndo   = this.DropDownList1.SelectedValue;

            try
            {
                DataTable dtout = busiq.ConsItemUndoQuery(strSerial, strBeginDate, strEndDate, strOperName, strDeptID, strIsUndo, "0");
                if (dtout == null)
                {
                    this.SetErrorMsgPageBydir("查询出错,请重试!");
                    return;
                }
                else
                {
                    this.GridView1.DataSource = dtout;
                    this.GridView1.DataBind();
                    Session["ConsItemUndo"] = dtout;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
Ejemplo n.º 11
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string strSerial = this.GridView1.Rows[e.RowIndex].Cells[0].Text;
            string strDeptId = this.GridView1.Rows[e.RowIndex].Cells[11].Text;
            string strFlag   = this.GridView1.Rows[e.RowIndex].Cells[8].Text;

            if (strFlag != "正常消费")
            {
                this.Popup("撤销已审核");
                return;
            }
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);
            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
            try
            {
                bool exist = busiq.ExistConsItemUndo(strSerial, strDeptId);
                if (exist)
                {
                    this.Popup("已撤销");
                    return;
                }
                bool success = busiq.InsertConsItemUndo(strSerial, ls1.strOperName, strDeptId);
                if (!success)
                {
                    this.SetErrorMsgPageBydir("零售撤销出错,请重试!");
                    return;
                }
                else
                {
                    this.GridView1.EditIndex = -1;
                    this.btQuery_Click(null, null);
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("零售撤销错误,请重试!");
                return;
            }
        }
Ejemplo n.º 12
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string month  = GridView1.Rows[e.RowIndex].Cells[2].Text;
            string deptId = GridView1.Rows[e.RowIndex].Cells[3].Text;

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);

            if (!busiq.DeleteKPI(month, deptId))
            {
                this.Popup("删除指标失败,请重试!");
            }
            else
            {
                Button1_Click(null, null);
            }
        }
        private void GetKPI(bool IsUpdate)
        {
            //查询数据
            if (string.IsNullOrEmpty(txtDate.Text))
            {
                this.Popup("请输入日期");
                return;
            }
            DateTime  dtDate  = DateTime.Parse(txtDate.Text);
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);

            DataSet ds = busiq.GetKPI(dtDate, txtWeather.Text, txtException.Text, IsUpdate);

            lblWeek.Text                  = "......";
            txtWeather.Text               = "";
            txtException.Text             = "";
            lblMonthAmount.Text           = "......";
            lblLastYearMonthAmount.Text   = "......";
            lblAmount.Text                = "......";
            lblLastYearDateAmount.Text    = "......";
            lblDifLastYearDateAmount.Text = "......";
            lblSum.Text        = "......";
            lblRatio.Text      = "......";
            lblMonthRatio.Text = "......";
            lblQuantity.Text   = "......";
            lblPrice.Text      = "......";
            //去年同月业绩
            if (ds.Tables.Contains("LastYearKPIOfDept"))
            {
                DataTable dt1 = ds.Tables["LastYearKPIOfDept"];
                object    obj = dt1.Compute("Sum([Sum])", "");
                if (obj != null)
                {
                    lblLastYearMonthAmount.Text = obj.ToString();
                }
            }
            //去年同一天
            decimal lastYearDateAmount = 0;

            if (ds.Tables.Contains("LastYearDateKPIOfDept"))
            {
                DataTable dt3 = ds.Tables["LastYearDateKPIOfDept"];
                object    obj = dt3.Compute("Sum([Amount])", "");
                if (obj != null)
                {
                    string strLastYearDateAmount = obj.ToString();
                    lastYearDateAmount         = Convert.ToDecimal(strLastYearDateAmount);
                    lblLastYearDateAmount.Text = strLastYearDateAmount;
                }
            }
            //业绩
            decimal amount = 0;
            decimal sum    = 0;

            if (ds.Tables.Contains("KPIOfDay"))
            {
                DataTable dt4 = ds.Tables["KPIOfDay"];
                DataRow   dr  = dt4.Rows[0];

                string strAmount = dr["Amount"].ToString();
                if (!string.IsNullOrEmpty(strAmount))
                {
                    lblAmount.Text = strAmount;
                    amount         = Convert.ToDecimal(strAmount);
                }

                string strSum = dr["Sum"].ToString();
                if (!string.IsNullOrEmpty(strSum))
                {
                    sum         = Convert.ToDecimal(strSum);
                    lblSum.Text = strSum;
                }
                lblDifLastYearDateAmount.Text = (amount - lastYearDateAmount).ToString();

                lblQuantity.Text  = dr["Quantity"].ToString();
                lblPrice.Text     = dr["Price"].ToString();
                txtException.Text = dr["Exception"].ToString();
                txtWeather.Text   = dr["Weather"].ToString();
                string strWeek = dr["Week"].ToString();
                if (!string.IsNullOrEmpty(strWeek))
                {
                    int iWeek = Convert.ToInt32(strWeek);
                    switch (iWeek)
                    {
                    case 0:
                        lblWeek.Text = "日";
                        break;

                    case 1:
                        lblWeek.Text = "一";
                        break;

                    case 2:
                        lblWeek.Text = "二";
                        break;

                    case 3:
                        lblWeek.Text = "三";
                        break;

                    case 4:
                        lblWeek.Text = "四";
                        break;

                    case 5:
                        lblWeek.Text = "五";
                        break;

                    case 6:
                        lblWeek.Text = "六";
                        break;
                    }
                }
            }
            //门店业绩
            if (ds.Tables.Contains("KPIOfDept"))
            {
                DataTable dt2 = ds.Tables["KPIOfDept"];
                //指标
                decimal kpi = 0;
                if (ds.Tables.Contains("KPIOfMonth"))
                {
                    DataTable dt6 = ds.Tables["KPIOfMonth"];
                    //object obj = dt6.Compute("Sum([Amount])", "");
                    //if (obj != null)
                    //{
                    //    string strKpi = obj.ToString();
                    //    lblMonthAmount.Text = strKpi;

                    //    kpi = Convert.ToDecimal(strKpi);
                    //    lblRatio.Text = (Math.Round(sum / (kpi == 0 ? 1 : kpi),2) * 100).ToString() + "%";
                    //    lblMonthRatio.Text = (Math.Round(sum / dtDate.Day * DateTime.DaysInMonth(dtDate.Year, dtDate.Month) / (kpi == 0 ? 1 : kpi), 2) * 100).ToString() + "%";
                    //}

                    this.DataTableConvert(dt2, "vcDeptId", "tbCommCode", "vcCommSign ='MD'");
                    lKPIOfDept = new List <KPIOfDept>();
                    int     serial        = 0;
                    decimal deptKpiSum    = 0;
                    decimal deptAmountSum = 0;
                    decimal deptSumSum    = 0;

                    foreach (DataRow dr in dt2.Rows)
                    {
                        KPIOfDept dept = new KPIOfDept();
                        serial         += 1;
                        dept.Serial     = serial.ToString();
                        dept.vcDeptName = dr["vcDeptIdComments"].ToString();
                        string    strDeptId = dr["vcDeptId"].ToString();
                        DataRow[] drs       = dt6.Select("vcDeptId='" + strDeptId + "'");
                        if (drs.Length > 0)
                        {
                            dept.Kpi = drs[0]["Amount"].ToString();
                        }
                        dept.Amount = dr["Amount"].ToString();
                        dept.Sum    = dr["Sum"].ToString();
                        decimal deptkpi    = 0;
                        decimal deptSum    = 0;
                        decimal deptAmount = 0;
                        if (!string.IsNullOrEmpty(dept.Kpi))
                        {
                            deptkpi     = Convert.ToDecimal(dept.Kpi);
                            deptKpiSum += deptkpi;
                        }
                        if (!string.IsNullOrEmpty(dept.Sum))
                        {
                            deptSum     = Convert.ToDecimal(dept.Sum);
                            deptSumSum += deptSum;
                        }
                        if (!string.IsNullOrEmpty(dept.Amount))
                        {
                            deptAmount     = Convert.ToDecimal(dept.Amount);
                            deptAmountSum += deptAmount;
                        }
                        dept.Ratio      = (Math.Round(deptSum / (deptkpi == 0 ? 1 : deptkpi), 2) * 100).ToString() + "%";
                        dept.MonthRatio = (Math.Round(deptSum / dtDate.Day * DateTime.DaysInMonth(dtDate.Year, dtDate.Month) / (deptkpi == 0 ? 1 : deptkpi), 2) * 100).ToString() + "%";
                        lKPIOfDept.Add(dept);
                    }
                    KPIOfDept deptTotal = new KPIOfDept();
                    deptTotal.Serial     = "合计";
                    deptTotal.Kpi        = deptKpiSum.ToString();
                    deptTotal.Amount     = deptAmountSum.ToString();
                    deptTotal.Sum        = deptSumSum.ToString();
                    deptTotal.Ratio      = (Math.Round(deptSumSum / (deptKpiSum == 0 ? 1 : deptKpiSum), 2) * 100).ToString() + "%";
                    deptTotal.MonthRatio = (Math.Round(deptSumSum / dtDate.Day * DateTime.DaysInMonth(dtDate.Year, dtDate.Month) / (deptKpiSum == 0 ? 1 : deptKpiSum), 2) * 100).ToString() + "%";
                    lKPIOfDept.Add(deptTotal);

                    lblMonthAmount.Text = deptTotal.Kpi;
                    lblRatio.Text       = deptTotal.Ratio;
                    lblMonthRatio.Text  = deptTotal.MonthRatio;
                }
            }


            //新品及重点产品业绩
            if (ds.Tables.Contains("KPIOfGoods"))
            {
                DataTable dt5 = ds.Tables["KPIOfGoods"];
                if (ds.Tables.Contains("tbGoods"))
                {
                    DataTable dt8  = ds.Tables["tbGoods"];
                    int       inew = 0;
                    int       ikey = 0;
                    lKPIOfGoods = new List <KPIOfGoods>();
                    foreach (DataRow dr in dt8.Rows)
                    {
                        KPIOfGoods goods  = new KPIOfGoods();
                        string     strNew = dr["IsNew"].ToString();
                        bool       bNew   = false;
                        if (!string.IsNullOrEmpty(strNew))
                        {
                            bNew = Convert.ToBoolean(strNew);
                        }
                        string strKey = dr["IsKey"].ToString();
                        bool   bKey   = false;
                        if (!string.IsNullOrEmpty(strKey))
                        {
                            bKey = Convert.ToBoolean(strKey);
                        }
                        if (bNew)
                        {
                            inew      += 1;
                            goods.Desc = "新品名称" + inew.ToString();
                        }
                        if (bKey)
                        {
                            ikey      += 1;
                            goods.Desc = "重点产品" + ikey.ToString();
                        }
                        goods.vcGoodsName = dr["vcGoodsName"].ToString();
                        string strNewDate = dr["NewDate"].ToString();
                        if (!string.IsNullOrEmpty(strNewDate))
                        {
                            goods.NewDate = DateTime.Parse(strNewDate).ToString("yyyy-MM-dd");
                        }
                        goods.Unit = dr["Unit"].ToString();
                        string    strGoodsId = dr["vcGoodsId"].ToString();
                        DataRow[] drs        = dt5.Select("vcGoodsId='" + strGoodsId + "'");
                        if (drs.Length > 0)
                        {
                            goods.Quantity = drs[0]["Quantity"].ToString();
                            goods.Amount   = drs[0]["Amount"].ToString();
                        }
                        lKPIOfGoods.Add(goods);
                    }
                }
            }

            //前一天
            if (ds.Tables.Contains("BeforeDateKPIOfDept"))
            {
                DataTable dt7 = ds.Tables["BeforeDateKPIOfDept"];
                object    obj = dt7.Compute("Sum([Amount])", "");
                if (obj != null)
                {
                    string  strLastDateAmount = obj.ToString();
                    decimal lastDateAmount    = Convert.ToDecimal(strLastDateAmount);
                    lblDifLastDateAmount.Text = (amount - lastDateAmount).ToString();
                }
            }
        }
Ejemplo n.º 14
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strDeptName     = "";
            string strAddress      = "";
            string strTel          = "";
            string strManager      = "";
            string strManagerPhone = "";
            string strAdsl         = "";
            string strAdslPwd      = "";
            string strVpn          = "";
            string strVpnPwd       = "";

            if (e.CommandName == "EmptyInsert")
            {
                strDeptName     = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtDeptName")).Text;
                strAddress      = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtAddress")).Text;
                strTel          = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtTel")).Text;
                strManager      = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtManager")).Text;
                strManagerPhone = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtManagerPhone")).Text;
                strAdsl         = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtAdsl")).Text;
                strAdslPwd      = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtAdslPwd")).Text;
                strVpn          = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtVpn")).Text;
                strVpnPwd       = ((TextBox)GridView1.Controls[0].Controls[0].Controls[0].FindControl("txtVpnPwd")).Text;
            }
            else if (e.CommandName == "Insert")
            {
                strDeptName     = ((TextBox)GridView1.FooterRow.Cells[0].Controls[1]).Text;
                strAddress      = ((TextBox)GridView1.FooterRow.Cells[1].Controls[1]).Text;
                strTel          = ((TextBox)GridView1.FooterRow.Cells[2].Controls[1]).Text;
                strManager      = ((TextBox)GridView1.FooterRow.Cells[3].Controls[1]).Text;
                strManagerPhone = ((TextBox)GridView1.FooterRow.Cells[4].Controls[1]).Text;
                strAdsl         = ((TextBox)GridView1.FooterRow.Cells[5].Controls[1]).Text;
                strAdslPwd      = ((TextBox)GridView1.FooterRow.Cells[6].Controls[1]).Text;
                strVpn          = ((TextBox)GridView1.FooterRow.Cells[7].Controls[1]).Text;
                strVpnPwd       = ((TextBox)GridView1.FooterRow.Cells[8].Controls[1]).Text;
            }
            else
            {
                return;
            }
            if (string.IsNullOrEmpty(strDeptName))
            {
                this.Popup("门店不能为空");
                return;
            }
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            busiq = new BusiComm.BusiQuery(strcons);
            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
            try
            {
                bool exist = busiq.ExistDeptInfo(strDeptName);
                if (exist)
                {
                    this.Popup("门店已存在");
                    return;
                }
                bool success = busiq.InsertDeptInfo(strDeptName, strAddress, strTel, strManager, strManagerPhone, strAdsl, strAdslPwd, strVpn, strVpnPwd);
                if (!success)
                {
                    this.SetErrorMsgPageBydir("门店信息添加出错,请重试!");
                    return;
                }
                else
                {
                    this.GridView1.EditIndex = -1;
                    this.Query();
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("门店信息添加错误,请重试!");
                return;
            }
        }
Ejemplo n.º 15
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                //查询
                Session.Remove("QUERY");
                Session.Remove("toExcel");

                Hashtable htapp   = (Hashtable)Application["appconf"];
                string    strcons = (string)htapp["cons"];
                busiq = new BusiComm.BusiQuery(strcons);

                DataTable tbCommCode   = (DataTable)Application["tbCommCode"];
                DataRow[] drs          = tbCommCode.Select("vcCommSign ='GT'");
                string    strGoodsType = "[累计业绩],";
                foreach (DataRow dr in drs)
                {
                    strGoodsType += "[" + dr["vcCommName"].ToString() + "],[" + dr["vcCommName"].ToString() + "占比],";
                }
                strGoodsType = strGoodsType.TrimEnd(',');

                DataTable dtout = busiq.GetSaleRatio(ddlMonths.SelectedValue, strGoodsType);
                foreach (DataRow dr in dtout.Rows)
                {
                    decimal sum = 0;
                    foreach (DataRow dr1 in drs)
                    {
                        string value = dr[dr1["vcCommName"].ToString()].ToString();
                        if (!string.IsNullOrEmpty(value))
                        {
                            sum += decimal.Parse(value);
                        }
                    }
                    dr["累计业绩"] = sum;
                    if (sum > 0)
                    {
                        foreach (DataRow dr1 in drs)
                        {
                            string value = dr[dr1["vcCommName"].ToString()].ToString();
                            if (!string.IsNullOrEmpty(value))
                            {
                                dr[dr1["vcCommName"].ToString() + "占比"] = Math.Round(decimal.Parse(value) / sum * 100, 2);
                            }
                        }
                    }
                }

                dtout.TableName = "月份各类产品销售占比表";
                DataTable dtexcel = dtout.Copy();
                Session["QUERY"]   = dtout;
                Session["toExcel"] = dtexcel;
                CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
                if (dtout.Rows.Count <= 0)
                {
                    Button2.Enabled = false;
                }
                else
                {
                    if (ls1.strLimit == "CL001")
                    {
                        Button2.Enabled = true;
                    }
                }
                UcPageView1.MyDataGrid.PageSize = 30;
                DataView dvOut = new DataView(dtout);
                this.UcPageView1.MyDataSource = dvOut;
                this.UcPageView1.BindGrid();
            }
            catch (Exception ex)
            {
                this.clog.WriteLine(ex);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }