Esempio n. 1
0
        private void tbBarcode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string code = tbBarcode.Text;

                this.Details    = DBLayer.Clients.GetDetails(code);
                this.WithoutKey = false;

                ArrayList al = DBLayer.Clients.GetOnlineList();

                for (int i = 0; i < al.Count; i++)
                {
                    string codeOnline = ((DBLayer.Clients.Clients_WideDetails)al[i]).Barcode;

                    //MessageBox.Show(codeOnline);

                    if (tbBarcode.Text == codeOnline)
                    {
                        //MessageBox.Show("Yes");
                        this.ForExit = true;
                        break;
                    }
                }

                SimulateSelectClient();
            }
        }
Esempio n. 2
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (cbWithout.Checked)
            {
                int[] i;
                int   SelRow = -1;
                i      = advBandedGridView1.GetSelectedRows();
                SelRow = i[0];

                int ind = 0;

                try
                {
                    ind = Convert.ToInt32(advBandedGridView1.GetRowCellValue(SelRow, "Id"));
                }
                catch (Exception err)
                {
                    MessageBox.Show(this, err.Message, Lib.StringConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                this.WithoutKey = true;
                this.Details    = DBLayer.Clients.GetDetails(ind);

                //MessageBox.Show(this.Details.FIO);

                SimulateSelectClient();
            }
            else
            {
                string code = Lib.ServiceFunctions.ScanPrefix() + tbBarcode.Text;

                try
                {
                    this.Details    = DBLayer.Clients.GetDetails(code);
                    this.WithoutKey = false;

                    ArrayList al = DBLayer.Clients.GetOnlineList();

                    for (int i = 0; i < al.Count; i++)
                    {
                        string codeOnline = ((DBLayer.Clients.Clients_WideDetails)al[i]).Barcode;

                        //MessageBox.Show(codeOnline);

                        if (Lib.ServiceFunctions.ScanPrefix() + tbBarcode.Text == codeOnline)
                        {
                            //MessageBox.Show("Yes");
                            this.ForExit = true;
                            break;
                        }
                    }

                    SimulateSelectClient();
                }
                catch (Exception err)
                {
                    MessageBox.Show("На данную карту не заведен клиент!" + err.Message, Lib.StringConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 3
0
        private void LoadData()
        {
            ArrayList al = DBLayer.Clients.GetBirthDates(this.Month);

            DataTable dt = new DataTable();

            dt.Columns.Add("FIO");
            dt.Columns.Add("Phone");
            dt.Columns.Add("Birthdate", typeof(DateTime));

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

                DataRow dr = dt.Rows.Add();

                dr["FIO"]       = det.FIO;
                dr["Birthdate"] = det.BirthDate;
                dr["Phone"]     = det.Phone;
            }

            grSales.DataSource = dt;
            advBandedGridView1.BestFitColumns();

            slblCount.Text = al.Count.ToString();
        }
Esempio n. 4
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (cbWithout.Checked)
            {
                int[] i;
                int   SelRow = -1;
                i      = advBandedGridView1.GetSelectedRows();
                SelRow = i[0];

                int ind = 0;

                try
                {
                    ind = Convert.ToInt32(advBandedGridView1.GetRowCellValue(SelRow, "Id"));
                }
                catch (Exception err)
                {
                    MessageBox.Show(this, err.Message, Lib.StringConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                this.WithoutKey = true;
                this.Details    = DBLayer.Clients.GetDetails(ind);

                LoadClient();
            }
            else
            {
                string code = Lib.ServiceFunctions.ScanPrefix() + tbBarcode.Text;

                this.Details = DBLayer.Clients.GetDetails(code);

                LoadClient();
            }
        }
        public FrmEditClientAbonement(DBLayer.Clients.Details det)
        {
            InitializeComponent();

            this.Details = det;

            LoadCoaches(1);
        }
Esempio n. 6
0
        public static int Insert(DBLayer.Clients.Details det)
        {
            string sql = "INSERT INTO Clients (DocumentId, TypeId, SourceId, FIO, Barcode, RegisterDate, BirthDate, DocumentNumber, Phone, Sex) ";

            sql += " VALUES (" + det.DocumentId.ToString() + ", " + det.TypeId.ToString() + ", " + det.SourceId.ToString() + ", '" + det.FIO + "', '" + det.Barcode + "', '" + det.RegisterDate.ToString("yyyyMMdd") + "', '" + det.BirthDate.ToString("yyyyMMdd") + "', '" + det.DocumentNumber + "', '" + det.Phone + "', " + det.Sex.ToString() + ")";

            ZFort.DB.Execute.ExecuteString_void(sql);

            sql = "SELECT Max([Id]) AS MaxId FROM Clients";

            return((int)ZFort.DB.Execute.ExecuteString_Scalar(sql));
        }
Esempio n. 7
0
        public CtrlVisit(int id)
        {
            InitializeComponent();

            tbBarcode.Focus();

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

            tbBarcode.Text = this.Details.Barcode;

            btnView.Enabled      = false;
            gridControl1.Enabled = false;
            tbFIO.Enabled        = false;
            cbLeave.Enabled      = false;
        }
Esempio n. 8
0
        public CtrlBoxType(DBLayer.Clients.Details det)
        {
            InitializeComponent();

            int id = det.Sex;

            DBLayer.Abonements.Details aDet = DBLayer.Abonements.GetClientLast(det.Id);

            lblAbonement.Text = aDet.Name;
            lblFIO.Text       = det.FIO;


            DBLayer.ClientsAbonements.Details caDet = DBLayer.ClientsAbonements.GetDetails(det.Id, aDet.Id);

            if (caDet.CoachId != 0)
            {
                lblCoach.Text = DBLayer.Coaches.GetDetails(caDet.CoachId).Name;
            }

            lblTime.Text     = caDet.Time;
            lblWeekdays.Text = caDet.Weekdays;

            try
            {
                lblFinishDate.Text = DBLayer.ClientsAbonements.GetFinishDate(det.Id, aDet.Id).ToString("dd-MMM-yyyy");
            }
            catch
            {
            }

            int doubleBox = DBLayer.Boxes.GetList(1, id);

            int singleBox = DBLayer.Boxes.GetList(2, id);

            if (id == 0)
            {
                int val = 0;

                val = singleBox;

                singleBox = doubleBox;
                doubleBox = val;
            }

            lblSingle.Text = (singleBox - DBLayer.Boxes.GetReserved(1, id).Count).ToString();

            lblDouble.Text = (doubleBox - DBLayer.Boxes.GetReserved(2, id).Count).ToString();
        }
Esempio n. 9
0
        public FrmViewClient(DBLayer.Clients.Details det)
        {
            InitializeComponent();

            byte[] result = DBLayer.Clients.DownloadPhoto(det.Id);
            try
            {
                MemoryStream ms = new MemoryStream(result, 0, result.Length);
                Image        im = Image.FromStream(ms);
                pbPhoto.Image = im;
            }
            catch (Exception ee)
            {
                pbPhoto.Image = null;
            }

            lblFIO.Text       = det.FIO;
            lblBirthDate.Text = det.BirthDate.ToString("dd-MMM-yyyy");
        }
        public static void Delete(int id)
        {
            string user = ((DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User")).FIO;

            DBLayer.ClientsAbonements.Details det = DBLayer.ClientsAbonements.GetDetails(id);

            DBLayer.Clients.Details cDet = DBLayer.Clients.GetDetails(det.ClientId);

            DBLayer.Abonements.Details aDet = DBLayer.Abonements.GetDetails(det.AbonementId);

            DBLayer.DeletingLog.DeletingLog_Details dlDet = new DeletingLog.DeletingLog_Details();

            dlDet.Date = DateTime.Now;
            dlDet.Name = aDet.Name + "/" + cDet.FIO + "(" + aDet.Cost.ToString() + ")";
            dlDet.Type = 0;
            dlDet.User = user;

            DBLayer.DeletingLog.Insert(dlDet);

            ZFort.DB.Execute.ExecuteString_void("DELETE FROM ClientsAbonements WHERE [Id] = " + id.ToString());
        }
Esempio n. 11
0
        public FrmEditClient(int id)
        {
            InitializeComponent();

            //btnOk.Enabled = false;

            this.Id = id;

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

            tbFIO.Text          = this.Details.FIO;
            tbCode.Text         = this.Details.Barcode;
            tbRegisterDate.Text = this.Details.RegisterDate.ToString("dd-MMM-yyyy");

            tbDay.Text            = this.Details.BirthDate.Date.Day.ToString();
            cbMonth.SelectedIndex = this.Details.BirthDate.Date.Month - 1;
            tbYear.Text           = this.Details.BirthDate.Date.Year.ToString();
            tbDocumentNumber.Text = this.Details.DocumentNumber;
            tbPhone.Text          = this.Details.Phone;

            LoadGroups(this.Details.TypeId);
            LoadSources(this.Details.SourceId);
            LoadDocument(this.Details.DocumentId);

            byte[] result = DBLayer.Clients.DownloadPhoto(Id);
            try
            {
                MemoryStream ms = new MemoryStream(result, 0, result.Length);
                Image        im = Image.FromStream(ms);
                pbPhoto.Image = im;
            }
            catch (Exception ee)
            {
                pbPhoto.Image = null;
            }

            LoadData();

            cbSex.SelectedIndex = Details.Sex;
        }
Esempio n. 12
0
        public static void Update(DBLayer.Clients.Details det)
        {
            ZFort.DB.Execute.ExecuteString_void("UPDATE Clients SET [DocumentId] = " + det.DocumentId.ToString() + " WHERE [Id] = " + det.Id.ToString());

            ZFort.DB.Execute.ExecuteString_void("UPDATE Clients SET [SourceId] = " + det.SourceId.ToString() + " WHERE [Id] = " + det.Id.ToString());

            ZFort.DB.Execute.ExecuteString_void("UPDATE Clients SET [TypeId] = " + det.TypeId.ToString() + " WHERE [Id] = " + det.Id.ToString());

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

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

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

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

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

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

            ZFort.DB.Execute.ExecuteString_void("UPDATE Clients SET [Sex] = " + det.Sex.ToString() + " WHERE [Id] = " + det.Id.ToString());
        }
Esempio n. 13
0
        public CtrlExitInfo(DBLayer.Clients.Details det)
        {
            InitializeComponent();

            this.Details = det;

            lblClient.Text = det.FIO;

            int id = DBLayer.Visits.GetLastVisit(det.Id);

            DBLayer.Visits.Visits_Details vDet = DBLayer.Visits.GetDetails(id);

            lblBox.Text = DBLayer.Boxes.GetNumber(vDet.BoxId).ToString();

            this.VisitId = id;

            if (id != 0)
            {
                DBLayer.Visits.Visits_Details detV = DBLayer.Visits.GetDetails(id);

                lblDate.Text = detV.Time;
            }
        }
Esempio n. 14
0
        private void btnView_Click(object sender, EventArgs e)
        {
            int[] i;
            int   SelRow = -1;

            i      = advBandedGridView1.GetSelectedRows();
            SelRow = i[0];

            int ind = 0;

            try
            {
                ind = Convert.ToInt32(advBandedGridView1.GetRowCellValue(SelRow, "Id"));
            }
            catch (Exception err)
            {
                MessageBox.Show(this, err.Message, Lib.StringConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.Details = DBLayer.Clients.GetDetails(ind);

            ServiceForms.FrmViewClient frm = new FitnessProject.ServiceForms.FrmViewClient(DBLayer.Clients.GetDetails(ind));
            frm.ShowDialog();
        }
Esempio n. 15
0
        public CtrlInfo(DBLayer.Clients.Details det, DateTime date, int number, int type, bool key, int coachId)
        {
            InitializeComponent();

            this.Details    = det;
            this.Date       = date;
            this.Type       = type;
            this.Number     = number;
            this.WithoutKey = key;
            this.CoachId    = coachId;


            LoadCoaches();

            string text = "";

            switch (type)
            {
            case 1:
                text = "Женский";
                break;

            case 2:
                text = "Мужской";
                break;

            case 3:
                text = "Женский";
                break;

            case 4:
                text = "Мужской";
                break;
            }

            lblClient.Text = det.FIO;

            byte[] result = DBLayer.Clients.DownloadPhoto(det.Id);
            try
            {
                MemoryStream ms = new MemoryStream(result, 0, result.Length);
                Image        im = Image.FromStream(ms);
                pbPhoto.Image = im;
            }
            catch (Exception ee)
            {
                pbPhoto.Image = null;
            }

            DBLayer.Abonements.Details aDet = DBLayer.Abonements.GetClientLast(det.Id);

            lblAbonement.Text = aDet.Name;
            lblTime.Text      = aDet.Time;
            lblWeekdays.Text  = aDet.Weekdays;
            try
            {
                lblCoach.Text = DBLayer.Coaches.GetDetails(aDet.CoachId).Name;
            }
            catch
            {
                lblCoach.Text = "Не указан";
            }

            DBLayer.ClientsAbonements.Details caDet = DBLayer.ClientsAbonements.GetDetails(det.Id, aDet.Id);

            CADetails = caDet;

            if (caDet.VisitsCount > 0)
            {
                lblVisitCount.Text = caDet.VisitsCount.ToString();
            }

            lblDate.Text   = date.ToString("dd-MMM-yyyy hh mm");
            lblNumber.Text = number.ToString() + " " + text;
        }