Ejemplo n.º 1
0
        protected void btn_Search_Click(object sender, EventArgs e)
        {
            string containerNo = boxNo.Value;
            string blNo        = BLNo.Value;

            if (string.IsNullOrWhiteSpace(containerNo) && string.IsNullOrWhiteSpace(blNo))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('箱号和提单号条件至少须输入一个!');", true);
                return;
            }
            QGCostcoSoapClient client    = new QGCostcoSoapClient();
            string             errorMsg  = "";
            string             errorCode = "";
            string             result    = "";


            string reserved = isReserved.Checked ? "Y" : "N";

            result = client.reserve(containerNo, blNo, reserved, "", out errorMsg, out errorCode);
            if (errorCode == "0")
            {
                customsInspections        = com.GetCustomsInspections(result);
                DataSourceList.DataSource = customsInspections.CONTAINER.Take(20);
                DataSourceList.DataBind();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();", true);
            }
            else
            {
                DataSourceList.DataSource = null;
                DataSourceList.DataBind();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('" + errorMsg + "');", true);
            }
        }
Ejemplo n.º 2
0
        protected void btn_Booking_Click(object sender, EventArgs e)
        {
            if (DateTime.Now < DateTime.Parse(beginTime.Value) || DateTime.Now > DateTime.Parse(endTime.Value))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('已经超过预约时间啦!');", true);
                return;
            }


            //2次验证
            string             containerNo = boxNo.Value;
            string             blNo        = BLNo.Value;
            QGCostcoSoapClient client      = new QGCostcoSoapClient();
            string             errorMsg    = "";
            string             errorCode   = "";
            string             result      = "";


            string reserved = "N";

            result = client.reserve(containerNo, blNo, reserved, "", out errorMsg, out errorCode);
            BaseComponent.Info("WebService Paras reserve:containerNo " + containerNo + ";blNo " + blNo + ";reserved " + reserved + ";errorMsg " + errorMsg + ";errorCode " + errorCode);

            if (errorCode == "0")
            {
                CUSTOMSINSPECTIONS customsInspectionsCheck = com.GetCustomsInspections(result);
                if (customsInspectionsCheck.CONTAINER.Count != customsInspections.CONTAINER.Count)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('预约失败,请确认部分箱是否已处理!');", true);
                    return;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('预约失败,请确认部分箱是否已处理!');", true);
                return;
            }
            //

            string reservedDate = DateTime.Now.ToString("yyyyMMddHHmmss"); //Text1.Value;//
            string customer     = lblCompany.Text;
            string linkman      = txtlinkman.Value;
            string phone        = txtphone.Value;

            if (string.IsNullOrWhiteSpace(linkman) || string.IsNullOrWhiteSpace(phone))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('请输入联系人和联系电话!');", true);
                return;
            }

            //Containers containers = new Containers();
            //containers.ContainerNo = new System.Collections.Generic.List<Model.InspectionModels.Container>();
            //foreach (var no in customsInspections.CONTAINER)
            //{
            //    Model.InspectionModels.Container container = new Model.InspectionModels.Container();
            //    container.ContainerNo = no.CONTAINERNO;
            //    containers.ContainerNo.Add(container);
            //}

            string containers = "<CONTAINERS>";

            foreach (var no in customsInspections.CONTAINER)
            {
                containers += "<CONTAINERNO>" + no.CONTAINERNO + "</CONTAINERNO>";
            }

            containers += "</CONTAINERS>";

            client.reserveContainers(containers, reservedDate, customer, linkman, phone, out errorMsg, out errorCode);
            BaseComponent.Info("WebService Paras reserve:containers " + containers + ";reservedDate " + reservedDate + ";customer " + customer + ";errorMsg " + errorMsg + ";errorCode " + errorCode);
            if (errorCode == "0")
            {
                //Page.Response.Redirect("InspectionSearch.aspx?blno=" + lblno.Text + "", true);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('恭喜您,预约成功,请查看预约结果!',9);", true);
                this.isReserved.Checked = true;
                btn_Search_Click(null, null);
            }
            else
            {
                if (errorMsg == "The reservation is full")
                {
                    errorMsg = "今天预约数量已经满啦,请下个工作日再来预约!";
                }
                if (errorMsg == "Illegal reserveDate")
                {
                    errorMsg = "今天不允许预约!";
                }
                if (errorMsg == "parameters error")
                {
                    errorMsg = "系统发生了参数错误!";
                }
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "ensureBooking();layer.alert('" + errorMsg + "');", true);
            }
        }
