예제 #1
0
        private void Mohasebe_Copy1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog dialog = new OpenFileDialog
                {
                    CheckFileExists = true,
                    Multiselect     = false,
                    Filter          = "Images (*.jpg,*.png)|*.jpg;*.png|All Files(*.*)|*.*"
                };

                dialog.ShowDialog();
                {
                    StrName   = dialog.SafeFileName;
                    ImageName = dialog.FileName;
                    ImageSourceConverter isc = new ImageSourceConverter();
                    if (ImageName != "")
                    {
                        QRImage.SetValue(System.Windows.Controls.Image.SourceProperty, isc.ConvertFromString(ImageName));
                    }
                }
            }
            catch
            {
                ErrorPage Er = new ErrorPage();
                Er.Show();
                Er.Error_Lable.Content = "مشکلی در سیستم به وجود آمده است";
            }
        }
예제 #2
0
        private void Show_ChargePage(object sender, RoutedEventArgs e)
        {
            object item = DataGrid_User.SelectedItem;

            PublicVar.GUserName   = (DataGrid_User.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
            PublicVar.GUserFamily = (DataGrid_User.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text;
            PublicVar.GUserID     = Convert.ToInt32((DataGrid_User.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text);

            profile_user w_charge  = new profile_user();
            MemberCharge memcharge = new MemberCharge();
            ErrorPage    pageerror = new ErrorPage();

            if (DataGrid_User.SelectedItem != null)
            {
                w_charge.memberfamily = (DataGrid_User.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text;
                w_charge.memberid     = Convert.ToInt32((DataGrid_User.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text);
                w_charge.membername   = (DataGrid_User.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
                this.Opacity          = 0.2;
                w_charge.Show();
            }
            else
            {
                pageerror.Show();
            }
        }
예제 #3
0
        private void newuser_MouseDown(object sender, MouseButtonEventArgs e)
        {

            string time = DateTime.Now.ToString("HH:mm");
            Inv U = new Inv();
            SucFul S = new SucFul();
            ErrorPage E = new ErrorPage();


        }
예제 #4
0
        private bool Cheakable()
        {
            if (Username.Text == "")
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();
                ER.Error_Lable.Content = "نام ورزشکار را وارد کنید";
                Username.Focus();
                return(false);
            }
            if (UserFamily.Text == "")
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();

                UserFamily.Focus();
                return(false);
            }
            if (UserTel.Text == "")
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();

                UserTel.Focus();
                return(false);
            }
            if (UserFamily.Text == "")
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();

                UserFamily.Focus();
                return(false);
            }
            if (UserAge.Text == "")
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();

                UserAge.Focus();
                return(false);
            }
            if (UserLocation.Text == "")
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();
                UserLocation.Focus();
                return(false);
            }


            return(true);
        }
예제 #5
0
        private void MoshtariView_Win(object sender, RoutedEventArgs e)
        {
            try
            {
                Users w_user = new Users();
                w_user.Show();
            }

            catch
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();
                ER.Error_Lable.Content = "مشکل در ارتباط با پایگاه ";
            }
        }
예제 #6
0
        private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            PriceStory l  = new PriceStory();
            ErrorPage  es = new ErrorPage();

            if (test_lb_Copy.Content != "")
            {
                l.txt_id.Text = txt_username.Text.Trim();
                l.Show();
            }

            if (test_lb_Copy.Content == "")
            {
                es.Show();
                es.Error_Lable.Content = "شما کد کاربری درستی وارد کنید.";
            }
        }
예제 #7
0
        private void newuser_Click(object sender, RoutedEventArgs e)
        {
            string    time = DateTime.Now.ToString("HH:mm");
            Inv       U    = new Inv();
            SucFul    S    = new SucFul();
            ErrorPage E    = new ErrorPage();


            string ClosedID = Txt_Komod.Text.ToString();


            try
            {
                U.UserID       = Convert.ToInt16(txt_id.Text);
                U.InvEnterDate = time;
                U.InvOutDate   = "1";
                if (Txt_Komod.Text.Trim() != "")
                {
                    U.InvCount = Convert.ToInt32(Txt_Komod.Text);
                }
                else if (Txt_Komod.Text.Trim() == "")
                {
                    U.InvCount = 1;
                }
                U.InvDate = String.Format("{0:yyyy/MM/dd}", Convert.ToDateTime(EnterDate.Text));



                database.Inv.Add(U);
                database.SaveChanges();



                ShowUserInfo(searchstate);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString());
            }
            finally
            {
                txt_id.Focus();
                txt_id.Text    = "";
                Txt_Komod.Text = "";
            }
        }
