예제 #1
0
        protected void GetInfo(List <FishEntity.CallRecordsEntity> list)
        {
            if (list == null)
            {
                return;
            }
            FishBll.Bll.CallRecordsDetailBll detailBll = new FishBll.Bll.CallRecordsDetailBll();
            foreach (FishEntity.CallRecordsEntity item in list)
            {
                string bj = "";
                string cg = "";
                List <FishEntity.CallRecordsDetailEntnty> details = detailBll.GetModelList(" callrecordid=" + item.id);
                if (details != null)
                {
                    foreach (FishEntity.CallRecordsDetailEntnty de in details)
                    {
                        if (string.IsNullOrEmpty(bj) == false)
                        {
                            bj += ",";
                        }
                        bj += de.specification + de.quoteprice;
                        if (string.IsNullOrEmpty(cg) == false)
                        {
                            cg += "\r\n";
                        }
                        cg += de.orderstate + ":" + de.weight + de.specification + de.quoteprice;
                    }
                }

                item.quoteInfo = bj;
                item.buyInfo   = cg;
            }
        }
예제 #2
0
        protected void GetQinfo(List <FishEntity.CallRecordsEntity> list)
        {
            if (list == null)
            {
                return;
            }

            //string startdate = dtpStart.Value.ToString();
            //string enddate = dtpEnd.Value.ToShortDateString();

            FishBll.Bll.CallRecordsDetailBll detailBll = new FishBll.Bll.CallRecordsDetailBll();
            foreach (FishEntity.CallRecordsEntity item in list)
            {
                int count1 = 0;
                int count2 = 0;
                List <FishEntity.CallRecordsDetailEntnty> details = detailBll.GetRecordListByCompanyCode(item.customercode);
                if (details != null)
                {
                    string bj = "";
                    string cg = "";
                    //string datestr = "";
                    foreach (FishEntity.CallRecordsDetailEntnty de in details)
                    {
                        string datestr2 = de.currentdate.ToString("MM.dd");

                        if (count1 < 5 && de.quoteprice > 0)
                        {
                            count1++;
                            if (string.IsNullOrEmpty(bj) == false)
                            {
                                bj += ",\r\n";
                            }

                            bj += datestr2 + " " + de.specification + de.quoteprice + de.brand;
                        }


                        if (count2 < 5 && de.quoteprice > 0)
                        {
                            count2++;
                            if (string.IsNullOrEmpty(cg) == false)
                            {
                                cg += "\r\n";
                            }

                            cg += datestr2 + " " + de.orderstate + ":" + de.weight + de.specification + de.saleprice;
                        }
                    }

                    item.quoteInfo = bj;
                    item.buyInfo   = cg;
                }
            }
        }
        public override int Query()
        {
            String where = "";
            if (string.IsNullOrEmpty(txtCustomer.Text))
            {
                //MessageBox.Show("请选择客户名称");
                //return 0;
                where += " 1 = 1 ";
            }
            else
            {
                where += "customer ='" + txtCustomer.Text.Trim() + "'";
            }
            //if (cmbLinkman.SelectedValue != null && cmbLinkman.SelectedValue.ToString() != "-1")
            //{
            //    where += " and linkmancode='"+ cmbLinkman.SelectedValue.ToString() +"'";
            //}
            //string where1 = where + "  order by currentdate desc";

            string linkmanstr = "";

            foreach (Control ctl in panel2.Controls)
            {
                if (ctl is CheckBox)
                {
                    CheckBox chk = ctl as CheckBox;
                    if (chk.Checked == false)
                    {
                        continue;
                    }
                    if (chk.Tag == null)
                    {
                        continue;
                    }
                    FishEntity.CustomerEntity customer = chk.Tag as FishEntity.CustomerEntity;
                    if (customer == null)
                    {
                        continue;
                    }
                    if (string.IsNullOrEmpty(linkmanstr) == false)
                    {
                        linkmanstr += ",";
                    }
                    linkmanstr += "'" + customer.code + "'";
                }
            }
            if (string.IsNullOrEmpty(linkmanstr) == false)
            {
                where += " and linkmancode in ( " + linkmanstr + " )";
            }
            if (FishEntity.Variable.User.roletype.Equals(FishEntity.Constant.Role_SalesMan))
            {
                where += string.Format(" and createman='{0}' ", FishEntity.Variable.User.username);
            }
            else
            {
                if (cmbTheperson.SelectedValue.ToString() != " ")
                {
                    where += string.Format(" and createman='{0}' ", cmbTheperson.SelectedValue.ToString());
                }
            }
            if (cmbStatus.Text != null && cmbStatus.Text.ToString().Trim() != "")
            {
                where += " and orderstate like  '%" + cmbStatus.Text.ToString().Trim() + "%'";
            }
            //if (cmbQuote.Text != null && cmbQuote.Text.ToString().Trim() != "")
            //{
            //    where += " and LENGTH(bjqk)>11 ";
            //}
            if (cmbQuote.Text == "有报价" && cmbQuote.Text != "")
            {
                where += " and LENGTH(bjqk)>11";
            }
            else if (cmbQuote.Text == "无报价" && cmbQuote.Text != "")
            {
                where += " and LENGTH(bjqk)<=11";
            }
            if (dtsky.Text.ToString() == DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"))
            {
                where += string.Format(" and currentdate>='{0}' and currentdate<='{1}' ",
                                       dtpStart.Value.ToString("yyyy-MM-dd 00:00:00"),
                                       dtpEnd.Value.ToString("yyyy-MM-dd 23:59:59"));
            }
            else
            {
                where += string.Format(" and currentdate>='{0}' and currentdate<='{1}' ", dtsky.Value.ToString("yyyy-MM-dd 00:00:00"), dtsky.Value.ToString("yyyy-MM-dd 23:59:59"));
            }


            FishBll.Bll.CallRecordsDetailBll           bll     = new FishBll.Bll.CallRecordsDetailBll();
            List <FishEntity.CallRecordDetailEntityEx> records = bll.GetRecordDetailListByWhere(where + _rolewhere);

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = records;
            int sum = 0;

            //for (int i = 0; i < dataGridView1.RowCount; i++)
            //{
            sum += int.Parse(this.dataGridView1.RowCount.ToString());
            // }
            txtnumber.Text = sum.ToString();
            if (records == null || records.Count < 1)
            {
                MessageBox.Show("查无数据");
            }


            return(base.Query());
        }