Example #1
0
        public void createcustfold()
        {
            CustomerConfirm custconf = new Trading_Post.CustomerConfirm();

            custconf.Show();
            const string message = "Is the customer information correct?";
            const string caption = "Confirm Customer Information";

            var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                taxesandfees();
                custconf.Close();
                string activeDir = @"c:\LayawayData\CustomerInfo\";
                string result1   = mname.Substring(0, 1);
                string custDir   = fname + "," + result1 + "," + lname;

                var plaintextbytes = System.Text.Encoding.UTF8.GetBytes(custDir);
                var finishbytes    = System.Convert.ToBase64String(plaintextbytes);


                //Create a new subfolder under the current active folder

                string newPath = System.IO.Path.Combine(activeDir, finishbytes);
                // Create the subfolder
                System.IO.Directory.CreateDirectory(newPath);
                // createsavefile();
                string finalpath = System.IO.Path.Combine(activeDir, finishbytes);
                string path      = finalpath + @"\" + "Data.txt";
                if (Regex.IsMatch(VehicleCostTextbox.Text, @"^[0-9]+$"))
                {
                    cost = Decimal.Parse(VehicleCostTextbox.Text.ToString() + ".00");
                }
                else
                {
                    cost = Decimal.Parse(VehicleCostTextbox.Text.ToString());
                }
                if (!File.Exists(finalpath))
                {
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        DateTime date = DateTime.Now.Date;

                        newtotal    += 55;
                        originalcost = newtotal;
                        date         = date.AddMonths(1);
                        var plaintextbytes1 = System.Text.Encoding.UTF8.GetBytes(fname + "," + result1 + "," + lname + "," + homephone + "," + cellphone +
                                                                                 "," + workphone + "," + addressline1 + "," + addressline2 + "," + city + "," + state + "," + make + "," + model + "," +
                                                                                 year + "," + color + "," + vin + "," + location + "," + cost + "," + originalcost + "," + taxtot + "," + taxtype + "," + taxrate + "," + newtotal + "," + date + "," + interestrate + "," + storagefee + "," + itemid);
                        var finishbytes1 = System.Convert.ToBase64String(plaintextbytes1);
                        sw.WriteLine(finishbytes1);
                        newtotal -= 55;
                        string path2 = finalpath + @"\" + "note.txt";
                        if (!File.Exists(finalpath))
                        {
                            using (StreamWriter aw = File.CreateText(path2))
                            {
                                DateTime thisDay  = DateTime.Today;
                                DateTime thistime = DateTime.Now;
                                aw.WriteLine(DateTime.Today.ToString("MM-dd-yyyy") + "," + DateTime.Now.ToString("HH:mm:ss") + "," + cost + "," + "Account Created" + "," + "~");
                                aw.WriteLine(DateTime.Today.ToString("MM-dd-yyyy") + "," + DateTime.Now.ToString("HH:mm:ss") + "," + cost + "," + taxtype + " " + taxrate + "," + "+" + taxtot + "," + newtotal + "~");
                                cost      = newtotal;
                                newtotal += 55;
                                aw.WriteLine(DateTime.Today.ToString("MM-dd-yyyy") + "," + DateTime.Now.ToString("HH:mm:ss") + "," + cost + "," + "Dealer Fee" + "," + "+55.00" + "," + newtotal + "~");
                            }
                        }
                        printPreviewDialog1.ShowDialog();
                        this.Close();
                        Main main = new Main();
                        main.Show();
                    }
                }
            }
            else
            {
                custconf.Close();
            }
        }