예제 #8
0
        private void aaa_Click(object sender, RoutedEventArgs e)
        {
            SucFul       s = new SucFul();
            ErrorPage    E = new ErrorPage();
            MemberCharge m = new MemberCharge();

            try
            {
                ControlID.TextData = a.Text;
            }
            catch
            {
                E.Error_Lable.Content = "در ثبت بدهی مشتری مشکلی به وجود آمده است";
            }
            finally
            {
                this.Hide();
            }
        }
예제 #9
0
        private void Show_ReChargePage(object sender, RoutedEventArgs e)
        {
            object itemOne = DataGrid_User.SelectedItem;

            MemberCharge ChargePage = new MemberCharge();
            ErrorPage    pageerror  = new ErrorPage();

            if (DataGrid_User.SelectedItem != null)
            {
                ChargePage.MemberName   = (DataGrid_User.SelectedCells[1].Column.GetCellContent(itemOne) as TextBlock).Text;
                ChargePage.MemberFamily = (DataGrid_User.SelectedCells[2].Column.GetCellContent(itemOne) as TextBlock).Text;
                ChargePage.memberid     = ((DataGrid_User.SelectedCells[0].Column.GetCellContent(itemOne) as TextBlock).Text);
                ChargePage.Show();
                this.Opacity = 0.2;
            }
            else
            {
                pageerror.Show();
            }
        }
예제 #10
0
        private void UserInfoShowing(object sender, RoutedEventArgs e)
        {
            object   itemOne = DataGrid_User.SelectedItem;
            UserInfo info    = new UserInfo();

            this.Opacity = 0.2;

            ErrorPage pageerror = new ErrorPage();

            if (DataGrid_User.SelectedItem != null)
            {
                info.MemberName   = (DataGrid_User.SelectedCells[1].Column.GetCellContent(itemOne) as TextBlock).Text;
                info.MemberFamily = (DataGrid_User.SelectedCells[2].Column.GetCellContent(itemOne) as TextBlock).Text;
                info.NewUserID    = Convert.ToInt32((DataGrid_User.SelectedCells[0].Column.GetCellContent(itemOne) as TextBlock).Text);

                info.Show();
                this.Opacity = 0.2;
            }
            else
            {
                pageerror.Show();
            }
        }
예제 #11
0
        private void newuser_Click(object sender, RoutedEventArgs e)
        {
            // ShowUserInfo(searchstate);



            try
            {
                Members U   = new Members();
                Submit  Sub = new Submit();
                // text box ro be sorate automatic bebarim ye mah bad va age motaqaier b on rooz resid bege qeir faal an
                int    bedehs;
                string descs;

                LinkBedehi l = new LinkBedehi();


                if (BedehiDescText.Text == " را اینجا وارد کنید")
                {
                    descs = "توضیح این بدهی وجود ندارد";
                }
                else
                {
                    descs = BedehiDescText.Text;
                }
                if (Convert.ToDecimal(BedehiText.Text) == 50)
                {
                    bedehs = 0;
                }
                else
                {
                    bedehs = 2;
                }


                U.MemberFactorCode = Convert.ToInt64(TextBoxFactor.Text.Trim());
                U.MemberFindID     = Convert.ToInt32(txt_username.Text.Trim());


                U.MemberDesc      = TozihTextBox.Text == "توضیحات این فاکتور را بنویسید." ? "فاکتور خرید" : TozihTextBox.Text;
                U.BedehKariDesc   = TozihTextBox.Text == "توضیحات این فاکتور را بنویسید." ? "فاکتور خرید" : TozihTextBox.Text;
                U.MemberCharge    = Convert.ToDecimal(UserCharge.Text.Trim());
                U.MemberCharge    = Convert.ToDecimal(UserCharge.Text.Trim());
                U.UserBedehiRial  = Convert.ToDecimal(BedehiText.Text.Trim()) == 50 ? 0 : Convert.ToDecimal(BedehiText.Text.Trim());
                U.MemberService   = Convert.ToByte(bedehs);
                U.MemberStartDate = String.Format("{0:yyyy/MM/dd}", Convert.ToDateTime(Lbl_Name_Copy.Content));


                database.Members.Add(U);
                database.SaveChanges();
                SucFul Suc = new SucFul();

                Suc.Show();
                Suc.Suclbl.Content = "فاکتور با موفقیت ثبت شد";
            }
            catch
            {
                ErrorPage E = new ErrorPage();
                E.Show();
                E.Error_Lable.Content = "کد کاربری درستی وارد کنید";
                txt_username.Focus();
            }
        }
