Пример #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (startHrTxt.Text == "" || endHrTxt.Text == "")
            {
                MessageBox.Show("Please input the start time and end time for the meeting /schedule ");
                return;
            }
            string ID    = Guid.NewGuid().ToString();
            var    start = Convert.ToDateTime(this.openedDate.Text).ToString("yyyy-MM-dd") + "T" + this.startHrTxt.Text + ":" + startMinTxt.Text + ":00";
            var    end   = Convert.ToDateTime(this.openedDate.Text).ToString("yyyy-MM-dd") + "T" + this.endHrTxt.Text + ":" + endMinTxt.Text + ":00";

            notify = "false";

            if (notifyChk.Checked)
            {
                notify = "true";
            }
            Events _event = new Events(ID, Helper.CleanString(this.detailsTxt.Text), start, end, practitionerTxt.Text, patientTxt.Text, DateTime.Now.Date.ToString("yyyy-MM-dd"), patientID, "due", userID, Convert.ToDateTime(this.openedDate.Text).ToString("yyyy-MM-dd"), notify, priorityCbx.Text, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "f", contact, email, departmentCbx.Text, clinicCbx.Text, Helper.orgID);

            Global._events.Add(_event);

            string Query2 = "INSERT INTO events (id, details, starts, ends, users, patient, created, patientID, status, userID, dated,notif,priority, sync,cal,contact,email) VALUES ('" + ID + "','" + Helper.CleanString(this.detailsTxt.Text) + "','" + start + "','" + end + "','" + practitionerTxt.Text + "','" + patientTxt.Text + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "','" + patientID + "','due','" + userID + "','" + Convert.ToDateTime(this.openedDate.Text).ToString("yyyy-MM-dd") + "','" + notify + "','" + priorityCbx.Text + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','f','" + contact + "','" + email + "');";

            DBConnect.Execute(Query2);
        }
Пример #2
0
        private void calendar1_ItemCreated(object sender, CalendarItemCancelEventArgs e)
        {
            if (e.Item.Text == "")
            {
                MessageBox.Show("No Information");
                return;
            }
            if (patientTxt.Text == "")
            {
                MessageBox.Show("Please select the patient");
                return;
            }
            _items.Add(e.Item);
            string priority = "Medium";

            if (!String.IsNullOrEmpty(priorityCbx.Text))
            {
                priority = priorityCbx.Text;
            }
            string ID    = Guid.NewGuid().ToString();
            var    start = Convert.ToDateTime(e.Item.Date).ToString("yyyy-MM-dd") + "T" + Convert.ToDateTime(e.Item.Date).ToString("HH:mm:ss");
            var    end   = Convert.ToDateTime(e.Item.EndDate).ToString("yyyy-MM-dd") + "T" + Convert.ToDateTime(e.Item.EndDate).ToString("HH:mm:ss");

            _event = new Events(ID, Helper.CleanString(e.Item.Text), start, end, practitionerTxt.Text, patientTxt.Text, DateTime.Now.Date.ToString("yyyy-MM-dd"), patientID, "due", userID, Convert.ToDateTime(e.Item.Date).ToString("yyyy-MM-dd"), "false", priority, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "f", contact, email, departmentCbx.Text, clinicCbx.Text, Helper.orgID);

            Global._events.Add(_event);
            string Query2 = "INSERT INTO events (id, details, starts, ends, users, patient, created, patientID, status, userID, dated,notif,priority, sync,cal,contact,email) VALUES ('" + ID + "','" + Helper.CleanString(e.Item.Text) + "','" + start + "','" + end + "','" + practitionerTxt.Text + "','" + patientTxt.Text + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "','" + patientID + "','due','" + userID + "','" + Convert.ToDateTime(e.Item.Date).ToString("yyyy-MM-dd") + "','false','" + priority + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','f','" + contact + "','" + email + "');";

            DBConnect.Execute(Query2);
            MessageBox.Show("Information saved" + start + " to" + end);
        }
Пример #3
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if (updateID == "")
            {
                return;
            }
            if (MessageBox.Show("YES or No?", "Are you sure you want to update this information? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                string SQL = "UPDATE roles SET views = '" + viewTxt.Text + "',actions='" + actionTxt.Text + "',title= '" + titleTxt.Text + "' WHERE id= '" + updateID + "'";

                DBConnect.Execute(SQL);

                MessageBox.Show("Information updated");
                saveBtn.Visible   = true;
                updateBtn.Visible = false;
                updateID          = "";
                titleTxt.Text     = "";
                actionTxt.Text    = "";
                viewTxt.Text      = "";
                LoadData();
            }
        }
Пример #4
0
        private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            //Messenger.connect();
            Messenger.connects();
            if (!Messenger.state)
            {
                FeedBack("Modem not connected.... " + DateTime.Now.ToString());
            }
            else
            {
                foreach (Events c in Global._events.Where(o => o.Notif.Contains("true") && o.Dated.Contains(DateTime.Now.ToString("yyyy-MM-dd"))))
                {
                    FeedBack("PROCESS " + c.Patient + " " + c.Contact);
                    try
                    {
                        string info = Messenger.Send(c.Details, c.Contact.Trim());
                        if (info == "sent")
                        {
                            string SQL = "UPDATE events SET notify = 'false', WHERE id= '" + c.Id + "'";

                            DBConnect.Execute(SQL);

                            FeedBack("Message sent to: " + c.Patient + " Contact: " + c.Contact + "  " + DateTime.Now.ToString());
                        }
                        else
                        {
                            FeedBack("Message not sent : " + c.Patient + " Contact: " + c.Contact + "  " + DateTime.Now.ToString());
                        }
                    }
                    catch (Exception k)
                    {
                        FeedBack("PROCESSING ERROR " + k.Message.ToString());
                    }
                    Thread.Sleep(1500);
                }
            }
        }
