Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 4
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);
     }
 }
 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;
         }
     }
 }
Ejemplo n.º 6
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;
         }
     }
 }
        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);
            }
        }
Ejemplo n.º 8
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); }
 }
 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); }
 }