예제 #12
0
        private void newuser_Click(object sender, RoutedEventArgs e)
        {
            Form2 F1 = new Form2();

            if (!Cheakable())
            {
                return;
            }
            try
            {
                int mount = Taghvim.SelectedDate.Month;
                int day   = Taghvim.SelectedDate.Day;
                int year  = Taghvim.SelectedDate.Year;

                string Year2 = year + "/" + mount + "/" + day;


                if (Hanis.SelectedIndex == 0)
                {
                    PayaneCharge.SelectedDate = PersianDate.Today.AddDays(30);

                    Year2 = year + "/" + (mount + 1) + "/" + day;
                }
                else if (Hanis.SelectedIndex == 1)
                {
                    PayaneCharge.SelectedDate = PersianDate.Today.AddDays(60);
                    Year2 = year + "/" + (mount + 2) + "/" + day;
                }
                else if (Hanis.SelectedIndex == 2)
                {
                    PayaneCharge.SelectedDate = PersianDate.Today.AddDays(90);
                    Year2 = year + "/" + (mount + 3) + "/" + day;
                }
                else if (Hanis.SelectedIndex == 3)
                {
                    PayaneCharge.SelectedDate = PersianDate.Today.AddDays(120);

                    Year2 = year + "/" + (mount + 4) + "/" + day;
                }
                else if (Hanis.SelectedIndex == 4)
                {
                    Year2 = year + "/" + (mount + 6) + "/" + day;
                    PayaneCharge.SelectedDate = PersianDate.Today.AddDays(180);
                }
                else if (Hanis.SelectedIndex == 5)
                {
                    Year2 = (year + 1) + "/" + mount + "/" + day;
                    PayaneCharge.SelectedDate = PersianDate.Today.AddDays(360);
                }



                SHA256CryptoServiceProvider Sha2 = new SHA256CryptoServiceProvider();


                byte[] B1;
                byte[] B2;
                B1 = UTF8Encoding.UTF8.GetBytes(UserPassword.Text);
                B2 = Sha2.ComputeHash(B1);
                string UserPasswordHashed = BitConverter.ToString(B2);

                VW_Users U = new VW_Users();
                byte     estakhr, bime, khososi, barnameqazaiy;
                if (EstakhrCheakBox.IsChecked == true)
                {
                    estakhr = 1;
                }
                else
                {
                    estakhr = 0;
                }

                if (BimeCheakBox.IsChecked == true)
                {
                    bime = 1;
                }
                else
                {
                    bime = 0;
                }

                if (KhososiCheakBox.IsChecked == true)
                {
                    khososi = 1;
                }
                else
                {
                    khososi = 0;
                }
                if (BarnameQazaiCheakBox.IsChecked == true)
                {
                    barnameqazaiy = 1;
                }
                else
                {
                    barnameqazaiy = 0;
                }

                if (NoeVarzesh.SelectedIndex == 0)
                {
                    U.UserKarKard = 1;
                }
                else
                {
                    U.UserKarKard = 2;
                }
                if (UserTamrin.SelectedIndex == 0)
                {
                    U.UserTamrin = 1;
                }
                else
                {
                    U.UserKarKard = 2;
                }
                if (rdb_man.IsChecked == true)
                {
                    U.UserGender = 1;
                }
                else
                {
                    U.UserGender = 2;
                }
                if (ImageName != "")
                {
                    FileStream fs         = new FileStream(ImageName, FileMode.Open, FileAccess.Read);
                    byte[]     imgByteArr = new byte[fs.Length];
                    fs.Read(imgByteArr, 0, Convert.ToInt32(fs.Length));
                    fs.Close();
                    database.Sp_gym(Username.Text.Trim(), UserFamily.Text.Trim(), UserTel.Text.Trim(), UserUsername.Text.Trim(),
                                    UserPasswordHashed.ToString(), Convert.ToByte(UserAge.Text.Trim()), 1, U.UserGender, UserCode.Text.Trim(), UserLocation.Text.Trim(), UserHomePhone.Text.Trim(),
                                    UserDoreSine.Text.Trim(), UserBazu.Text.Trim(), UserKamar.Text.Trim(), UserGhad.Text.Trim(), UserVazn.Text.Trim(), U.UserTamrin, U.UserKarKard, U.UserShahrie, String.Format("{0:yyyy/MM/dd}", Convert.ToDateTime(Year2)),
                                    " ", UserCodePost.Text.Trim(), /*cAccCreditDate.Text.ToString()*/ null, UserCharge.Text.Trim(), Convert.ToDecimal(UserCharge.Text.Trim()), 1, Komod.Text, imgByteArr, Convert.ToBoolean(estakhr), Convert.ToBoolean(bime), Convert.ToBoolean(khososi), Convert.ToBoolean(barnameqazaiy));



                    database.SaveChanges();
                    SucFul ER = new SucFul();
                    ER.Show();
                    ER.Suclbl.Content = "کاربر جدید ثبت شد";
                }

                else
                {
                    database.Sp_gym(Username.Text.Trim(), UserFamily.Text.Trim(), UserTel.Text.Trim(), UserUsername.Text.Trim(),
                                    UserPasswordHashed.ToString(), Convert.ToByte(UserAge.Text.Trim()), 1, U.UserGender, UserCode.Text.Trim(), UserLocation.Text.Trim(), UserHomePhone.Text.Trim(),
                                    UserDoreSine.Text.Trim(), UserBazu.Text.Trim(), UserKamar.Text.Trim(), UserGhad.Text.Trim(), UserVazn.Text.Trim(), U.UserTamrin, U.UserKarKard, U.UserShahrie, String.Format("{0:yyyy/MM/dd}", Convert.ToDateTime(Year2)),
                                    " ", UserCodePost.Text.Trim(), /*cAccCreditDate.Text.ToString()*/ null, UserCharge.Text.Trim(), Convert.ToDecimal(UserCharge.Text.Trim()), 1, Komod.Text.Trim(), null, Convert.ToBoolean(estakhr), Convert.ToBoolean(bime), Convert.ToBoolean(khososi), Convert.ToBoolean(barnameqazaiy));
                    database.SaveChanges();

                    SucFul ER = new SucFul();
                    ER.Show();
                    ER.Suclbl.Content = "کاربر جدید ثبت شد";
                }



                Members Us  = new Members();
                Submit  Sub = new Submit();


                LinkBedehi l = new LinkBedehi();


                SqlConnection con1 = new SqlConnection(PublicVar.ConnectionString);
                con1.Open();
                SqlCommand FactorCode       = new SqlCommand("select MAX(UserID) FROM Users", con1);
                object     FactorCodeObj    = FactorCode.ExecuteScalar();
                string     FactorCodeString = Convert.ToString(FactorCodeObj);

                Us.MemberFactorCode = Convert.ToInt64(UserFactor.Text.Trim());
                Us.MemberFindID     = Convert.ToInt32(FactorCodeString);
                Us.MemberStartDate  = PublicVar.TodayTime;
                Us.MemberLastCharge = String.Format("{0:yyyy/MM/dd}", Convert.ToDateTime(Year2));



                int timeInFactor = DateTimeHidden.SelectedDate.Month;
                int payanTime    = PayaneCharge.SelectedDate.Month;
                Us.MemberMounth   = Convert.ToByte(timeInFactor);
                Us.MemberMountTwo = Convert.ToByte(payanTime);



                Us.MemberCharge   = Convert.ToDecimal(UserCharge.Text.Trim());
                Us.UserBedehiRial = 0;
                Us.BedehKariDesc  = "ثبت نام";
                // Us.MemberService = Convert.ToByte(bedehs);



                database.Members.Add(Us);



                UsersTimeOut T = new UsersTimeOut();

                T.UserFindID  = Convert.ToInt32(FactorCodeString);
                T.UserEndDate = String.Format("{0:yyyy/MM/dd}", Convert.ToDateTime(Year2));

                database.UsersTimeOut.Add(T);
                database.SaveChanges();
            }


            catch (Exception ex)
            {
                ErrorPage ER = new ErrorPage();
                ER.Show();
                ER.Error_Lable.Content = ex.ToString();
            }
            finally
            {
                this.Close();
                ShowUserInfo(searchstate);
            }
        }