Example #2
0
        private void confirmeditbtn_Click(object sender, EventArgs e)
        {
            if (fnameprinttxtbox.Text != "" && mnameprinttxtbox.Text != "" && lnameprinttxtbox.Text != "" && statetxtbox.Text != "" && citytxtbox.Text != "" &&
                maketxtbox.Text != "" && modeltxtbox.Text != "" && yeartxtbox.Text != "" && colortxtbox.Text != "" && colortxtbox.Text != "" && Vehicleloctxtbox.Text != "" && vehiclecostdatalabel.Text != "")
            {
                if (homephonetxtbox.Text != "" || textBox2.Text != "")
                {
                    if (addressline1datatxtbox.Text != "" || addressline2datatxtbox.Text != "")
                    {
                        custcheck     = 1;
                        fname         = fnameprinttxtbox.Text;
                        mname         = mnameprinttxtbox.Text;
                        lname         = lnameprinttxtbox.Text;
                        homephone     = homephonetxtbox.Text;
                        cellphone     = textBox2.Text;
                        workphone     = textBox3.Text;
                        addressline1  = addressline1datatxtbox.Text;
                        addressline2  = addressline2datatxtbox.Text;
                        city          = citytxtbox.Text;
                        state         = statetxtbox.Text;
                        make          = maketxtbox.Text;
                        model         = modeltxtbox.Text;
                        year          = yeartxtbox.Text;
                        color         = colortxtbox.Text;
                        vin           = VINtxtbox.Text;
                        location      = Vehicleloctxtbox.Text;
                        cost          = Decimal.Parse(vehiclecostdatalabel.Text);
                        remainbalance = Decimal.Parse(remainbal.Text);

                        CustomerConfirm custconf = new Trading_Post.CustomerConfirm();
                        custconf.Show();
                        const string message = "Is the customer information correct?";
                        const string caption = "Confirm Customer Information";
                        label11.Text = cost + "  " + remainbalance;
                        var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (result == DialogResult.Yes)
                        {
                            custcheck = 0;
                            editfile();
                            Main openmain = new Trading_Post.Main();
                            openmain.Show();
                            custconf.Close();
                            this.Close();
                        }
                        else
                        {
                            custconf.Close();
                            backagain();
                        }
                    }
                }
            }
            else
            if (fnameprinttxtbox.Text == "")
            {
                fnameprinttxtbox.BackColor = Color.Yellow;
                warninglabel.Show();
            }
            if (mnameprinttxtbox.Text == "")
            {
                mnameprinttxtbox.BackColor = Color.Yellow;
            }
            if (lnameprinttxtbox.Text == "")
            {
                lnameprinttxtbox.BackColor = Color.Yellow;
            }

            if (homephonetxtbox.Text == "")
            {
                homephonetxtbox.BackColor = Color.Yellow;
            }

            if (textBox2.Text == "")
            {
                if (textBox3.Text == "")
                {
                    textBox3.BackColor = Color.Yellow;
                    textBox2.BackColor = Color.Yellow;
                }
            }
            if (addressline1datatxtbox.Text == "")
            {
                addressline1datatxtbox.BackColor = Color.Yellow;
            }
            if (addressline2datatxtbox.Text == "")
            {
                addressline2datatxtbox.BackColor = Color.Yellow;
            }
            if (citytxtbox.Text == "")
            {
                citytxtbox.BackColor = Color.Yellow;
            }
            if (statetxtbox.Text == "")
            {
                statetxtbox.BackColor = Color.Yellow;
            }
            if (maketxtbox.Text == "")
            {
                maketxtbox.BackColor = Color.Yellow;
            }
            if (modeltxtbox.Text == "")
            {
                modeltxtbox.BackColor = Color.Yellow;
            }
            if (yeartxtbox.Text == "")
            {
                yeartxtbox.BackColor = Color.Yellow;
            }
            if (colortxtbox.Text == "")
            {
                colortxtbox.BackColor = Color.Yellow;
            }
            if (VINtxtbox.Text == "")
            {
                VINtxtbox.BackColor = Color.Yellow;
            }
            if (Vehicleloctxtbox.Text == "")
            {
                Vehicleloctxtbox.BackColor = Color.Yellow;
            }
        }