private void cmbPayTo_SelectedIndexChanged(object sender, EventArgs e)
        {
            Supplier MySupplier = new Supplier();
            DataType.CustomerDataType _ExCustomer = new DataType.CustomerDataType();
            DataType.SupplierDataType _ExSupplier = new DataType.SupplierDataType();
            Customer MyCustomer = new Customer();
            string PayTo = MyCommon.GetSelectedID(cmbPayFor, true);
            string PayToID = MyCommon.GetSelectedID(cmbPayTo, true);

            int CusSupID = 0;
            bool resp5 = int.TryParse(PayToID, out CusSupID);
            string respond = "";
            switch (PayTo)
            {
                case "1":
                    respond = MySupplier.GetSupplier(CusSupID, out _ExSupplier, Program.AccountStatic.LoggingAsLocal);
                    lblAddress.Text = _ExSupplier.Address1 + " " + _ExSupplier.Address2 + " " + _ExSupplier.Address3;
                    lblToID.Text = MyAccount.GetSupplierAccountNumber(CusSupID);
                    txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text);
                    txtToAccount.Enabled = false;
                    HanchyGrid.Visible = false;
                    break;
                case "2":
                    lblToID.Text = MyAccount.GetCustomerAccountNumber(CusSupID);
                    respond = MyCustomer.GetGetExistCustomer(CusSupID, out _ExCustomer, Program.AccountStatic.LoggingAsLocal);
                    lblAddress.Text = _ExCustomer.Address1 + " " + _ExCustomer.Address2 + " " + _ExCustomer.Address3;
                    txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text);
                    txtToAccount.Enabled = false;
                    HanchyGrid.Visible = false;
                    break;
                case "5":
                    lblToID.Text = "";
                    txtToAccount.Text = "";
                    txtToAccount.Enabled = true;
                    lblAddress.Text = MyAccount.GetOtherPayeeAdd(cmbPayTo.Text);
                    break;
                default:
                    lblToID.Text = "";
                    txtToAccount.Text = "";
                    txtToAccount.Enabled = true;
                    break;
            }
        }
