Пример #1
0
 public Login_Form(int type, Main_Form form)
 {
     this.type = type;
     this.form = form;
     InitializeComponent();
 }
Пример #2
0
        internal ForecastTable getForecastTable(int region_id, int forecasted_yData_type, int month_min, int month_max, int forecasting_Type, string number, Main_Form main_Form)
        {
            int tempnumber;

            bool result = Int32.TryParse(number, out tempnumber);

            if (!result)
            {
                MetroFramework.MetroMessageBox.Show(main_Form, "Forecasting number should be an integer value" + "\n" + "Please insert a correct value", "Forecasting number is not an integer", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (month_max > 12)
                {
                    DataSet ds    = dr.getGraphDataOnMonth(region_id, month_min);
                    int     count = ds.Tables[0].Rows.Count;
                    Console.WriteLine(count);

                    decimal[] array = new decimal[count];

                    if (forecasted_yData_type == 1)
                    {
                        int index = 0;
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            array[index] = Convert.ToDecimal(row["quantity"].ToString());
                            index++;
                        }

                        int           forecasting_number = Convert.ToInt32(number);
                        ForecastTable ft = this.getForecastedTable(array, forecasting_number, forecasting_Type);//fm.naive(array, 10, 0);
                        return(ft);
                    }
                    else
                    {
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            decimal income = Convert.ToDecimal(row["total_income"].ToString());
                        }

                        ForecastTable ft = fm.naive(array, 10, 0);
                        return(ft);
                    }
                }
                else
                {
                    return(null);
                }
            }
            return(null);
        }
Пример #3
0
 internal int checkNewAccountdetails(int type, string name, string email, string username, string password1, string password2, Main_Form main_Form, string filePath, string filename)
 {
     if (type == 1)
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds    = dr.getAdminOnUsername(username);
             int     count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                     dr.createNewAdmin(name, email, username, password);
                     MetroFramework.MetroMessageBox.Show(main_Form, "New administrator account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return(0);
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not Match", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else if (type == 2)
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds    = dr.getAnalystOnUsername(username);
             int     count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                     dr.createNewAnalysist(name, email, username, password);
                     MetroFramework.MetroMessageBox.Show(main_Form, "New anlysist account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return(0);
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not Match", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else if (type == 3)
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds    = dr.getDealerOnUsername(username);
             int     count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     if (filename.Equals(""))
                     {
                         MetroFramework.MetroMessageBox.Show(main_Form, "Image has not chosen", "Please choose an image", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     }
                     else
                     {
                         string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                         bool   result   = dr.uploadDealerImage(filePath);
                         if (result)
                         {
                             string ImagePathInWeb = "http://dinindu.pe.hu/Images/" + filename;
                             dr.createNewDealer(name, email, username, password, ImagePathInWeb);
                             MetroFramework.MetroMessageBox.Show(main_Form, "New dealer account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                             return(0);
                         }
                         else
                         {
                             MetroFramework.MetroMessageBox.Show(main_Form, "An Error Occured", "An error occurred while saving the image file", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                     }
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not match with each other", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds    = dr.getReviewerOnUsername(username);
             int     count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                     dr.createNewReviewer(name, email, username, password);
                     MetroFramework.MetroMessageBox.Show(main_Form, "New reviewer account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return(0);
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not match with each other", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     return(1);
 }
        internal ForecastTable getForecastTable(int region_id, int forecasted_yData_type, int month_min, int month_max, int forecasting_Type,string number, Main_Form main_Form)
        {
            int tempnumber;

            bool result = Int32.TryParse(number, out tempnumber);
            if (!result)
            {
                MetroFramework.MetroMessageBox.Show(main_Form, "Forecasting number should be an integer value" + "\n" + "Please insert a correct value", "Forecasting number is not an integer", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (month_max > 12)
                {
                    DataSet ds = dr.getGraphDataOnMonth(region_id, month_min);
                    int count = ds.Tables[0].Rows.Count;
                    Console.WriteLine(count);

                    decimal[] array = new decimal[count];

                    if (forecasted_yData_type == 1)
                    {
                        int index = 0;
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            array[index] = Convert.ToDecimal(row["quantity"].ToString());
                            index++;
                        }

                        int forecasting_number = Convert.ToInt32(number);
                        ForecastTable ft = this.getForecastedTable(array, forecasting_number, forecasting_Type);//fm.naive(array, 10, 0);
                        return ft;
                    }
                    else
                    {
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            decimal income = Convert.ToDecimal(row["total_income"].ToString());
                        }

                        ForecastTable ft = fm.naive(array, 10, 0);
                        return ft;
                    }

                }
                else
                {
                    return null;
                }
            }
            return null;
        }
 internal int checkNewAccountdetails(int type, string name, string email, string username, string password1, string password2, Main_Form main_Form, string filePath, string filename)
 {
     if (type == 1)
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds = dr.getAdminOnUsername(username);
             int count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                     dr.createNewAdmin(name, email, username, password);
                     MetroFramework.MetroMessageBox.Show(main_Form, "New administrator account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return 0;
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not Match", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else if (type == 2)
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds = dr.getAnalystOnUsername(username);
             int count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                     dr.createNewAnalysist(name, email, username, password);
                     MetroFramework.MetroMessageBox.Show(main_Form, "New anlysist account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return 0;
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not Match", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else if (type == 3)
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds = dr.getDealerOnUsername(username);
             int count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     if (filename.Equals(""))
                     {
                         MetroFramework.MetroMessageBox.Show(main_Form, "Image has not chosen", "Please choose an image", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     }
                     else
                     {
                         string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                         bool result = dr.uploadDealerImage(filePath);
                         if (result)
                         {
                             string ImagePathInWeb = "http://dinindu.pe.hu/Images/" + filename;
                             dr.createNewDealer(name, email, username, password, ImagePathInWeb);
                             MetroFramework.MetroMessageBox.Show(main_Form, "New dealer account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                             return 0;
                         }
                         else
                         {
                             MetroFramework.MetroMessageBox.Show(main_Form, "An Error Occured", "An error occurred while saving the image file", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                     }
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not match with each other", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         if ((name != "") || (email != "") || (username != "") || (password1 != "") || (password2 != ""))
         {
             DataSet ds = dr.getReviewerOnUsername(username);
             int count = ds.Tables[0].Rows.Count;
             if (count > 0)
             {
                 MetroFramework.MetroMessageBox.Show(main_Form, "Username is already in use", "Username should be Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 if (password1.Equals(password2))
                 {
                     string password = encrypter.Encrypt(password1, ENCRYPT_KEY);
                     dr.createNewReviewer(name, email, username, password);
                     MetroFramework.MetroMessageBox.Show(main_Form, "New reviewer account was successfully created", "New account created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return 0;
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(main_Form, "Passwords are not similar", "Passwords do not match with each other", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(main_Form, "There are incomplete text fields", "Form is Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     return 1;
 }
 public ChangePasswordWindow(int type, Main_Form main_Form)
 {
     this.type = type;
     this.form = main_Form;
     InitializeComponent();
 }