Ejemplo n.º 3
0
 public string GetCustomsInspections(CUSTOMSINSPECTIONS xml)
 {
     return(SerializeHelper.ToXml(xml));
 }
Ejemplo n.º 4
0
        protected void btn_Search_Click(object sender, EventArgs e)
        {
            string containerNo = boxNo.Value;
            string blNo        = BLNo.Value;

            if (string.IsNullOrWhiteSpace(containerNo) && string.IsNullOrWhiteSpace(blNo))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('请输入正确的箱号或提单号!');", true);
                return;
            }
            QGCostcoSoapClient client    = new QGCostcoSoapClient();
            string             errorMsg  = "";
            string             errorCode = "";
            string             result    = "";


            //string reserved = isReserved.Checked ? "Y" : "N";
            string reserved = "Y";

            result = client.reserve(containerNo, blNo, reserved, "", out errorMsg, out errorCode);
            BaseComponent.Info("WebService Paras reserve Y:containerNo " + containerNo + ";blNo " + blNo + ";reserved " + reserved + ";errorMsg " + errorMsg + ";errorCode " + errorCode);
            customsInspections = null;
            if (errorCode == "0")
            {
                customsInspections = com.GetCustomsInspections(result);
                //if (isReserved.Checked)
                if (customsInspections != null && customsInspections.CONTAINER.Count > 0)
                {
                    DataSourceList.Visible     = false;
                    DataSourceList2.Visible    = true;
                    DataSourceList2.DataSource = customsInspections.CONTAINER;
                    DataSourceList2.DataBind();
                }
                else
                {
                    DataSourceList.Visible     = false;
                    DataSourceList2.Visible    = true;
                    DataSourceList2.DataSource = null;
                    DataSourceList2.DataBind();
                }
                //if (customsInspections != null && customsInspections.CONTAINER.Count > 0 && !string.IsNullOrWhiteSpace(blNo) && string.IsNullOrWhiteSpace(containerNo) && !string.IsNullOrWhiteSpace(inspectionTime.Value) && !isReserved.Checked)
                if (customsInspections != null && customsInspections.CONTAINER.Count > 0 && reserved == "N")
                {
                    btn_Booking.Visible = true;
                }
                else
                {
                    btn_Booking.Visible = false;
                }
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();", true);
            }
            else
            {
                reserved = "N";
                result   = client.reserve(containerNo, blNo, reserved, "", out errorMsg, out errorCode);
                BaseComponent.Info("WebService Paras reserve N:containerNo " + containerNo + ";blNo " + blNo + ";reserved " + reserved + ";errorMsg " + errorMsg + ";errorCode " + errorCode);
                customsInspections = null;
                if (errorCode == "0")
                {
                    customsInspections = com.GetCustomsInspections(result);
                    if (customsInspections != null && customsInspections.CONTAINER.Count > 0)
                    {
                        DataSourceList.Visible  = true;
                        DataSourceList2.Visible = false;

                        DataSourceList.DataSource = customsInspections.CONTAINER;
                        DataSourceList.DataBind();
                    }
                    else
                    {
                        DataSourceList.Visible  = true;
                        DataSourceList2.Visible = false;

                        DataSourceList.DataSource = null;
                        DataSourceList.DataBind();
                    }
                    if (customsInspections != null && customsInspections.CONTAINER.Count > 0)
                    {
                        btn_Booking.Visible = true;
                    }
                    else
                    {
                        btn_Booking.Visible = false;
                    }
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsucclose", "layer.closeAll();", true);
                }
                else
                {
                    if (reserved == "N")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('如果无法查询出数据,请在“海关查验进度查询”中查看是否已经预约');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('" + errorMsg + "');", true);
                    }
                    btn_Booking.Visible = false;

                    DataSourceList.DataSource = null;
                    DataSourceList.DataBind();
                    DataSourceList2.DataSource = null;
                    DataSourceList2.DataBind();
                }

                //if (reserved == "N")
                //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('如果无法查询出数据,请在“海关查验进度查询”中查看是否已经预约');", true);
                //else
                //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('" + errorMsg + "');", true);
                //btn_Booking.Visible = false;

                //DataSourceList.DataSource = null;
                //DataSourceList.DataBind();
                //DataSourceList2.DataSource = null;
                //DataSourceList2.DataBind();
            }
        }