Exemplo n.º 1
0
        public void BindAddressDetail()
        {
            //string condition = "CustomerAddress.fCustomerMasterID=customermaster.pCustMstrID and customermaster.custno ='" + customerNo + "' and CustomerAddress.[Type]<>'SHP' and CustomerAddress.[Type]<>'DSHP'";

            DataTable dtAddressDetail = (Type != "SH") ? customerDetails.GetCustomerAddress(txtCustNo.Text) : customerDetails.GetCustomerShipToAddress(AddressID);

            if (dtAddressDetail != null)
            {
                txtAddress1.Text        = dtAddressDetail.Rows[0]["AddrLine1"].ToString();
                txtAddress2.Text        = dtAddressDetail.Rows[0]["AddrLine2"].ToString();
                txtCity.Text            = dtAddressDetail.Rows[0]["City"].ToString();
                txtCountry.Text         = dtAddressDetail.Rows[0]["Country"].ToString();
                txtPhone.GetPhoneNumber = dtAddressDetail.Rows[0]["PhoneNo"].ToString();
                txtPostCode.Text        = dtAddressDetail.Rows[0]["PostCd"].ToString();
                txtState.Text           = dtAddressDetail.Rows[0]["State"].ToString();
                txtCustName.Text        = dtAddressDetail.Rows[0]["Name1"].ToString();
                txtCustName2.Text       = dtAddressDetail.Rows[0]["Name2"].ToString();
                AddressID = dtAddressDetail.Rows[0]["pCustomerAddressID"].ToString();
                customerDetails.SetSelectedValuesInListControl(ddlAddType, dtAddressDetail.Rows[0]["Type"].ToString());

                lblChangeDate.Text = (dtAddressDetail.Rows[0]["ChangeDt"].ToString() != "") ? Convert.ToDateTime(dtAddressDetail.Rows[0]["ChangeDt"].ToString()).ToShortDateString() : "";
                lblChangeID.Text   = dtAddressDetail.Rows[0]["ChangeID"].ToString();
                lblEntryDate.Text  = Convert.ToDateTime(dtAddressDetail.Rows[0]["EntryDt"].ToString()).ToShortDateString();
                lblEntryID.Text    = dtAddressDetail.Rows[0]["EntryID"].ToString();
            }
            else
            {
                ClearAddress();
            }

            if (Type == "SH")
            {
                DataSet dsCount = customerDetails.GetDataToDateset("customerAddress  (NOLOCK) ", "count(*)", "fCustomerMasterID =" + CustomerID + " and (Type='DSHP' or Type ='SHP')");

                if (dsCount != null && (dsCount.Tables[0].Rows[0][0].ToString() == "0" || dsCount.Tables[0].Rows[0][0].ToString() == "1"))
                {
                    customerDetails.SetSelectedValuesInListControl(ddlAddType, "DSHP");
                    ddlAddType.Enabled = false;
                }
                else
                {
                    ddlAddType.Enabled = true;
                }
            }
            if (Session["SoldToAddressCount"] != null && (((Session["SoldToAddressCount"].ToString() == "0" || Session["SoldToAddressCount"].ToString() == "1") && Mode == "Edit") || ((Session["SoldToAddressCount"].ToString() == "0" && Mode == "Edit"))) && hidType.Value == "ST")
            {
                customerDetails.SetSelectedValuesInListControl(ddlAddType, "P");
                ddlAddType.Enabled = false;
            }
            else if (Type == "ST")
            {
                ddlAddType.Enabled = true;
            }
        }
Exemplo n.º 2
0
        private void BindBillToAddress()
        {
            //[pCustomerAddressID],[Type],[fCustomerMasterID],[Name2],[AddrLine1],[AddrLine2],[AddrLine3],[AddrLine4],
            //[AddrLine5],[City],[State],[PostCd],[Country],[PhoneNo],[CustContacts],[fCustContactsID],[UPSZone],
            //[FaxPhoneNo],[EDIPhoneNo],[UPSShipperNo],[Email],CustomerAddress.[EntryID],CustomerAddress.[EntryDt]
            //,CustomerAddress.[ChangeID],CustomerAddress.[ChangeDt],CustomerAddress.[StatusCd],[LocationName]
            if (CustomerNumber != "")
            {
                if (CustType == CustomerType.BT || CustType == CustomerType.BTST)
                {
                    dsValue = customerDetails.GetCustomerAddress(CustomerNumber);
                }
                else
                {
                    dsValue = customerDetails.GetCustomerAddress(BillToCustomerNo);
                }

                if (dsValue != null && dsValue.Rows.Count > 0)
                {
                    lblBillCity.Text             = dsValue.Rows[0]["City"].ToString();
                    lblBillCountry.Text          = dsValue.Rows[0]["Country"].ToString();
                    lblBillFax.Text              = customerDetails.FormatPhoneFax(dsValue.Rows[0]["FaxPhoneNo"].ToString());
                    lblBillLine1.Text            = dsValue.Rows[0]["AddrLine1"].ToString();
                    lblBillName.Text             = dsValue.Rows[0]["CustName"].ToString();
                    lblBillPhone.Text            = customerDetails.FormatPhoneFax(dsValue.Rows[0]["PhoneNo"].ToString());
                    lblBillToCustomerNumber.Text = dsValue.Rows[0]["CustNo"].ToString();

                    lblBillChangeDate.Text = (dsValue.Rows[0]["ChangeDt"].ToString() == "") ? "" : Convert.ToDateTime(dsValue.Rows[0]["ChangeDt"].ToString()).ToShortDateString();
                    lblBillChangeID.Text   = dsValue.Rows[0]["ChangeID"].ToString();
                    lblBillEntryDate.Text  = (dsValue.Rows[0]["EntryDt"].ToString() == "") ? "" : Convert.ToDateTime(dsValue.Rows[0]["EntryDt"].ToString()).ToShortDateString();
                    lblBillEntryID.Text    = dsValue.Rows[0]["EntryID"].ToString();

                    lblCustMastChnageDt.Text = (dsValue.Rows[0]["CustMasterChangeDt"].ToString() == "") ? "" : Convert.ToDateTime(dsValue.Rows[0]["CustMasterChangeDt"].ToString()).ToShortDateString();
                    lblCustMastChangeID.Text = dsValue.Rows[0]["CustMasterChangeID"].ToString();
                    lblCustMastEntryDt.Text  = (dsValue.Rows[0]["CustMasterEntryDt"].ToString() == "") ? "" : Convert.ToDateTime(dsValue.Rows[0]["CustMasterEntryDt"].ToString()).ToShortDateString();
                    lblCustMastEntryID.Text  = dsValue.Rows[0]["CustMasterEntryID"].ToString();
                    tblEntryPanel.Visible    = true;
                }
                else
                {
                    ClearBillControls();
                }


                if (CustType == CustomerType.BTST)
                {
                    DataTable dtsoldto = customerDetails.GetCustomerSoldToAddress(CustomerNumber);
                    if (dtsoldto != null && dtsoldto.Rows.Count > 0)
                    {
                        dsValue = dtsoldto.Copy();
                    }
                    BindSoldToAddress();
                }
                else if (CustType == CustomerType.ST)
                {
                    dsValue = customerDetails.GetCustomerAddress(CustomerNumber);
                    BindSoldToAddress();
                }
                else
                {
                    tdSoldAddress.Style.Add(HtmlTextWriterStyle.Display, "none");
                }
            }
            else
            {
                ClearBillControls();
                ClearSoldControls();
            }
        }