コード例 #1
0
        public bool AddNewCustomer(Customer customer)
        {
            int id = Convert.ToInt32(Functions.IDGeneration(MyShopConfigration.Custmors)) + 1;

            SysRegedit.SaveReg(MyShopConfigration.Custmors, id.ToString() + "." + customer.Name, "Id", id.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Custmors, id.ToString() + "." + customer.Name, "Name", Name);
            SysRegedit.SaveReg(MyShopConfigration.Custmors, id.ToString() + "." + customer.Name, "Address", Address);
            SysRegedit.SaveReg(MyShopConfigration.Custmors, id.ToString() + "." + customer.Name, "PIN", PIN.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Custmors, id.ToString() + "." + customer.Name, "Mobile", Mobile);
            SysRegedit.SaveReg(MyShopConfigration.Custmors, id.ToString() + "." + customer.Name, "Email", Email);
            return(true);
        }
コード例 #2
0
        //public static void ClearTextBox(Form from)
        //{
        //    foreach (var item in from.Controls)
        //    {
        //        if (item.GetType() == typeof(TextBox))
        //        {
        //            TextBox textBox = (TextBox)item;
        //            textBox.Text = "";//9946
        //        }
        //    }
        //}
        public static int BuildBillNo()
        {
            int a = 0;

            if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "BillNo") != "")
            {
                a = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "BillNo"));
                a++;
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "BillNo", a.ToString());
            }
            return(a);
        }
コード例 #3
0
 public static bool ChangeUsername(string oldUsername, string newUsername)
 {
     if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Login", "Username") == oldUsername)
     {
         SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Login", "Username", newUsername);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #4
0
 public static bool ChangePassword(string oldPassword, string newPassword)
 {
     if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Login", "Password") == oldPassword)
     {
         SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Login", "Password", newPassword);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #5
0
 public static bool Login(User user)
 {
     if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Login", "Username")
         == user.UserName && SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Login", "Password") == user.Password)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #6
0
 public static void DeleteProduct(Product[] product, int id)
 {
     string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Products);
     for (int i = 0; i < product.Length; i++)
     {
         if (id == Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Id")))
         {
             SysRegedit.DeleteSubKey(MyShopConfigration.Products, temp[i]);
             break;
         }
     }
 }
コード例 #7
0
 public static void DeleteCustomer(Customer[] customer, int id)
 {
     string[] temp = SysRegedit.GetSubKeyNames(MyShopConfigration.Custmors);
     for (int i = 0; i < customer.Length; i++)
     {
         if (id == Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Id")))
         {
             SysRegedit.DeleteSubKey(MyShopConfigration.Custmors, temp[i]);
             //return true;
             break;
         }
     }
 }
コード例 #8
0
        public void Reset()
        {
            string[]   tempCustmors = SysRegedit.GetSubKeyNames(MyShopConfigration.Custmors);
            Customer[] custmoers    = Customer.ViewCustmoers(MyShopConfigration.Custmors);

            string[] tempBills = SysRegedit.GetSubKeyNames(MyShopConfigration.Bill);

            string[]  tempProducts = SysRegedit.GetSubKeyNames(MyShopConfigration.Products);
            Product[] products     = Product.ViewProducts(MyShopConfigration.Products);

            try
            {
                for (int i = 0; i < custmoers.Length; i++)
                {
                    SysRegedit.DeleteSubKey(MyShopConfigration.Custmors, tempCustmors[i]);
                }
            }
            catch (Exception)
            { }

            try
            {
                for (int i = 0; i < products.Length; i++)
                {
                    SysRegedit.DeleteSubKey(MyShopConfigration.Products, tempProducts[i]);
                }
            }
            catch (Exception)
            { }


            string[] billId      = Bill.LoadId();
            Bill[]   bill        = new Bill[Bill.TotalBillCount()];
            string[] subKeyNames = SysRegedit.GetSubKeyNames(MyShopConfigration.Bill);
            for (int i = 0; i < bill.Length; i++)
            {
                bill[i] = Bill.ViewBill(billId[i].Remove(billId[i].IndexOf('.')));
                for (int j = 0; j < bill[i].Products.Count; j++)
                {
                    SysRegedit.DeleteSubKey(MyShopConfigration.Bill + "\\" + subKeyNames[i], bill[i].Products[j].Name);
                }
                SysRegedit.DeleteSubKey(MyShopConfigration.Bill, subKeyNames[i]);
            }

            SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Settings");
            SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Login");
            SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Customers");
            SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Products");
            SysRegedit.DeleteSubKey(MyShopConfigration.ProjectName, "Bill");
        }
コード例 #9
0
        public bool AddNewProduct(Product product)
        {
            int id = Convert.ToInt32(Functions.IDGeneration(MyShopConfigration.Products)) + 1;

            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "Id", id.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "Name", Name);
            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "Price", Price.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "ExpDate", ExpDate.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "ManDate", ManDate.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "CompanyName", CompanyName);
            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "Quntity", Quntity.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Products, id.ToString() + "." + product.Name, "Features", Features);
            return(true);
        }
コード例 #10
0
        private void lblColor1_Click_1(object sender, EventArgs e)
        {
            Label lbl = (Label)sender;

            if (lbl.Name == "lblColor1")
            {
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "ActiveTheme", lbl.BackColor.Name);
            }
            else if (lbl.Name == "lblColor2")
            {
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "ActiveTheme", lbl.BackColor.Name);
            }
            else if (lbl.Name == "lblColor3")
            {
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "ActiveTheme", lbl.BackColor.Name);
            }
            else if (lbl.Name == "lblColor4")
            {
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "ActiveTheme", lbl.BackColor.Name);
            }
            else if (lbl.Name == "lblColor5")
            {
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "ActiveTheme", lbl.BackColor.Name);
            }
            else if (lbl.Name == "lblColor6")
            {
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "ActiveTheme", lbl.BackColor.Name);
            }

            ThemeService.ActiveTheme(this);

            foreach (Label control in this.pnlThemeList.Controls)
            {
                // Label lbl1 = (Label)control;
                if (this.BackColor == control.BackColor)
                {
                    control.BorderStyle = BorderStyle.Fixed3D;
                    control.Text        = "Active Theme";
                }
                else
                {
                    control.BorderStyle = BorderStyle.None;
                    control.Text        = "";
                }
            }
            lblColorName.BorderStyle = BorderStyle.None;
            lblColorName.Text        = this.BackColor.Name;
        }
