コード例 #1
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            if (surnameTxt.Text == "")
            {
                errorList.Add("Missing surname");
                surnameTxt.BackColor = Color.Red;
                UpdateErrors();
                return;
            }
            if (lastnameTxt.Text == "")
            {
                errorList.Add("Missing last name");
                lastnameTxt.BackColor = Color.Red;
                UpdateErrors();
                return;
            }
            if (pass2Txt.Text != passTxt.Text)
            {
                errorList.Add("passwords do not match");
                passTxt.BackColor = Color.Red;
                UpdateErrors();
                return;
            }
            if (String.IsNullOrEmpty(passTxt.Text))
            {
                errorList.Add("please insert password !");
                passTxt.BackColor = Color.Red;
                UpdateErrors();
                return;
            }
            string role = "";

            if (mainRadioBtn.Checked)
            {
                role = "Main";
            }
            else if (subRadioBtn.Checked)
            {
                role = "Sub";
            }
            else
            {
                role = "Other";
            }


            string       id        = Guid.NewGuid().ToString();
            MemoryStream stream    = ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg);
            string       fullimage = ImageToBase64(stream);

            _user = new Users(id, patientNoTxt.Text, contactTxt.Text, contact2Txt.Text, surnameTxt.Text, lastnameTxt.Text, emailTxt.Text, nationalityTxt.Text, addressTxt.Text, kinTxt.Text, kincontactTxt.Text, Helper.MD5Hash(pass2Txt.Text), designationCbx.Text, rolesCbx.Text, genderCbx.Text, fullimage, clinicnameTxt.Text, role, Helper.MD5Hash(passTxt.Text), accountTxt.Text, statusCbx.Text, practiceTxt.Text, specialisationTxt.Text, subTxt.Text, DateTime.Now.ToString("dd-MM-yyyy H:m:s"), departmentCbx.Text, Helper.orgID);

            if (DBConnect.Insert(_user) != "")
            {
                Global._users.Add(_user);
                //DBConnect.saveImage("users", fullimage, id);
                MessageBox.Show("Information Saved");



                this.DialogResult = DialogResult.OK;
                this.Dispose();
            }
            else
            {
            }
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (Users.ListUsers().Count() < 1)
                {
                    MessageBox.Show("Please add atleast a single user");
                    return;
                }
            }
            catch
            {
                return;
            }
            if (Branch.ListBranch().Count() < 1)
            {
                MessageBox.Show("Please add a branch");
                return;
            }
            if (String.IsNullOrEmpty(Helper.BranchID))
            {
                MessageBox.Show("Please select a store/Shop");
                storeCbx.BackColor = Color.Red;
                return;
            }
            string password = "";

            if (nameTxt.Text == "")
            {
                nameTxt.BackColor = Color.Red;
                return;
            }
            if (codeTxt.Text == "")
            {
                codeTxt.BackColor = Color.Red;
                return;
            }
            if (initialTxt.Text != "")
            {
                password = Helper.MD5Hash(initialTxt.Text);
            }
            else
            {
                password = originalPassword;
            }
            string id = Guid.NewGuid().ToString();

            MemoryStream stream    = ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg);
            string       fullimage = ImageToBase64(stream);

            _org = new Organisation(id, nameTxt.Text, codeTxt.Text, registrationTxt.Text, contactTxt.Text, addressTxt.Text, tinTxt.Text, vatTxt.Text, emailTxt.Text, nationalityTxt.Text, password, accountTxt.Text, statusCbx.Text, Convert.ToDateTime(expireDate.Text).ToString("dd-MM-yyyy"), fullimage, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), countsTxt.Text, companyCode.Text, Helper.BranchID);
            DBConnect.Update(_org, OrgID);
            Helper.orgID = OrgID;
            DBConnect.Update(_org, OrgID);
            MessageBox.Show("Information Updated ");
            Close();

            string SQL = "UPDATE organisation SET counts = '" + DateTime.Now.ToString("dd-MM-yyyy H:mm:ss") + "' WHERE id= '" + id + "'";

            DBConnect.Execute(SQL);
            MessageBox.Show("Information Saved");
            Close();
            if (Global._users.Count() < 1)
            {
                Helper.orgID = id;
                string ids = Guid.NewGuid().ToString();
                _role = new Roles(ids, "Administrator", "All item pos daily purchases merchandise inventory expenses cash flow suppliers users suppliers catgories transactions ledgers logs profile ", "create update delete log ", DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);

                DBConnect.Insert(_role);
                Global._roles.Add(_role);
            }
            this.DialogResult = DialogResult.OK;
            this.Dispose();
            nameTxt.Text = "";
            codeTxt.Text = "";
        }