Exemple #2
0
 public string  GetSupplier(int Sysid, out DataType.SupplierDataType _ExistData,bool IsLocal)
 {
     DataService Mycommon = new DataService(IsLocal);
     _ExistData = new DataType.SupplierDataType();
     MySqlCommand oSqlCommand = new MySqlCommand();
     string sqlQuery = "Select "
   + "Sysid,"
   + "Customer,"
   + "Address1,"
   + "Address2,"
   + "Address3,"
   + "TPN,"
   + "Mobile,"
   + "Fax,"
   + "Email,"
   + "CreditLimit,"
   + "CurrentCredit,"
   + "VatRegNumber,"
   + "Status,"
   + "LastAccUser,"
   + "LastAccDate,"
   + "ContactPerson,"
   + "ContactTPnumber,"
   + "PaymentTerms,"
   + "CreditPeriod,"
   + "DeleveryMethod,"
   + "Shippingadd1,"
   + "ShippingAdd2,"
   + "ShippingAdd3,"
   + "Country,"
   + "CusID,"
   + "FFName,"
   + "FFAccountNo,"
   + "UnderG4,"
   + "Email_OrderAcn,"
   + "Email_Invoice,"
   + "Email_Complain,"
   + "NeedCustomerLogo,"
   + "CurrenyCode"
   + " from tblsupplier"
   + " Where 1=1 "
         + " and Sysid=@Sysid";
     oSqlCommand.Parameters.AddWithValue("@Sysid", Sysid);
     DataRow r = Mycommon.GetDataRow(sqlQuery, oSqlCommand, null, "Get Exist data Supplier");
     if (r != null)
     {
         try
         {
             bool resp = false;
             int inSysid = 0;
             resp = int.TryParse(r["Sysid"].ToString(), out inSysid);
             _ExistData.Sysid = inSysid;
             _ExistData.Customer = r["Customer"].ToString();
             _ExistData.Address1 = r["Address1"].ToString();
             _ExistData.Address2 = r["Address2"].ToString();
             _ExistData.Address3 = r["Address3"].ToString();
             _ExistData.TPN = r["TPN"].ToString();
             _ExistData.Mobile = r["Mobile"].ToString();
             _ExistData.Fax = r["Fax"].ToString();
             _ExistData.Email = r["Email"].ToString();
             decimal deCreditLimit = 0;
             resp = decimal.TryParse(r["CreditLimit"].ToString(), out deCreditLimit);
             _ExistData.CreditLimit = deCreditLimit;
             decimal deCurrentCredit = 0;
             resp = decimal.TryParse(r["CurrentCredit"].ToString(), out deCurrentCredit);
             _ExistData.CurrentCredit = deCurrentCredit;
             _ExistData.VatRegNumber = r["VatRegNumber"].ToString();
             int inStatus = 0;
             resp = int.TryParse(r["Status"].ToString(), out inStatus);
             _ExistData.Status = inStatus;
             _ExistData.LastAccUser = r["LastAccUser"].ToString();
             DateTime dtLastAccDate = new DateTime(1900, 1, 1);
             resp = DateTime.TryParse(r["LastAccDate"].ToString(), out dtLastAccDate);
             if (resp)
                 _ExistData.LastAccDate = dtLastAccDate;
             else
                 _ExistData.LastAccDate = new DateTime(1900, 1, 1);
             _ExistData.ContactPerson = r["ContactPerson"].ToString();
             _ExistData.ContactTPnumber = r["ContactTPnumber"].ToString();
             _ExistData.PaymentTerms = r["PaymentTerms"].ToString();
             int inCreditPeriod = 0;
             resp = int.TryParse(r["CreditPeriod"].ToString(), out inCreditPeriod);
             _ExistData.CreditPeriod = inCreditPeriod;
             _ExistData.DeleveryMethod = r["DeleveryMethod"].ToString();
             _ExistData.Shippingadd1 = r["Shippingadd1"].ToString();
             _ExistData.ShippingAdd2 = r["ShippingAdd2"].ToString();
             _ExistData.ShippingAdd3 = r["ShippingAdd3"].ToString();
             _ExistData.Country = r["Country"].ToString();
             _ExistData.CusID = r["CusID"].ToString();
             _ExistData.FFName = r["FFName"].ToString();
             _ExistData.FFAccountNo = r["FFAccountNo"].ToString();
             int inUnderG4 = 0;
             resp = int.TryParse(r["UnderG4"].ToString(), out inUnderG4);
             _ExistData.UnderG4 = inUnderG4;
             _ExistData.Email_OrderAcn = r["Email_OrderAcn"].ToString();
             _ExistData.Email_Invoice = r["Email_Invoice"].ToString();
             _ExistData.Email_Complain = r["Email_Complain"].ToString();
             int inNeedCustomerLogo = 0;
             resp = int.TryParse(r["NeedCustomerLogo"].ToString(), out inNeedCustomerLogo);
             _ExistData.NeedCustomerLogo = inNeedCustomerLogo;
             _ExistData.CurrenyCode = r["CurrenyCode"].ToString();
             return "True";
         }
         catch (Exception ex)
         {
             return ex.Message;
         }
     }
     else
         return "data not found ";
 }
        private void cmbPayTo_SelectedIndexChanged(object sender, EventArgs e)
        {

            //Added by Manjula
            string SupName = "";
            if (cmbPayTo.SelectedValue != null)
            {
                SupName = cmbPayTo.SelectedValue.ToString();
            }
            LINKPayment objLink = new LINKPayment();
            objLink.SupName = SupName;
            LINKPayment[] objSuppID = objService.GetCreditorFinalSupplier(objLink);

            if (objSuppID.Length > 0)
            {
                SuppID = objSuppID[0].SupplierID.ToString();
            }

            BusinessLayer.Supplier.Supplier MySupplier = new BusinessLayer.Supplier.Supplier();
            DataType.CustomerDataType _ExCustomer = new DataType.CustomerDataType();
            DataType.SupplierDataType _ExSupplier = new DataType.SupplierDataType();
            Customer MyCustomer = new Customer();
            string PayTo = MyCommon.GetSelectedID(cmbPayFor, true);
            string PayToID = MyCommon.GetSelectedID(cmbPayTo, true);
            int CusSupID = 0;
            bool resp5 = int.TryParse(PayToID, out CusSupID);
            string respond = "";
            switch (PayTo)
            {
                case "1":
                    // respond = MySupplier.GetSupplier(CusSupID, out _ExSupplier, Program.AccountStatic.LoggingAsLocal);
                    lblAddress.Text = _ExSupplier.Address1 + " " + _ExSupplier.Address2 + " " + _ExSupplier.Address3;
                    lblToID.Text = MyAccount.GetSupplierAccountNumber(CusSupID);
                    txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text);
                    txtToAccount.Enabled = false;
                    HanchyGrid.Visible = false;
                    break;
                case "2":
                    lblToID.Text = MyAccount.GetCustomerAccountNumber(CusSupID);
                    respond = MyCustomer.GetGetExistCustomer(CusSupID, out _ExCustomer, Program.AccountStatic.LoggingAsLocal);
                    lblAddress.Text = _ExCustomer.Address1 + " " + _ExCustomer.Address2 + " " + _ExCustomer.Address3;
                    txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text);
                    txtToAccount.Enabled = false;
                    HanchyGrid.Visible = false;
                    break;
                case "5":
                    lblToID.Text = "";
                    txtToAccount.Text = "";
                    txtToAccount.Enabled = true;
                    lblAddress.Text = MyAccount.GetOtherPayeeAdd(cmbPayTo.Text);
                    break;
                default:
                    lblToID.Text = "";
                    txtToAccount.Text = "";
                    txtToAccount.Enabled = true;
                    break;
            }

        }