コード例 #11
0
 private void tmrMain_Tick_1(object sender, EventArgs e)
 {
     b++;
     if (b == 10)
     {
         lblMachineName.Visible = true;
         lblMachineName.Text    = lblMachineName.Text + "  " + Environment.MachineName;
     }
     else if (b == 20)
     {
         lblOSBuild.Visible = true;
         lblOSBuild.Text    = lblOSBuild.Text + "  " + Environment.OSVersion.ToString();
     }
     else if (b == 30)
     {
         lblProcesserCount.Visible = true;
         lblProcesserCount.Text    = lblProcesserCount.Text + "  " + Environment.ProcessorCount.ToString() + " only.";
     }
     else if (b == 40)
     {
         lblSysPageSize.Visible = true;
         lblSysPageSize.Text    = lblSysPageSize.Text + "  " + Environment.ProcessorCount.ToString() + " only.";
     }
     else if (b == 45)
     {
         pnlSysChek.Visible = false;
         lblMessage.Visible = true;
     }
     else if (b == 60)
     {
         lblMessage.Text = "Installing " + MyShopConfigration.ProjectName + " components.";
         SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "Themes", MyShopConfigration.Themes);
         SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "ActiveTheme", MyShopConfigration.ActiveTheme);
         SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Login", "Username", MyShopConfigration.Username);
         SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Login", "Password", MyShopConfigration.Password);
         SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "New", "1");
     }
     else if (b == 80)
     {
         lblMessage.Text = "All most done, plese wait...";
     }
     //  ColorCharge();
 }
コード例 #12
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            // string ss = SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New");
            if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New") == null || SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New") == "")
            {
                MyApplicationContext context = new MyApplicationContext(new Install());
                SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "New", "1");
                Application.Run(context);
                return;
            }

            else if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New") == "1")
            {
                MyApplicationContext context = new MyApplicationContext(new LogIn());
                Application.Run(context);
            }
        }
コード例 #13
0
 public static Customer[] ViewCustmoers(string root)
 {
     try
     {
         string[]   temp     = SysRegedit.GetSubKeyNames(MyShopConfigration.Custmors);
         Customer[] custmoer = new Customer[temp.Length];
         for (int i = 0; i < temp.Length; i++)
         {
             custmoer[i]         = new Customer();
             custmoer[i].Id      = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Id"));
             custmoer[i].Name    = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Name");
             custmoer[i].Address = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Address");
             custmoer[i].PIN     = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "PIN"));
             custmoer[i].Mobile  = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Mobile");
             custmoer[i].Email   = SysRegedit.ReadReg(MyShopConfigration.Custmors, temp[i], "Email");
         }
         return(custmoer);
     }
     catch (Exception)
     { return(null); }
 }
コード例 #14
0
        public static string IDGeneration(string subRoot)
        {
            string[] subKeynames = SysRegedit.GetSubKeyNames(subRoot);
            try
            {
                if (subKeynames.Length == 0 || subKeynames == null)
                {
                    return("0");
                }
            }
            catch (Exception)
            {
                return("0");
            }
            string a = string.Empty;

            for (int i = 0; i < subKeynames.Length; i++)
            {
                a = subKeynames[i].Substring(0, subKeynames[i].IndexOf('.'));
            }
            return(a);
        }
コード例 #15
0
 public static Product[] ViewProducts(string root)
 {
     try
     {
         string[]  temp    = SysRegedit.GetSubKeyNames(MyShopConfigration.Products);
         Product[] product = new Product[temp.Length];
         for (int i = 0; i < temp.Length; i++)
         {
             product[i]             = new Product();
             product[i].Id          = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Id"));
             product[i].Name        = SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Name");
             product[i].Price       = Convert.ToDecimal(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Price"));
             product[i].ExpDate     = Convert.ToString(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "ExpDate"));
             product[i].ManDate     = Convert.ToString(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "ManDate"));
             product[i].CompanyName = SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "CompanyName");
             product[i].Quntity     = Convert.ToDecimal(SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Quntity"));
             product[i].Features    = SysRegedit.ReadReg(MyShopConfigration.Products, temp[i], "Features");
         }
         return(product);
     }
     catch (Exception)
     { return(null); }
 }
コード例 #16
0
 private void picExport_Click(object sender, EventArgs e)
 {
     SysRegedit.ExportKey(Environment.CurrentDirectory + @"\MyShopBackUp" + DateTime.Now.ToString("dd_MMM") + ".reg", @"HKEY_CURRENT_USER\MyShop");
     System.Diagnostics.Process.Start("explorer.exe", Environment.CurrentDirectory);
 }