Beispiel #1
0
        private void tbtnSale_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < advBandedGridView1.RowCount; i++)
            {
                double total = Convert.ToDouble(advBandedGridView1.GetRowCellValue(i, "Total"));

                if (total > 0)
                {
                    int quantity = Convert.ToInt32(advBandedGridView1.GetRowCellValue(i, "Quantity"));


                    int id = Convert.ToInt32(advBandedGridView1.GetRowCellValue(i, "Id"));

                    DBLayer.Users.Details det = ((DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User"));

                    DBLayer.Sales.Details sDet = new FitnessProject.DBLayer.Sales.Details();

                    sDet.Date      = this.Date1;
                    sDet.ProductId = id;
                    sDet.UserId    = det.Id;
                    sDet.Quantity  = quantity;

                    DBLayer.Sales.Insert(sDet);
                }
            }

            MessageBox.Show("Изменения сохранены");
        }
Beispiel #2
0
        public void Authorize()
        {
            //Database.Service1 serv = new FitnessProject.Database.Service1();

            //serv.Initialize();

            DBLayer.Users.Details det = DBLayer.Users.Authorize(tbLogin.Text, tbPassword.Text);

            if (det.Id != 0)
            {
                AppDomain.CurrentDomain.SetData("User", det);

                DBLayer.UserVisits.UserVisits_Details detV = new FitnessProject.DBLayer.UserVisits.UserVisits_Details();

                detV.Date   = DateTime.Now.Date;
                detV.TimeOn = DateTime.Now.ToString("hh:mm");
                detV.UserId = det.Id;

                DBLayer.UserVisits.Insert(detV);

                this.Close();
            }
            else
            {
                MessageBox.Show(this, "Неправильный логин или пароль!", Lib.StringConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        public FrmEditUser(int id)
        {
            InitializeComponent();

            this.Id = id;

            this.Details = DBLayer.Users.GetDetails(id);

            tbCode.Text     = this.Details.Barcode;
            tbFIO.Text      = this.Details.FIO;
            tbJobTitle.Text = this.Details.JobTitle;

            cbIsAdmin.Checked = this.Details.IsAdmin;

            tbLogin.Text    = this.Details.Login;
            tbPassword.Text = this.Details.Password;

            try
            {
                urDet = DBLayer.UserRate.GetDetails(this.Id);
            }
            catch { }

            tbBar.Text        = urDet.PercentForSales.ToString();
            tbServices.Text   = urDet.PercentForService.ToString();
            tbAbonements.Text = urDet.PercentForClients.ToString();
            tbConstant.Text   = urDet.Constant.ToString();
            tbFitness.Text    = urDet.PercentForFitness.ToString();
            tbMassage.Text    = urDet.PercentForMassage.ToString();

            LoadData();
            LoadAdminsData();
        }
Beispiel #4
0
        /*#region Check
         *
         * public static bool Check(string name, int id)
         * {
         *
         *  Database.Service serv = new Management.Database.Service();
         *
         *  return serv.AdvertisingSource_Check(name, id);
         * }
         *
         #endregion*/

        #region Insert

        public static void Insert(DBLayer.Users.Details det)
        {
            string sql = "INSERT INTO Users (FIO, JobTitle, Login, Password, Barcode, IsAdmin) ";

            sql += " VALUES ('" + det.FIO + "', '" + det.JobTitle + "', '" + det.Login + "', '" + det.Password + "', '" + det.Barcode + "', " + Convert.ToInt32(det.IsAdmin).ToString() + ")";

            ZFort.DB.Execute.ExecuteString_void(sql);
        }
Beispiel #5
0
        public static void Update(DBLayer.Users.Details det)
        {
            ZFort.DB.Execute.ExecuteString_void("UPDATE Users SET [FIO] = '" + det.FIO + "' WHERE [Id] = " + det.Id.ToString());

            ZFort.DB.Execute.ExecuteString_void("UPDATE Users SET [JobTitle] = '" + det.JobTitle + "' WHERE [Id] = " + det.Id.ToString());

            ZFort.DB.Execute.ExecuteString_void("UPDATE Users SET [Login] = '" + det.Login + "' WHERE [Id] = " + det.Id.ToString());

            ZFort.DB.Execute.ExecuteString_void("UPDATE Users SET [IsAdmin] = " + Convert.ToInt32(det.IsAdmin).ToString() + " WHERE [Id] = " + det.Id.ToString());

            ZFort.DB.Execute.ExecuteString_void("UPDATE Users SET [Password] = '" + det.Password + "' WHERE [Id] = " + det.Id.ToString());

            ZFort.DB.Execute.ExecuteString_void("UPDATE Users SET [Barcode] = '" + det.Barcode + "' WHERE [Id] = " + det.Id.ToString());
        }
        public CtrlClientType()
        {
            InitializeComponent();

            LoadData();

            DBLayer.Users.Details det = (DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User");

            if (det.IsAdmin)
            {
                tbtnRemove.Visible = true;
            }
            else
            {
                tbtnRemove.Visible = false;
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            DBLayer.ServiceSales.Details det = new FitnessProject.DBLayer.ServiceSales.Details();

            det.Date      = DateTime.Now.Date;
            det.ServiceId = this.Product.Id;
            det.Quantity  = Convert.ToInt32(tbQuantity.Text);
            det.Time      = DateTime.Now.ToShortTimeString();

            DBLayer.Users.Details detU = (DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User");

            det.UserId = detU.Id;

            DBLayer.ServiceSales.Insert(det);

            this.Close();
        }
Beispiel #8
0
        private void LoadList()
        {
            DBLayer.Users.Details detU = (DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User");

            ArrayList al = DBLayer.Administrators.GetList();

            for (int i = 0; i < al.Count; i++)
            {
                DBLayer.Administrators.Details det = (DBLayer.Administrators.Details)al[i];

                Lib.ServiceFunctions.ListItem li = new FitnessProject.Lib.ServiceFunctions.ListItem();

                li.ID   = det.Id;
                li.Name = det.FIO;

                ddlAdministrators.Items.Add(li);
            }
        }
Beispiel #9
0
        public CtrlClient()
        {
            InitializeComponent();

            LoadData();

            DBLayer.Users.Details det = (DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User");

            if (det.IsAdmin)
            {
                tbtnRemove.Visible = true;
            }
            else
            {
                tbtnRemove.Visible = false;
            }

            advBandedGridView1.ColumnFilterChanged += new EventHandler(advBandedGridView1_ColumnFilterChanged);
        }
Beispiel #10
0
        public CtrlCharges()
        {
            InitializeComponent();

            SetData(DateTime.Now.Month, DateTime.Now.Year);

            LoadData();

            DBLayer.Users.Details det = (DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User");

            if (det.IsAdmin)
            {
                tbtnRemove.Visible = true;
            }
            else
            {
                tbtnRemove.Visible = false;
            }
        }
Beispiel #11
0
        private void LoadData()
        {
            ArrayList al = DBLayer.Users.GetList();

            DataTable dt = new DataTable();

            dt.Columns.Add("Id", typeof(int));
            dt.Columns.Add("Code");
            dt.Columns.Add("JobTitle");
            dt.Columns.Add("FIO");
            dt.Columns.Add("Login");
            dt.Columns.Add("Administrator");

            for (int i = 0; i < al.Count; i++)
            {
                DBLayer.Users.Details det = (DBLayer.Users.Details)al[i];

                DataRow dr = dt.Rows.Add();

                dr["Id"]   = det.Id;
                dr["Code"] = det.Barcode;

                dr["JobTitle"] = det.JobTitle;
                dr["FIO"]      = det.FIO;

                dr["Login"] = det.Login;

                if (det.IsAdmin)
                {
                    dr["Administrator"] = "Администратор";
                }
                else
                {
                    dr["Administrator"] = "Пользователь";
                }
            }

            grGoods.DataSource = dt;
        }
Beispiel #12
0
        public static ArrayList GetList()
        {
            DataTable dt = ZFort.DB.Execute.ExecuteString_DataTable("SELECT * FROM Users");

            ArrayList al = new ArrayList();

            foreach (DataRow dr in dt.Rows)
            {
                DBLayer.Users.Details det = new DBLayer.Users.Details();

                if (!dr.IsNull("Id"))
                {
                    det.Id = Convert.ToInt32(dr["Id"]);
                }

                det.FIO = dr["FIO"].ToString();

                det.Barcode = dr["Barcode"].ToString();

                det.JobTitle = dr["JobTitle"].ToString();

                det.Login = dr["Login"].ToString();

                det.Password = dr["Password"].ToString();

                if (!dr.IsNull("IsAdmin"))
                {
                    det.IsAdmin = Convert.ToBoolean(dr["IsAdmin"]);
                }


                al.Add(det);
            }

            return(al);
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.AbonementId == 0)
            {
                MessageBox.Show(this, "Не указан абонемент!", Lib.StringConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int a = 0;

            if (this.Id == 0)
            {
                if (this.Details.Id == 0)
                {
                    SimulateSelectAbonement();
                }
                else
                {
                    this.CADetails.AbonementId = this.AbonementId;

                    DBLayer.Abonements.Details aDet = DBLayer.Abonements.GetDetails(this.CADetails.AbonementId);

                    this.CADetails.DateStart  = Convert.ToDateTime(tbStartDate.Text);
                    this.CADetails.DateFinish = Convert.ToDateTime(tbFinishDate.Text);
                    this.CADetails.ClientId   = this.Details.Id;

                    if (cbCoach.SelectedItem != null)
                    {
                        this.CADetails.CoachId = ((Lib.ServiceFunctions.ListItem)cbCoach.SelectedItem).ID;
                    }

                    this.CADetails.Time     = tbTime.Text;
                    this.CADetails.Weekdays = tbWeekdays.Text;

                    if (aDet.LessonsCount != 0)
                    {
                        this.CADetails.VisitsCount = aDet.LessonsCount;
                    }

                    if (aDet.AdditionalVisits != 0)
                    {
                        this.CADetails.AdditionalCount = aDet.AdditionalVisits;
                    }

                    if (aDet.LessonsCount != 0)
                    {
                        this.CADetails.VisitsCount = aDet.LessonsCount;
                    }

                    if (aDet.AdditionalVisits != 0)
                    {
                        this.CADetails.AdditionalCount = aDet.AdditionalVisits;
                    }

                    if (MessageBox.Show(this, "Провести платеж - " + aDet.Cost.ToString() + "?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int caId = DBLayer.ClientsAbonements.Insert(this.CADetails);

                        DBLayer.AbonementIncome.Details det = new FitnessProject.DBLayer.AbonementIncome.Details();

                        DBLayer.Users.Details uDet = (DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User");

                        det.AbonementId       = this.CADetails.AbonementId;
                        det.ClientId          = this.CADetails.ClientId;
                        det.Date              = DateTime.Now.Date;
                        det.Summ              = aDet.Cost;
                        det.UserId            = uDet.Id;
                        det.ClientAbonementId = caId;

                        DBLayer.AbonementIncome.Insert(det);
                    }

                    this.Close();
                }
            }
            else
            {
                this.CADetails.AbonementId = this.AbonementId;
                this.CADetails.DateStart   = Convert.ToDateTime(tbStartDate.Text);
                this.CADetails.DateFinish  = Convert.ToDateTime(tbFinishDate.Text);

                if (cbCoach.SelectedItem != null)
                {
                    this.CADetails.CoachId = ((Lib.ServiceFunctions.ListItem)cbCoach.SelectedItem).ID;
                }

                this.CADetails.Time     = tbTime.Text;
                this.CADetails.Weekdays = tbWeekdays.Text;

                DBLayer.ClientsAbonements.Update(this.CADetails);

                this.Close();
            }
        }