Exemple #4
0
        public string  GetSupplier(int Sysid, out DataType.SupplierDataType _ExistData, bool IsLocal)
        {
            DataService Mycommon = new DataService(IsLocal);

            _ExistData = new DataType.SupplierDataType();
            MySqlCommand oSqlCommand = new MySqlCommand();
            string       sqlQuery    = "Select "
                                       + "Sysid,"
                                       + "Customer,"
                                       + "Address1,"
                                       + "Address2,"
                                       + "Address3,"
                                       + "TPN,"
                                       + "Mobile,"
                                       + "Fax,"
                                       + "Email,"
                                       + "CreditLimit,"
                                       + "CurrentCredit,"
                                       + "VatRegNumber,"
                                       + "Status,"
                                       + "LastAccUser,"
                                       + "LastAccDate,"
                                       + "ContactPerson,"
                                       + "ContactTPnumber,"
                                       + "PaymentTerms,"
                                       + "CreditPeriod,"
                                       + "DeleveryMethod,"
                                       + "Shippingadd1,"
                                       + "ShippingAdd2,"
                                       + "ShippingAdd3,"
                                       + "Country,"
                                       + "CusID,"
                                       + "FFName,"
                                       + "FFAccountNo,"
                                       + "UnderG4,"
                                       + "Email_OrderAcn,"
                                       + "Email_Invoice,"
                                       + "Email_Complain,"
                                       + "NeedCustomerLogo,"
                                       + "CurrenyCode"
                                       + " from tblsupplier"
                                       + " Where 1=1 "
                                       + " and Sysid=@Sysid";

            oSqlCommand.Parameters.AddWithValue("@Sysid", Sysid);
            DataRow r = Mycommon.GetDataRow(sqlQuery, oSqlCommand, null, "Get Exist data Supplier");

            if (r != null)
            {
                try
                {
                    bool resp    = false;
                    int  inSysid = 0;
                    resp                = int.TryParse(r["Sysid"].ToString(), out inSysid);
                    _ExistData.Sysid    = inSysid;
                    _ExistData.Customer = r["Customer"].ToString();
                    _ExistData.Address1 = r["Address1"].ToString();
                    _ExistData.Address2 = r["Address2"].ToString();
                    _ExistData.Address3 = r["Address3"].ToString();
                    _ExistData.TPN      = r["TPN"].ToString();
                    _ExistData.Mobile   = r["Mobile"].ToString();
                    _ExistData.Fax      = r["Fax"].ToString();
                    _ExistData.Email    = r["Email"].ToString();
                    decimal deCreditLimit = 0;
                    resp = decimal.TryParse(r["CreditLimit"].ToString(), out deCreditLimit);
                    _ExistData.CreditLimit = deCreditLimit;
                    decimal deCurrentCredit = 0;
                    resp = decimal.TryParse(r["CurrentCredit"].ToString(), out deCurrentCredit);
                    _ExistData.CurrentCredit = deCurrentCredit;
                    _ExistData.VatRegNumber  = r["VatRegNumber"].ToString();
                    int inStatus = 0;
                    resp = int.TryParse(r["Status"].ToString(), out inStatus);
                    _ExistData.Status      = inStatus;
                    _ExistData.LastAccUser = r["LastAccUser"].ToString();
                    DateTime dtLastAccDate = new DateTime(1900, 1, 1);
                    resp = DateTime.TryParse(r["LastAccDate"].ToString(), out dtLastAccDate);
                    if (resp)
                    {
                        _ExistData.LastAccDate = dtLastAccDate;
                    }
                    else
                    {
                        _ExistData.LastAccDate = new DateTime(1900, 1, 1);
                    }
                    _ExistData.ContactPerson   = r["ContactPerson"].ToString();
                    _ExistData.ContactTPnumber = r["ContactTPnumber"].ToString();
                    _ExistData.PaymentTerms    = r["PaymentTerms"].ToString();
                    int inCreditPeriod = 0;
                    resp = int.TryParse(r["CreditPeriod"].ToString(), out inCreditPeriod);
                    _ExistData.CreditPeriod   = inCreditPeriod;
                    _ExistData.DeleveryMethod = r["DeleveryMethod"].ToString();
                    _ExistData.Shippingadd1   = r["Shippingadd1"].ToString();
                    _ExistData.ShippingAdd2   = r["ShippingAdd2"].ToString();
                    _ExistData.ShippingAdd3   = r["ShippingAdd3"].ToString();
                    _ExistData.Country        = r["Country"].ToString();
                    _ExistData.CusID          = r["CusID"].ToString();
                    _ExistData.FFName         = r["FFName"].ToString();
                    _ExistData.FFAccountNo    = r["FFAccountNo"].ToString();
                    int inUnderG4 = 0;
                    resp = int.TryParse(r["UnderG4"].ToString(), out inUnderG4);
                    _ExistData.UnderG4        = inUnderG4;
                    _ExistData.Email_OrderAcn = r["Email_OrderAcn"].ToString();
                    _ExistData.Email_Invoice  = r["Email_Invoice"].ToString();
                    _ExistData.Email_Complain = r["Email_Complain"].ToString();
                    int inNeedCustomerLogo = 0;
                    resp = int.TryParse(r["NeedCustomerLogo"].ToString(), out inNeedCustomerLogo);
                    _ExistData.NeedCustomerLogo = inNeedCustomerLogo;
                    _ExistData.CurrenyCode      = r["CurrenyCode"].ToString();
                    return("True");
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }
            else
            {
                return("data not found ");
            }
        }