Пример #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                nameTxt.BackColor = Color.Red;
                return;
            }

            if (saleTxt.Text == "")
            {
                saleTxt.BackColor = Color.Red;
                return;
            }
            if (qtyTxt.Text == "")
            {
                qtyTxt.BackColor = Color.Red;
                return;
            }
            if (purchaseTxt.Text == "")
            {
                purchaseTxt.BackColor = Color.Red;
                return;
            }
            if (!String.IsNullOrEmpty(ItemID))
            {
                if (Global._items.Where(t => t.Id.Contains(ItemID)).ToList().Count() < 1)
                {
                    MemoryStream stream    = ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg);
                    string       fullimage = ImageToBase64(stream);
                    _item = new Item(ItemID, nameTxt.Text, codeTxt.Text, descriptionTxt.Text, mannufacturerTxt.Text, ctryTxt.Text, batchTxt.Text, purchaseTxt.Text, saleTxt.Text, compositionTxt.Text, Convert.ToDateTime(expireDate.Text).ToString("dd-MM-yyyy"), categoryCbx.Text, packageCbx.Text, barcodeTxt.Text, fullimage, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), departmentCbx.Text, Convert.ToDateTime(manufactureDate.Text).ToString("dd-MM-yyyy"), genericTxt.Text, strengthTxt.Text, Helper.orgID);

                    if (DBConnect.Insert(_item) != "")
                    {
                        if (Global._stocks.Where(t => t.ItemID.Contains(ItemID)).Count() > 0)
                        {
                            double value = 0;
                            string qty   = Global._stocks.First(t => t.ItemID.Contains(ItemID)).Quantity;
                            value = Convert.ToDouble(qty) + Convert.ToDouble(qtyTxt.Text);

                            string itemID = Global._stocks.First(t => t.ItemID.Contains(ItemID)).ItemID;
                            string SQL    = "UPDATE stock SET qty = '" + value + "', WHERE itemID = '" + itemID + "'";
                            DBConnect.Execute(SQL);
                        }
                        else
                        {
                            double totalQty = Convert.ToDouble(purchaseTxt.Text) * Convert.ToDouble(qtyTxt.Text);
                            string id       = Guid.NewGuid().ToString();
                            _stock = new Stock(id, ItemID, qtyTxt.Text, descriptionTxt.Text, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), saleTxt.Text, purchaseTxt.Text, purchaseTxt.Text, purchaseTxt.Text, totalQty.ToString(), Helper.orgID);
                            DBConnect.Insert(_stock);
                            Global._stocks.Add(_stock);
                        }

                        if (Global._transactors.Where(t => t.Id.Contains(SupplierID)).Count() < 0)
                        {
                            MemoryStream streams    = ImageToStream(pictureBox1.Image, System.Drawing.Imaging.ImageFormat.Jpeg);
                            string       fullimages = ImageToBase64(streams);
                            string       id         = Guid.NewGuid().ToString();
                            _transactor = new Transactor(id, supplierNoTxt.Text, contactTxt.Text, supplierTxt.Text, emailTxt.Text, addressTxt.Text, fullimages, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), "Supplier", Helper.orgID);
                            DBConnect.Insert(_transactor);
                            SupplierID = id;
                        }


                        if (!String.IsNullOrEmpty(noTxt.Text) && !String.IsNullOrEmpty(SupplierID))
                        {
                            string id = Guid.NewGuid().ToString();
                            _bill = new Bill(id, noTxt.Text, SupplierID, remarksTxt.Text, purchaseDate.Text, purchaseTxt.Text, balanceTxt.Text, methodCbx.Text, paidCbx.Text, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), departmentCbx.Text, Convert.ToDateTime(dueDate.Text).ToString("dd-MM-yyyy"), chqTxt.Text, bankTxt.Text, "Purchase", "", "", Helper.orgID);
                            DBConnect.Insert(_bill);
                            string id2 = Guid.NewGuid().ToString();
                            _transaction = new Transaction(id2, noTxt.Text, ItemID, qtyTxt.Text, Convert.ToDateTime(purchaseDate.Text).ToString("dd-MM-yyyy"), purchaseTxt.Text, "Purchase", DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);
                            DBConnect.Insert(_transaction);
                        }

                        if (Global._dosages.Where(t => t.ItemID.Contains(ItemID)).Count() < 0)
                        {
                            string id = Guid.NewGuid().ToString();
                            _dosage = new Dosage(id, ItemID, doseTxt.Text, prescriptionTxt.Text, dosageQtyTxt.Text, minTxt.Text, maxTxt.Text, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);
                            DBConnect.Insert(_dosage);
                        }

                        Global._items.Add(_item);
                        MessageBox.Show("Information Saved");
                        this.DialogResult = DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("No valid Item identification ");
                    }
                }
            }
        }
Пример #6
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 = "";
        }