Ejemplo n.º 1
0
        void DoSave(bool SaveEdit)
        {
            if (!DoValidate())
            {
                var sup = new Supplier();
                sup.DsContact = dsMaster1.CONTACTMAST;
                sup.SUPPLIERNAME = vendorname.Text.Replace("'", "");
                sup.ARSUPPLIERNAME = string.Empty;
                sup.ALTERNATENAME = aliasname.Text;
                sup.ADDRESS = address.Text; //1500,
                sup.PHONE = phoneno.Text;
                sup.FAX = faxno.Text;//15
                sup.ACTIVE = bool.Parse(status.Checked.ToString());
                sup.CONTACAT = contact.Text;
               
                sup.EMAILID = email.Text;
                sup.WEBPAGE = webpage.Text; //60
                if (duedays.EditValue != null)
                    sup.DUEDAYS = int.Parse(duedays.EditValue.ToString());

                sup.VENDORSINCE = vendorsince.EditValue != null ? DateTime.Parse(vendorsince.EditValue.ToString()) : new DateTime(1900, 1, 1);
                sup.ACCOUNTNO = accountno.Text;
                if (!string.IsNullOrEmpty(balanceasof.Text))
                    sup.BALANCE = decimal.Parse(balance.Value.ToString());
                if (balanceasof.EditValue != null)
                    sup.BALANCEASOF = DateTime.Parse(balanceasof.EditValue.ToString());
                else
                {
                    sup.BALANCEASOF = new DateTime(1900, 1, 1); //SqlDateTime.Null;  
                }
                sup.NOTE = notes.Text;

                if (c1Expense.EditValue!=null)
                    sup.EXPACCID = int.Parse(c1Expense.EditValue.ToString());
                if (c1Grouping.EditValue != null)
                    sup.SUPGROUP = int.Parse(c1Grouping.EditValue.ToString());
                if (creditlimit.EditValue!=null)
                    sup.CREDITLIMIT = decimal.Parse(creditlimit.EditValue.ToString());
                if (c1Shipping.EditValue != null)
                    sup.DEFSHIPPING = int.Parse(c1Shipping.EditValue.ToString());
                if (c1Payment.EditValue!=null)
                    sup.DEFPAYMENT = int.Parse(c1Payment.EditValue.ToString());
                if (c1Terms.EditValue!=null)
                    sup.PAYTERMS = int.Parse(c1Terms.EditValue.ToString());
                var t = new SupplierManager();
                if(string.IsNullOrEmpty(supplierno))
                {
                    string r = t.AddSupplier(sup);
                    if (r =="1")
                    {
                        supplierno = Utils.SupplierNo;
                        vendorno.Text = Utils.SupplierNo;
                        XtraMessageBox.Show("Supplier Created", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    sup.SUPPLIERNO = supplierno;
                    foreach (DataRow d in dsMaster1.CONTACTMAST.Rows)
                        {
                            d["REFID"] = supplierno;
                            d["CONTTYPE"] = 2;
                        }
                    sup.DsContact = dsMaster1.CONTACTMAST;
                    bool flag = t.UpdateSupplier(sup);
                    XtraMessageBox.Show("Supplier updated", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Ejemplo n.º 2
0
        void ViewData(Supplier sup)
        {
            isnew = false;
            //sup.DsContact = this.dSPOSSTORE.CONTACTMAST;
            vendorno.Text = sup.SUPPLIERNO;
            vendorname.Text = sup.SUPPLIERNAME;
            aliasname.Text = sup.ALTERNATENAME;
            address.Text = sup.ADDRESS; //1500,
            phoneno.Text = sup.PHONE;
            faxno.Text = sup.FAX;//15
            status.Checked = sup.ACTIVE;
            email.Text = sup.EMAILID;
            webpage.Text = sup.WEBPAGE; //60
            balanceasof.Enabled = false;
            balance.Enabled = false;
            contact.Text = sup.CONTACAT;
            duedays.EditValue = sup.DUEDAYS;

            if (sup.VENDORSINCE.Year <= 1900)
            {
                vendorsince.EditValue = null;
            }
            else
            {
                vendorsince.EditValue = sup.VENDORSINCE;
            }
            accountno.Text = sup.ACCOUNTNO;
            //if (!string.IsNullOrEmpty(balance.Text))
            if (sup.BALANCEASOF.Year <= 1900)
            {
                balanceasof.EditValue = null;
            }
            else
            {
                balanceasof.EditValue = sup.BALANCEASOF;
            }
            //if (!string.IsNullOrEmpty(balanceasof.Value.ToString()))
            balance.Value = sup.BALANCE;
            notes.Text = sup.NOTE;
            //if (!string.IsNullOrEmpty(c1Expense.SelectedText.ToString()))
            c1Expense.EditValue  = sup.EXPACCID;
            //if (!string.IsNullOrEmpty(c1Grouping.SelectedText.ToString()))
            c1Grouping.EditValue = sup.SUPGROUP;
            creditlimit.EditValue = sup.CREDITLIMIT;
            //if (!string.IsNullOrEmpty(c1Shipping.SelectedText.ToString()))
            c1Shipping.EditValue = sup.DEFSHIPPING;
            //if (!string.IsNullOrEmpty(c1Payment.SelectedText.ToString()))
            c1Payment.EditValue = sup.DEFPAYMENT;
            //if (!string.IsNullOrEmpty(c1Terms.SelectedText.ToString()))
            c1Terms.EditValue = sup.PAYTERMS;
           
            
            //var t = new SupplierManager();
            //string Returnval = t.AddSupplier(sup);
            //XtraMessageBox.Show(Returnval);
        }
Ejemplo n.º 3
0
        void DoSave(bool SaveEdit)
        {
            if (!DoValidate())
            {
                var sup = new Supplier();
                sup.DsContact = this.dSPOSSTORE.CONTACTMAST;
                sup.SUPPLIERNAME = vendorname.Text.Replace("'","") ;
                sup.ARSUPPLIERNAME=string.Empty;
                sup.ALTERNATENAME = aliasname.Text;
                sup.ADDRESS=address.Text   ; //1500,
                sup.PHONE=phoneno.Text;
                sup.FAX = faxno.Text ;//15
                sup.ACTIVE = bool.Parse(status.Checked.ToString());
                sup.CONTACAT = contact.Text;
                sup.DUEDAYS = (int) duedays.EditValue;
                sup.EMAILID = email.Text;
                sup.WEBPAGE= webpage.Text; //60
                if (duedays.EditValue != null)
                    sup.DUEDAYS = int.Parse(duedays.EditValue.ToString());
                if (vendorsince.EditValue != null)
                    //    if (!string.IsNullOrEmpty(vendorsince.EditValue.ToString()))
                    sup.VENDORSINCE =  DateTime.Parse(vendorsince.EditValue.ToString());
                else
                {

                    sup.VENDORSINCE = new DateTime(1900, 1, 1); //SqlDateTime.Null;  
                }
                //sup.VENDORSINCE =  vendorsince.Value.Date; 
                sup.ACCOUNTNO = accountno.Text;
                if(!string.IsNullOrEmpty(balanceasof.Text))
                        sup.BALANCE= decimal.Parse(balance.Value.ToString());
                //if(!string.IsNullOrEmpty(balanceasof.EditValue.ToString()))

                if (balanceasof.EditValue != null)
                    sup.BALANCEASOF = DateTime.Parse(balanceasof.EditValue.ToString());
                    
                else
                {

                    sup.BALANCEASOF = new DateTime(1900, 1, 1); //SqlDateTime.Null;  
                }
                sup.NOTE = notes.Text;

                if(!string.IsNullOrEmpty(c1Expense.SelectedText.ToString()))
                    sup.EXPACCID= int.Parse(c1Expense.SelectedValue.ToString()) ;
                if (!string.IsNullOrEmpty(c1Grouping.SelectedText.ToString()))
                    sup.SUPGROUP =int.Parse(c1Grouping.SelectedValue.ToString());
                sup.CREDITLIMIT = decimal.Parse(creditlimit.Value.ToString());
                if (!string.IsNullOrEmpty(c1Shipping.SelectedText.ToString()))
                     sup.DEFSHIPPING =  int.Parse(c1Shipping.SelectedValue.ToString()) ;
                if (!string.IsNullOrEmpty(c1Payment.SelectedText.ToString()))
                    sup.DEFPAYMENT = int.Parse(c1Payment.SelectedValue.ToString());
                if (!string.IsNullOrEmpty(c1Terms.SelectedText.ToString()))
                    sup.PAYTERMS = int.Parse(c1Terms.SelectedValue.ToString());
                var t = new SupplierManager();
                if (SaveEdit)
                {
                    string Returnval = t.AddSupplier(sup);
                    XtraMessageBox.Show(Returnval);
                }
                else
                {
                    sup.SUPPLIERNO = supplierno;
                    bool flag = t.UpdateSupplier(sup);
                    if (flag)
                    {
                        foreach (DataRow d in dSPOSSTORE.CONTACTMAST.Rows)
                        {
                            d["REFID"] = supplierno;
                            d["CONTTYPE"] = 2;
                        }
                        this.cONTACTMASTTableAdapter.Update(this.dSPOSSTORE.CONTACTMAST);
                        foreach (DataRow d in dSPOSSTORE.ADDRESSMAST.Rows)
                        {
                            d["REFID"] = supplierno;
                            d["CONTTYPE"] = 2;
                        }
                        this.addressmastTableAdapter1.Update(this.dSPOSSTORE.ADDRESSMAST);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        void MoveRecord()
        {
            DataRow dr = dsMaster1.SUPPLIER.FindBySUPPLIERNO(supplierno);
            var sup = new Supplier(dr);
            dsMaster1.Merge(new Contacts().GetContact(2,supplierno));

  
            
            ViewData(sup);
        }
Ejemplo n.º 5
0
 void MoveRecord()
 {
     DataRow dr = dSPOSSTORE.SUPPLIER.FindBySUPPLIERNO(supplierno);
     var sup = new Supplier(dr);
     cONTACTMASTTableAdapter.Fill(dSPOSSTORE.CONTACTMAST, supplierno, 2);
     sup.DsContact = dSPOSSTORE.CONTACTMAST;
     addressmastTableAdapter1.Fill(dSPOSSTORE.ADDRESSMAST, supplierno, 2);
     foreach (DataRow d in dSPOSSTORE.ADDRESSMAST.Rows)
     {
         Address.STREET = d["street"].ToString();
         Address.ZIPCODE = d["ZIPCODE"].ToString();
         Address.CITY = d["city"].ToString();
         Address.COUNTRY = d["country"].ToString();
         Address.REFID = supplierno;
     }
     ViewData(sup);
 }