コード例 #3
0
        private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            updateID = dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString();


            if (e.ColumnIndex == 11)
            {
                if (dtGrid.Rows[e.RowIndex].Cells["Paid for consulation"].Value.ToString() != "Yes")
                {
                    if (MessageBox.Show("YES or No?", "Payments not yet made would you like to continue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                    }
                    else
                    {
                        return;
                    }
                }
                if (MessageBox.Show("YES or No?", "Is visit complete? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    //Global._queues.RemoveAll(x => x.Id == updateID);
                    //DBConnect.Delete("queue", dtGrid.Rows[e.RowIndex].Cells[3].Value.ToString());
                    _queue = new Queue(updateID, _queues.First(x => x.Id.Contains(updateID)).Follow, _queues.First(x => x.Id.Contains(updateID)).PatientID, _queues.First(x => x.Id.Contains(updateID)).UserID, _queues.First(x => x.Id.Contains(updateID)).RoomID, _queues.First(x => x.Id.Contains(updateID)).ClinicID, "Complete", _queues.First(x => x.Id.Contains(updateID)).Dated, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), _queues.First(x => x.Id.Contains(updateID)).Department, "", "", "", "", "", "", "", "", "", Helper.orgID, dtGrid.Rows[e.RowIndex].Cells["type"].Value.ToString());

                    DBConnect.Update(_queue, updateID);
                    Global._queues.RemoveAll(x => x.Id == updateID);
                    Global._queues.Add(_queue);
                    MessageBox.Show("Information updated");
                    LoadData();
                }
            }

            if (e.ColumnIndex == 10)
            {
                if (dtGrid.Rows[e.RowIndex].Cells["Paid for consulation"].Value.ToString() != "Yes")
                {
                    if (MessageBox.Show("YES or No?", "Payments not yet made would you like to continue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                    }
                    else
                    {
                        return;
                    }
                }

                string visitID        = dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString();
                string patientID      = dtGrid.Rows[e.RowIndex].Cells["patientID"].Value.ToString();
                string practitionerID = dtGrid.Rows[e.RowIndex].Cells["practitionerID"].Value.ToString();
                string department     = dtGrid.Rows[e.RowIndex].Cells["Department"].Value.ToString();
                if (department.Contains("ent"))
                {
                    DentalForm frm = new DentalForm(visitID, patientID, practitionerID);
                    frm.MdiParent = MainForm.ActiveForm;
                    frm.Dock      = DockStyle.Fill;
                    frm.Show();
                }
                else
                {
                    PatientVisit frm = new PatientVisit(visitID, patientID, practitionerID);
                    frm.MdiParent = MainForm.ActiveForm;
                    frm.Dock      = DockStyle.Fill;
                    frm.Show();
                }
            }
            if (e.ColumnIndex == 16)
            {
                if (dtGrid.Rows[e.RowIndex].Cells["Paid for consulation"].Value.ToString() != "Yes")
                {
                    if (MessageBox.Show("YES or No?", "Payments not yet made would you like to continue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                    }
                    else
                    {
                        return;
                    }
                }
                string visitID        = dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString();
                string patientID      = dtGrid.Rows[e.RowIndex].Cells["patientID"].Value.ToString();
                string practitionerID = dtGrid.Rows[e.RowIndex].Cells["practitionerID"].Value.ToString();


                OutPatient frm = new OutPatient(visitID, patientID, practitionerID);
                frm.MdiParent = MainForm.ActiveForm;
                frm.Dock      = DockStyle.Fill;
                frm.Show();
            }
            if (e.ColumnIndex == dtGrid.Columns["Remove"].Index && e.RowIndex >= 0)
            {
                if (MessageBox.Show("YES or No?", "Remove Patient from Queue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    DBConnect.Delete("queue", dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString());
                    Global._queues.RemoveAll(w => w.Id.Contains(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()));
                    MessageBox.Show("Information deleted");
                    LoadData();
                    LoadItem();
                }
            }
        }