⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 po01.aspx.cs

📁 简单的cI真的是很简单 你想要就下载吧
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using VinciBusinessLogic.BusinessLogic;
using VinciDataAccess.DataAccess;
using VinciDataAccess.Entity;

public partial class Web_Order_PO01 :BasePage
{
    Common com = new Common();
    OrdersBL ordersBL = new OrdersBL(); 
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.UserData = UserData;
        this.OrderSearch1.IsVisibleSearch = true;
        this.OrderSearch1.State = 4;
        this.OrderSearch1.EmployeeID = UserData.EmployeeID;
        if (!IsPostBack)
        {

        }
    }
    protected void Search_Click(object sender, EventArgs e)
    {
        this.la.Text = GetSqlStr();
        GetSurelyOrders();
    }
    private void GetSurelyOrders()
    {
        OrdersCollection ordersCollection = new OrdersCollection();
        ordersCollection = ordersBL.GetSearchOrders(GetSqlStr());
        WebService.EmployeesEntity _employeesEntity = new WebService.EmployeesEntity();
        WebService.VinciService _webService = new WebService.VinciService();
        this.MessageLable.Visible = false;
        int _tabRows = SeachTable.Rows.Count;
        for (int i = 0; i <= _tabRows; i++)
        {
            if (SeachTable.Rows.Count > 1)
            {
                SeachTable.Rows.RemoveAt(1);
            }
        }
        if (ordersCollection.Count > 0)
        {
            foreach (OrdersEntity order in ordersCollection)
            {
                string customersCompanyName = ordersBL.GetCustomersCompanyName(order.CustomerID);
                //string orderCreaterName =_webService.GetEmployeeName(order.OrderCreaterID, order.OrderCreaterID, Ticket, out error_Message);
                string orderCreaterName = _webService.GetEmployeeName(order.OrderCreaterID, 1, Ticket, out error_Message);
                string orgName = _webService.GetOrgName(order.OrgID, order.OrgID, Ticket, out error_Message);
                TableRow tr = new TableRow();

                TableCell tdCustomerID = new TableCell();
                tdCustomerID.Text = customersCompanyName;
                //TableCell tdEmployeeID = new TableCell();
                //tdEmployeeID.Text = employeesName;
                TableCell tdOrderCreaterID = new TableCell();
                tdOrderCreaterID.Text = orderCreaterName;
                TableCell tdOrderDate = new TableCell();
                tdOrderDate.Text = com.StringNullToEmpty(order.OrderDate.ToString());
                TableCell tdRequiredDate = new TableCell();
                tdRequiredDate.Text = com.StringNullToEmpty(order.OrderNote);
                TableCell tdOrgName = new TableCell();
                tdOrgName.Text = orgName;
                TableCell tdState = new TableCell();
                tdState.Text = "待备贷";
                TableCell tdOrderID = new TableCell();
                tdOrderID.Text = "<a href='#' onclick=" + "\"" + "javascript:showModalDialog('PO07.aspx?OrderID=" + order.OrderID.ToString() + "','_blank', 'dialogWidth:600px;dialogHeight:800px;center:yes;status:yes');" + "\">" + "<span style='font-size:9pt;text-decoration:none;color:red;'>" + "详细信息" + "</a>";

                tr.Cells.Add(tdCustomerID);
                //tr.Cells.Add(tdEmployeeID);
                tr.Cells.Add(tdOrderCreaterID);
                tr.Cells.Add(tdOrderDate);
                tr.Cells.Add(tdRequiredDate);
                tr.Cells.Add(tdOrgName);
                tr.Cells.Add(tdState);
                tr.Cells.Add(tdOrderID);
                this.SeachTable.Rows.Add(tr);
            }
        }
        else
        {
            this.MessageLable.Visible = true;
            MessageLable.Text = "没有检索到待备贷订单";
        }
    }
    //将用户选择的查询项变为查询语句
    private string GetSqlStr()
    {
        string orderID = this.OrderSearch1.OrderID.ToString();
        if (orderID == "")
        {
            orderID = "%";
        }
        else { };
        int customerID = this.OrderSearch1.CustomerID;
        int orderCreateID = this.OrderSearch1.OrderCreateID;
        
        int readyOrderID = this.OrderSearch1.StorehouseAccepterID;
        string carrier = this.OrderSearch1.Carrier.ToString();
        string receiver = this.OrderSearch1.Receiver.ToString();
        int colseOrderID = this.OrderSearch1.OrderCloseAccepterID;
        //int state = this.OrderSearch1.State;
        string createStartDate = this.OrderSearch1.CreatOrderStartTime.ToString();
        string createEndDate = this.OrderSearch1.CreateOrderEndTime.ToString();
        string readyStartDate = this.OrderSearch1.StoreHourseStartTime.ToString();
        string readyEndDate = this.OrderSearch1.StoreHourseEndTime.ToString();
        string sendStartDate = this.OrderSearch1.SendStartTime.ToString();
        string sendEndDate = this.OrderSearch1.SendEndTime.ToString();
        string confirmStartDate = this.OrderSearch1.ConfirmStartTime.ToString();
        string confirmEndDate = this.OrderSearch1.ConfirmEndTime.ToString();
        string colseStartDate = this.OrderSearch1.CloseStartTime.ToString();        
        string colseEndDate = this.OrderSearch1.CloseEndTime.ToString();
        int orgID = this.OrderSearch1.OrgID;
        string customerName = this.CustomerName.Text.ToString();
        string receiveNote = this.ReceiveNote.Text.ToString();
        string strSql = GetSqlStr(orderID, customerID, orderCreateID, readyOrderID, carrier, receiver,
                                    colseOrderID,createStartDate, createEndDate,
                                    readyStartDate,readyEndDate,sendStartDate,sendEndDate,confirmStartDate,
                                    confirmEndDate,colseStartDate,colseEndDate,orgID,customerName, receiveNote);
        return strSql;
    }
    protected string GetSqlStr(string orderID,int customerID,int orderCreaterID,int readyOrderID,
                               string carrier, string receiver, int colseOrderID, string createStartDate,
                               string createEndDate,string readyStartDate,string readyEndDate,
                               string sendStartDate,string sendEndDate,string confirmStartDate,
                               string confirmEndDate,string colseStartDate,string colseEndDate,
                               int orgID, string customerName, string receiveNote)
    {
        string startDate = "1/1/2000 12:00:00 AM";


        string strSql="select * from Orders where OrderID like "+"'"+"%"+orderID+"%"+"'";
        if (Convert.ToString(customerID) != "0")//客户
        {
            strSql += " and CustomerID="+ customerID;

        }
        else { }
        if (Convert.ToString(orderCreaterID) != "0")//创建者

        {
            strSql += " and OrderCreaterID="+ orderCreaterID;

        }
        else { }
        if (Convert.ToString(readyOrderID) != "0")//配贷者

        {
            strSql += " and StorehouseAccepterID=" + readyOrderID;

        }
        else { }
        if (carrier != "请选择:")//发贷者

        {
            strSql += " and TransportOrderID=" +"'"+carrier+"'";

        }
        else { }
        if (receiver != "请选择:")//确认者

        {
            strSql += " and TransportInfoInputerID=" +"'"+receiver+"'";

        }
        else { }
        if (Convert.ToString(colseOrderID) != "0")//关闭者

        {
            strSql += " and OrderCloseAccepterID=" + colseOrderID;

        }
        else { }

        //如果起止时间都是默认的时间,用户不改动。此搜索项将排除在外不作为条件传入。

        if (createStartDate == startDate && createEndDate == Convert.ToString(DateTime.Today)) { }
        else { strSql += " and OrderDate between " + "'" + createStartDate + "'" + "and" + "'" + createEndDate + "'"; }
        if (readyStartDate == startDate && readyEndDate == Convert.ToString(DateTime.Today)) { }
        else { strSql += " and RequireDate between " + "'" + readyStartDate + "'" + "and" + "'" + readyEndDate + "'"; }
        if (sendStartDate == startDate && sendEndDate == Convert.ToString(DateTime.Today)) { }
        else { strSql += " and TransportDate between " + "'" + sendStartDate + "'" + "and" + "'" + sendEndDate + "'"; }
        if (confirmStartDate == startDate && confirmEndDate == Convert.ToString(DateTime.Today)) { }
        else { strSql += " and ArrivalDate between " + "'" + confirmStartDate + "'" + "and" + "'" + confirmEndDate + "'"; }
        if (colseStartDate == startDate && colseEndDate == Convert.ToString(DateTime.Today)) { }
        else { strSql += " and OrderCloseDate between " + "'" + colseStartDate + "'" + "and" + "'" + colseEndDate + "'"; }
        //下面是客户名
        //先判断用户是否输入了客户名,如果输入先由此查出所有CustomerID,返回一个数组.
        //if (customerName != "")
        //{
        //    CustomersBL customerBL = new CustomersBL();
        //    ArrayList customerIDList = new ArrayList();
        //    customerIDList = customerBL.GetCustomerIDByCustomerName(customerName);
        //    for (int i = 0; i < customerIDList.Count; i++)
        //    {
        //        if (i == 0)
        //        {
        //            strSql += " and (CustomerID=" + Convert.ToInt32(customerIDList[i]);
        //        }
        //        strSql += " Or CustomerID=" + Convert.ToInt32(customerIDList[i]);
        //        if (i ==customerIDList.Count - 1)
        //        {
        //            strSql += " Or CustomerID=" + Convert.ToInt32(customerIDList[i]) + ")";
        //        }
        //    }

        //}
        //else { }
        if (receiveNote != "")
        {
            strSql += " and ReceiveNote like"+"'"+"%"+receiveNote+"%"+"'";
        }
        return strSql;
        
    }
}





















































⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -