Exemplo n.º 1
0
        /// <summary>
        /// Repeater数据绑定
        /// </summary>
        private void RepeaterDataBind()
        {
            string projectID = Request.QueryString["projectID"];

            string where = string.Format(" projectid = '{0}'", projectID);
            DataTable dt = psBll.GetListInnerJoinEmployee(where).Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                lblTaskNo.Text    = dt.Rows[0]["TASKNO"].ToString();
                gvData.DataSource = dt;
                gvData.DataBind();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 绑定Repeater数据
        /// </summary>
        protected void RepeaterDataBind(bool isExport)
        {
            Dictionary <string, string> dicCondition = new Dictionary <string, string>();
            string taskNo          = txtTaskNo.Text.Trim();          //任务编号
            string projectName     = txtProjectName.Text.Trim();     //工程名称
            string shop            = ddlShop.SelectedValue;          //店铺
            string expireDataStart = txtExpireDateStart.Text.Trim(); //截止时间范围开始
            string expireDateEnd   = txtExpireDateEnd.Text.Trim();   //截止时间范围结束
            string expireDateMonth = txtExpireDateMonth.Text.Trim(); //截止时间月份

            //如果截止时间月份,这个快速选择项不为空,那么以这个值为主
            if (!string.IsNullOrEmpty(expireDateMonth))
            {
                expireDataStart = string.Format("{0}-{1}", expireDateMonth, "01 00:00:00");
                DateTime dtExpire    = Convert.ToDateTime(expireDataStart);
                int      daysInMonth = DateTime.DaysInMonth(dtExpire.Year, dtExpire.Month);
                expireDateEnd = string.Format("{0}-{1}{2}", expireDateMonth, daysInMonth.ToString().PadLeft(2, '0'), " 23:59:59");
            }
            string orderDateStart = txtOrderDateStart.Text.Trim(); //下单时间开始
            string orderDateEnd   = txtOrderDateEnd.Text.Trim();   //下单时间结束
            string orderDateMonth = txtOrderDateMonth.Text.Trim(); //截止时间月份

            //如果订单时间月份,这个快速选择项不为空,那么以这个值为主
            if (!string.IsNullOrEmpty(orderDateMonth))
            {
                orderDateStart = string.Format("{0}-{1}", orderDateMonth, "01 00:00:00");
                DateTime dtOrder     = Convert.ToDateTime(orderDateStart);
                int      daysInMonth = DateTime.DaysInMonth(dtOrder.Year, dtOrder.Month);
                orderDateEnd = string.Format("{0}-{1}{2}", orderDateMonth, daysInMonth.ToString().PadLeft(2, '0'), " 23:59:59");
            }
            string orderAmountMin      = txtOrderAmountMin.Text.Trim();      //金额最小值
            string orderAmountMax      = txtOrderAmountMax.Text.Trim();      //金额最大值
            string buildingType        = ddlBuildingType.SelectedValue;      //建筑类型
            string structureForm       = ddlStructureForm.SelectedValue;     //结构类型
            string constructionAreaMin = txtConstructionAreaMin.Text.Trim(); //建筑面积范围开始
            string constructionAreaMax = txtConstructionAreaMax.Text.Trim(); //建筑面积范围结束
            string floorsMin           = txtFloorsMin.Text.Trim();           //层数起始
            string floorsMax           = txtFloorsMax.Text.Trim();           //层数结束
            string province            = ddlProvince.SelectedValue;          // Request.Form["ddlProvince"];//省份
            string transactionStatus   = ddlTransactionStatus.SelectedValue; //交易状态
            string wangwangName        = txtWangwangName.Text.Trim();        //旺旺名
            string mobilePhone         = txtMobilePhone.Text.Trim();         //手机号码
            string qq = txtQQ.Text.Trim();                                   //QQ
            string modelingSoftware = ddlModelingSoftware.SelectedValue;     //计价软件
            string valuateSoftware  = txtValuateSoftware.Text.Trim();        //建模软件
            string finishedPerson   = txtFinishedPerson.Text.Trim();         //完成人
            string isFinished       = ddlFinishedStatus.SelectedValue;       //完成状态
            string enteringPerson   = txtEnteringPerson.Text.Trim();         //录入人(即客服)

            if (!string.IsNullOrEmpty(taskNo))
            {
                dicCondition.Add("taskNo", taskNo);
            }
            if (!string.IsNullOrEmpty(projectName))
            {
                dicCondition.Add("projectName", projectName);
            }
            if (!string.IsNullOrEmpty(shop))
            {
                dicCondition.Add("shop", shop);
            }
            if (!string.IsNullOrEmpty(expireDataStart))
            {
                dicCondition.Add("expireDateStart", expireDataStart);
            }
            if (!string.IsNullOrEmpty(expireDateEnd))
            {
                dicCondition.Add("expireDateEnd", expireDateEnd);
            }
            if (!string.IsNullOrEmpty(orderDateStart))
            {
                dicCondition.Add("orderDateStart", orderDateStart);
            }
            if (!string.IsNullOrEmpty(orderDateEnd))
            {
                dicCondition.Add("orderDateEnd", orderDateEnd);
            }
            if (!string.IsNullOrEmpty(orderAmountMin))
            {
                dicCondition.Add("orderAmountMin", orderAmountMin);
            }
            if (!string.IsNullOrEmpty(orderAmountMax))
            {
                dicCondition.Add("orderAmountMax", orderAmountMax);
            }
            if (!string.IsNullOrEmpty(buildingType))
            {
                dicCondition.Add("buildingType", buildingType);
            }
            if (!string.IsNullOrEmpty(structureForm))
            {
                dicCondition.Add("structureForm", structureForm);
            }
            if (!string.IsNullOrEmpty(constructionAreaMin))
            {
                dicCondition.Add("constructionAreaMin", constructionAreaMin);
            }
            if (!string.IsNullOrEmpty(constructionAreaMax))
            {
                dicCondition.Add("constructionAreaMax", constructionAreaMax);
            }
            if (!string.IsNullOrEmpty(floorsMin))
            {
                dicCondition.Add("floorsMin", floorsMin);
            }
            if (!string.IsNullOrEmpty(floorsMax))
            {
                dicCondition.Add("floorsMax", floorsMax);
            }
            if (!string.IsNullOrEmpty(province))
            {
                dicCondition.Add("province", province);
            }
            if (!string.IsNullOrEmpty(transactionStatus))
            {
                dicCondition.Add("transactionStatus", transactionStatus);
            }
            if (!string.IsNullOrEmpty(wangwangName))
            {
                dicCondition.Add("wangwangName", wangwangName);
            }
            if (!string.IsNullOrEmpty(mobilePhone))
            {
                dicCondition.Add("mobilePhone", mobilePhone);
            }
            if (!string.IsNullOrEmpty(qq))
            {
                dicCondition.Add("qq", qq);
            }
            if (!string.IsNullOrEmpty(modelingSoftware))
            {
                dicCondition.Add("modelingSoftware", modelingSoftware);
            }
            if (!string.IsNullOrEmpty(valuateSoftware))
            {
                dicCondition.Add("valuateSoftware", valuateSoftware);
            }
            if (!string.IsNullOrEmpty(finishedPerson))
            {
                dicCondition.Add("finishedPerson", finishedPerson);
            }
            if (!string.IsNullOrEmpty(isFinished))
            {
                dicCondition.Add("isfinished", isFinished);
            }
            //if (!string.IsNullOrEmpty(enteringPerson))
            //{
            //    dicCondition.Add("enteringPerson",enteringPerson);
            //}
            //是否是管理员
            bool        isAdmin           = false;
            bool        isCustomerService = false;
            List <Role> lstRole           = UserProfile.GetInstance().Role;

            for (int i = 0; i < lstRole.Count; i++)
            {
                //如果角色名称中包含管理员,则判定是管理员
                if (lstRole[i].RoleName.Contains("管理员"))
                {
                    isAdmin = true;
                    break;
                }
                else if (lstRole[i].RoleName == "客服")
                {
                    isCustomerService = true;
                }
            }
            //不是管理员的话,只能看当前登录人录入的信息
            if (isCustomerService)
            {
                dicCondition.Add("enteringPerson", UserProfile.GetInstance().EmployeeNO);
            }
            //如果是管理员并且输入了录入人编号,则加入录入人的筛选条件
            else if (isAdmin && !string.IsNullOrEmpty(enteringPerson))
            {
                dicCondition.Add("enteringPerson", enteringPerson);
            }
            AspNetPager1.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["pageSize"]);
            int totalAmount = 0;//返回的记录数

            //待用======================================================
            StringBuilder sbSortExpression = new StringBuilder();

            /*//如果EventTarget为Sort,才进行排序
             * if (Request.Form["__EVENTTARGET"] == "Sort")
             * {
             *  string orderField = Request.Form["__EVENTARGUMENT"];
             *  string orderDirection = sortOrder.Value;
             *
             *  if (!string.IsNullOrEmpty(orderField))
             *  {
             *      sbSortExpression.AppendFormat("{0} {1}", orderField, orderDirection);
             *  }
             * }
             * //待用======================================================
             * */

            DataSet ds = new DataSet();

            //导出需要的
            if (isExport)
            {
                ds = pBll.GetListUnion(dicCondition, sbSortExpression.ToString(), 0, 0, out totalAmount);
                Session["dtTaskListExport"] = ds.Tables[0];
            }
            //不是导出需要的
            else
            {
                ds = pBll.GetListUnion(dicCondition, sbSortExpression.ToString(), AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalAmount);
                AspNetPager1.RecordCount  = totalAmount;
                lblTotalRecordAmount.Text = totalAmount.ToString();
                if (ds != null)
                {
                    DataTable dt = ds.Tables[0];
                    rptData.DataSource = dt;
                    //遍历DataTable,将ID赋给sbIDs字符串
                    StringBuilder sbIDs = new StringBuilder();
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        sbIDs.AppendFormat("'{0}'{1}", dt.Rows[i]["ID"], ",");
                    }
                    if (dt.Rows.Count == 0)
                    {
                        sbIDs.Append("'',");
                    }
                    string sIDs = sbIDs.ToString().TrimEnd(',');
                    //查出任务的完成人
                    ProjectSharingBLL psBll            = new ProjectSharingBLL();
                    DataTable         dtFinishedPerson = psBll.GetListInnerJoinEmployee(string.Format("PROJECTID IN ({0})", sIDs)).Tables[0];
                    Session["dtFinishedPerson"] = dtFinishedPerson;
                }
                rptData.DataBind();
                double totalOrderAmount = 0;
                double totalSalary      = 0;
                double totalCommission  = 0;
                double totalRefund      = 0;
                CountSalary(false, isCustomerService, out totalOrderAmount, out totalSalary, out totalCommission, out totalRefund);
                lblTotalOrderAmount.Text = totalOrderAmount.ToString();
                lblTotalRefund.Text      = totalRefund.ToString();
                lblSalary.Text           = totalSalary.ToString();
                //登录身份非客服并且录入人文本框输入查询条件时(也就是说管理员想查询某个客服录入的数据时),就显示出客服薪资
                lblCsSalary.Text = !isCustomerService && string.IsNullOrEmpty(enteringPerson) ? string.Empty : totalCommission.ToString();
            }
        }