Example #1
0
        public history_drop(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("drop_datetime", "ดรอปเมื่อ", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("drop_during", "ดรอประหว่างวันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("drop_note", "สาเหตุการดรอป", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("drop_by", "ทำการดรอปโดย", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("branch_name", "ดรอปที่สาขา", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("drop_is_cancelled", "ถูกยกเลิก ?"));
            DGVC.Add(new dgvColumn("cancelled_by", "ยกเลิกการดรอปโดย", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("cancelled_datetime", "ยกเลิกการดรอปเมื่อ", DataGridViewContentAlignment.MiddleLeft));
            btn_dgv.initColumn(DGVC);

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;

            GF.closeLoading();
        }
Example #2
0
        public history_pt_usage(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("pt_course", "คอร์ส PT", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("trainer", "เทรนเนอร์", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("amount_left", "คงเหลือ"));
            btn_dgv.initColumn(DGVC);

            GF.closeLoading();

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            this.CenterToScreen();
        }
        public history_card_no(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("change_datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("member_no", "เปลี่ยน เลขที่สมาชิก เป็น", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("note", "บันทึกเพิ่มเติม", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("change_by", "เปลี่ยนแปลงโดย", DataGridViewContentAlignment.MiddleLeft));
            btn_dgv.initColumn(DGVC);

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;

            GF.closeLoading();
        }
Example #4
0
        private void config_product_manage_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(product_id))
            {
                GF.showLoading(this);

                Dictionary <string, string> values = new()
                {
                    { "product_id", product_id.Trim() }
                };

                Dictionary <string, object> Obj = DB.Post("Product/getProductData/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                        if (Item.Keys.Count > 0)
                        {
                            product_name.Text = Item["product_name"].ToString();
                            product_code.Text = (Item["product_code"] ?? "").ToString();
                            price.Text        = Item["price"].ToString();
                            alert_amount.Text = Item["alert_amount"].ToString();
                        }
                    }
                }

                GF.closeLoading();
            }
        }
        private void manage_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ref_txt.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'อ้างอิง' !!");
                return;
            }

            string product_list = "";

            foreach (DataGridViewRow DGVR in DGV.Rows)
            {
                product_list += DGVR.Cells["product_id"].Value.ToString() + "###" + prefixAmount + DGVR.Cells["amount"].Value.ToString() + "@@@";
            }

            if (!string.IsNullOrEmpty(product_list.Trim()))
            {
                product_list = product_list.Substring(0, product_list.Trim().Length - 3);
            }

            if (string.IsNullOrEmpty(product_list.Trim()))
            {
                GF.Error("ยังไม่ได้เลือก สินค้า !!");
                return;
            }
            GF.showLoading(this);
            Dictionary <string, string> values = new()
            {
                { "branch_id", GF.Settings("branch_id") },
                { "ref", ref_txt.Text.Trim() },
Example #6
0
        public history_payment(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);

            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID }
            };

            Dictionary <string, object> Obj = DB.Post("Branch/BranchList/", values);

            if (Obj != null)
            {
                branch_id.Items.Add(new ComboItem(0, "ทุกสาขา"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        branch_id.Items.Add(new ComboItem(GF.toInt(Item["branch_id"].ToString()), Item["branch_name"].ToString() + " (" + Item["prefix"].ToString() + ")"));
                    }
                }

                branch_id.SelectedIndex = 0;
                GF.resizeComboBox(branch_id);
            }
            else
            {
                GF.closeLoading();
                GF.Error("ไม่มีข้อมูล 'สาขา' ในฐานข้อมูล !!\r\n\r\nกรุณาติดต่อผู้ดูแลระบบ !!");
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("detail", "รายละเอียด", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("branch_name", "สาขา"));
            DGVC.Add(new dgvColumn("cash", "เงินสด"));
            DGVC.Add(new dgvColumn("card", "บัตร"));
            DGVC.Add(new dgvColumn("card_no", "บัตรหมายเลข"));
            DGVC.Add(new dgvColumn("card_expiry_date", "วันหมดอายุบัตร"));
            DGVC.Add(new dgvColumn("by", "ผู้รับเงิน"));
            btn_dgv.initColumn(DGVC);

            GF.closeLoading();

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            this.CenterToScreen();
        }
Example #7
0
        private void branch_manage_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(branch_id))
            {
                GF.showLoading(this);

                Dictionary <string, string> values = new()
                {
                    { "branch_id", branch_id.Trim() }
                };

                Dictionary <string, object> Obj = DB.Post("Branch/getBranchData/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);

                        if (Item.Keys.Count > 0)
                        {
                            branch_name.Text  = Item["branch_name"]?.ToString();
                            prefix.Text       = Item["prefix"]?.ToString();
                            company_name.Text = Item["company_name"]?.ToString();
                            address.Text      = Item["address"]?.ToString();
                            tax_id.Text       = Item["tax_id"]?.ToString();
                        }
                    }
                }
                GF.closeLoading();
            }
        }
        private void config_member_type_manage_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(member_type_id))
            {
                GF.showLoading(this);

                Dictionary <string, string> values = new()
                {
                    { "member_type_id", member_type_id.Trim() }
                };

                Dictionary <string, object> Obj = DB.Post("MemberType/getMemberTypeData/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                        if (Item.Keys.Count > 0)
                        {
                            member_type_name.Text = Item["member_type_name"].ToString();
                            month_amount.Text     = Item["month_amount"].ToString();
                            price.Text            = Item["price"].ToString();
                        }
                    }
                }

                GF.closeLoading();
            }
        }
Example #9
0
 private void change_trainer_Load(object sender, EventArgs e)
 {
     GF.showLoading(this);
     Dictionary <string, string> values = new()
     {
         { "branch_id", GF.Settings("branch_id") },
         { "only_active", "1" }
     };
        public void getData()
        {
            GF.showLoading(this);
            btn_dgv.DGV.Rows.Clear();

            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID },
                { "page", btn_dgv.page.Text.Trim() },
Example #11
0
        void getData()
        {
            GF.showLoading(this);
            btn_dgv.DGV.Rows.Clear();

            Dictionary <string, string> values = new()
            {
                { "page", btn_dgv.page.Text.Trim() },
                { "recordCount", GF.rowsPerPage.ToString() },
        void doLoadGridData(object sender, EventArgs e)
        {
            if (btn_dgv.DGV.Columns.Count == 0)
            {
                return;
            }
            GF.showLoading(this);

            getData();
        }
 private void save_btn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(card_no_txt.Text.Trim()))
     {
         GF.Error("ยังไม่ได้ระบุเลขบัตร !!");
         return;
     }
     GF.showLoading(this);
     Dictionary <string, string> values = new()
     {
         { "member_id", member_id },
         { "card_no", card_no_txt.Text.Trim() },
        }                                                                         // for custom paper size = 999
        public static void initPrint(Form Sender, string bill_id, bool hasVat, bool isPreview = false)
        {
            print_receipt.Sender    = Sender;
            print_receipt.isPreview = isPreview;
            print_receipt.hasVat    = hasVat;

            print_receipt.bill_id = bill_id;

            GF.showLoading(Sender);

            doPrint();
        }
        void generate()
        {
            GF.showLoading(this);
            object missing = Type.Missing;

            var oXL = new Microsoft.Office.Interop.Excel.Application();

            oXL.Visible = false;

            Dictionary <string, string> values = new()
            {
                { "report_year", year_txt.Text.Trim() },
                { "report_type", report_type },
Example #16
0
        private void trainer_job_manage_Load(object sender, EventArgs e)
        {
            if (isReadOnly)
            {
                trainer_emp_id.Enabled = false;
                job_date.Enabled       = false;
                start_time.Enabled     = false;
                end_time.Enabled       = false;
                detail.Enabled         = false;
                manage_btn.Enabled     = false;
            }

            if (!string.IsNullOrEmpty(trainer_job_id.Trim()))
            {
                GF.showLoading(this);

                Dictionary <string, string> values = new()
                {
                    { "trainer_job_id", trainer_job_id.Trim() }
                };

                Dictionary <string, object> Obj = DB.Post("TrainerJob/getJobData/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);

                        foreach (ComboItem cb in trainer_emp_id.Items)
                        {
                            if (Item.ContainsKey("trainer_emp_id"))
                            {
                                if (cb.Key.ToString() == Item["trainer_emp_id"].ToString())
                                {
                                    trainer_emp_id.Text = cb.Value;
                                    break;
                                }
                            }
                        }

                        job_date.Text   = Item["job_date"]?.ToString();
                        start_time.Text = Item["start_time"]?.ToString();
                        end_time.Text   = Item["end_time"]?.ToString();
                        detail.Text     = Item["detail"]?.ToString();
                    }
                }
                GF.closeLoading();
            }
        }
Example #17
0
        public history_checkin(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);

            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID }
            };

            Dictionary <string, object> Obj = DB.Post("Branch/BranchList/", values);

            if (Obj != null)
            {
                branch_id.Items.Add(new ComboItem(0, "ทุกสาขา"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        branch_id.Items.Add(new ComboItem(GF.toInt(Item["branch_id"].ToString()), Item["branch_name"].ToString() + " (" + Item["prefix"].ToString() + ")"));
                    }
                }

                branch_id.SelectedIndex = 0;
                GF.resizeComboBox(branch_id);
            }
            else
            {
                GF.closeLoading();
                GF.Error("ไม่มีข้อมูล 'สาขา' ในฐานข้อมูล !!\r\n\r\nกรุณาติดต่อผู้ดูแลระบบ !!");
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("checkin_datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("branch_name", "สาขา", DataGridViewContentAlignment.MiddleLeft));
            btn_dgv.initColumn(DGVC);

            GF.closeLoading();
        }
 private void use_pt_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         currentLabel.Text = "";
     }
     else if (e.KeyCode == Keys.Enter && !string.IsNullOrEmpty(card_no.Text.Trim()))
     {
         if (currentLabel == card_no && !string.IsNullOrEmpty(card_no.Text.Trim()))
         {
             // GET MEMBER DATA
             GF.showLoading(this);
             Dictionary <string, string> values = new()
             {
                 { "branch_id", GF.Settings("branch_id") },
                 { "card_no", card_no.Text.Trim() },
 private void month_range_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (isReady)
     {
         isReady = false;
         GF.showLoading(this);
         if (e.NewValue == CheckState.Checked)
         {
             for (int i = 0; i < month_range.Items.Count; i++)
             {
                 month_range.SetItemCheckState(i, CheckState.Unchecked);
             }
         }
         isReady = true;
         GF.closeLoading();
     }
 }
        private void employee_manage_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(emp_id.Trim()))
            {
                GF.showLoading(this);
                Dictionary <string, string> values = new()
                {
                    { "emp_id", emp_id.Trim() }
                };

                Dictionary <string, object> Obj = DB.Post("Employee/getEmployeeData/", values);

                if (Obj != null)
                {
                    Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);

                    if (Item.Keys.Count > 0)
                    {
                        emp_code.Text = (Item["emp_code"] ?? "").ToString();
                        fullname.Text = Item["fullname"]?.ToString();
                        nickname.Text = Item["nickname"]?.ToString();
                        if (Item["is_trainer"]?.ToString() == "1")
                        {
                            is_trainer.Checked = true;
                        }
                        if (Item["can_get_commission"]?.ToString() == "1")
                        {
                            can_get_commission.Checked = true;
                        }

                        foreach (ComboItem cb in branch_id.Items)
                        {
                            if (cb.Key.ToString() == Item["branch_id"]?.ToString())
                            {
                                branch_id.Text = cb.Value;
                                break;
                            }
                        }
                    }
                }

                GF.closeLoading();
            }
        }
        public void getData()
        {
            if (trainer_emp_id.Items.Count == 0)
            {
                return;
            }
            if (((ComboItem)trainer_emp_id.SelectedItem).Key == 0)
            {
                btn_dgv.DGV.Rows.Clear();
                btn_dgv.resetBtnDGV("0");
                return;
            }
            GF.showLoading(this);
            btn_dgv.DGV.Rows.Clear();

            Dictionary <string, string> values = new()
            {
                { "page", btn_dgv.page.Text.Trim() },
                { "recordCount", GF.rowsPerPage.ToString() },
        void DisableEvent(object sender, EventArgs e)
        {
            var values = new Dictionary <string, string>
            {
                { "branch_id", btn_dgv.DGV.SelectedRows[0].Cells["branch_id"]?.Value.ToString() }
            };

            GF.showLoading(this);
            Dictionary <string, object> result = DB.Post("Branch/Suspend/", values);

            if (result == null)
            {
                GF.Error("เกิดความผิดพลาด !!");
                GF.closeLoading();
                return;
            }

            getData();
        }
 private void check_in_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.Height = 192;
         if (member_pic_pb.Image != null)
         {
             member_pic_pb.Image.Dispose();
             member_pic_pb.Image = null;
         }
         reset();
     }
     else if (e.KeyCode == Keys.Enter && !string.IsNullOrEmpty(member_card_no.Text.Trim()))
     {
         GF.showLoading(this);
         Dictionary <string, string> values = new()
         {
             { "card_no", member_card_no.Text.Trim() },
             { "branch_id", GF.Settings("branch_id") },
Example #24
0
        void EnableEvent(object sender, EventArgs e)
        {
            Dictionary <string, string> values = new()
            {
                { "product_id", btn_dgv.DGV.SelectedRows[0].Cells["product_id"].Value.ToString() }
            };

            GF.showLoading(this);
            Dictionary <string, object> result = DB.Post("Product/Enable/", values);

            if (result == null)
            {
                GF.Error("เกิดความผิดพลาด !!");
                GF.closeLoading();
                return;
            }

            getData();
        }
Example #25
0
        private void save_btn_Click(object sender, EventArgs e)
        {
            GF.showLoading(this);
            string newFileName = (DateTime.Now.Year + 543).ToString() + "-" + DateTime.Now.Month.ToString("00") + "-" + DateTime.Now.Day.ToString("00") + "-" + DateTime.Now.Hour.ToString("00") + "-" + DateTime.Now.Minute.ToString("00") + "-" + DateTime.Now.Second.ToString("00") + ".jpg";

            List <string> FileList = FTP.getFTPFileList("emp_card");

            foreach (string FTPfilename in FileList)
            {
                if (!FTP.delete("emp_card", FTPfilename))
                {
                    GF.Error("เกิดความผิดพลาดในการลบไฟล์บน Server !!");
                    return;
                }
            }

            if (!FTP.upload("emp_card", targetFileName, newFileName))
            {
                GF.closeLoading();
                GF.Error("เกิดความผิดพลาดในการ upload ไฟล์รูปภาพไปยัง server !!");
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "filename", newFileName }
            };

            Dictionary <string, object> result = DB.Post("Employee/manageEmpCard/", values);

            if (result == null)
            {
                GF.closeLoading();
                GF.Error("เกิดความผิดพลาด !!");
                return;
            }

            GF.closeLoading();
            this.Close();
        }
        private void product_code_KeyUp(object sender, KeyEventArgs e)
        {
            if (!string.IsNullOrEmpty(product_code.Text.Trim()) && e.KeyCode == Keys.Enter)
            {
                GF.showLoading(this);
                Dictionary <string, string> values = new()
                {
                    { "product_code", product_code.Text.Trim() }
                };

                Dictionary <string, object> Obj = DB.Post("Product/getProductFromBarcode/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                        if (Item.Keys.Count > 0)
                        {
                            addRow(Item["product_name"].ToString(), Item["price"].ToString(), Item["product_id"].ToString(), "1");

                            product_DGV.Select();
                            product_DGV.Rows[^ 1].Cells["amount"].Selected = true;
Example #27
0
        private void member_pt_Load(object sender, EventArgs e)
        {
            GF.showLoading(this);

            if (onlySee)
            {
                disableAll();
            }

            if (isForceEdit || isForceAdd)
            {
                amount_left_lbl1.Visible = amount_left.Visible = amount_left_lbl2.Visible = true;
                seller_emp_lbl.Visible   = seller_emp_id.Visible = true;

                GF.disableBtn(add_payment_btn);
                payment_DGV.Enabled = false;
            }

            if (isAlreadyVoided)
            {
                amount_left.Enabled   = false;
                seller_emp_id.Enabled = false;
            }

            Dictionary <string, string> values = new()
            {
                { "branch_id", ((isForceAdd || isForceEdit || onlySee) ? "-1" : GF.Settings("branch_id")) }
            };

            Dictionary <string, object> Obj = DB.Post("PT/PTList/", values);

            if (Obj != null)
            {
                if (!isForceAdd && !isForceEdit)
                {
                    pt_emp_id.Items.Add(new ComboItem(0, "เลือก 'เทรนเนอร์'"));
                }

                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        pt_emp_id.Items.Add(new ComboItem(GF.toInt(Item["emp_id"].ToString()), Item["fullname"].ToString() + " (" + Item["nickname"].ToString() + ")"));
                        seller_emp_id.Items.Add(new ComboItem(GF.toInt(Item["emp_id"].ToString()), Item["fullname"].ToString() + " (" + Item["nickname"].ToString() + ")"));
                    }
                }

                pt_emp_id.SelectedIndex     = 0;
                seller_emp_id.SelectedIndex = 0;
                GF.resizeComboBox(pt_emp_id);
                GF.resizeComboBox(seller_emp_id);
            }
            else
            {
                GF.Error("ไม่มีข้อมูล 'เทรนเนอร์' !!\r\n\r\nกรุณาแจ้งผู้ดูแลระบบ !!");
            }

            // GET BUY PT DATA
            if (!string.IsNullOrEmpty(member_pt_id))
            {
                values = new()
                {
                    { "member_pt_id", member_pt_id.Trim() }
                };

                Obj = DB.Post("Member/getBuyPTData/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                        if (Item.Keys.Count > 0)
                        {
                            hours.Text       = Item["max_hours"].ToString();
                            start_date.Text  = (Item["start_date"] ?? "").ToString();
                            expiry_date.Text = Item["expiry_date"].ToString();
                            price.Text       = Item["price"].ToString();
                            age.Text         = (Item["age"] ?? "").ToString();
                            amount_left.Text = (Item["left_hours"] ?? "").ToString();
                            note_txt.Text    = (Item["note"] ?? "").ToString();

                            foreach (ComboItem cb in pt_emp_id.Items)
                            {
                                if (cb.Key.ToString() == Item["pt_emp_id"].ToString())
                                {
                                    pt_emp_id.Text = cb.Value;
                                }
                            }

                            foreach (ComboItem cb in seller_emp_id.Items)
                            {
                                if (cb.Key.ToString() == Item["pt_seller_id"].ToString())
                                {
                                    seller_emp_id.Text = cb.Value;
                                }
                            }

                            string payment_data = (Item["payment_data"] ?? "").ToString().Trim();
                            if (!string.IsNullOrEmpty(payment_data))
                            {
                                payment_DGV.Rows.Clear();
                                string[] payment_record = payment_data.Split(new string[] { "!!" }, StringSplitOptions.None);
                                foreach (string payment_item in payment_record)
                                {
                                    string[] tmp = payment_item.Split(new string[] { "##" }, StringSplitOptions.None);
                                    string   the_payment_type = Array.Find(GF.payment_type, p => Convert.ToInt32(p.Key) == Convert.ToInt32(tmp[0].ToString())).Value;

                                    string[] Data =
                                    {
                                        the_payment_type,
                                        tmp[1].ToString(),
                                        (tmp[2] ?? "").ToString(),
                                        (tmp[3] ?? "").ToString(),
                                        tmp[4].ToString(),
                                        GF.formatDBDateTime(tmp[5].ToString()),
                                        tmp[6].ToString(),
                                        tmp[7].ToString()
                                    };

                                    GF.addPaymentRow(payment_DGV, Data, tmp[6].ToString());
                                }
                                payment_DGV.ClearSelection();
                            }
                        }
                    }
                }
            }

            GF.closeLoading();
        }
Example #28
0
        private void user_manage_Load(object sender, EventArgs e)
        {
            GF.showLoading(this);
            Dictionary <string, string> values = new()
            {
                { "branch_id", GF.Settings("branch_id") }
            };

            if (!string.IsNullOrEmpty(user_id))
            {
                values.Add("user_id", user_id);
            }

            Dictionary <string, object> Obj = DB.Post("User/getUserOwner/", values);

            if (Obj != null)
            {
                emp_id.Items.Add(new ComboItem(0, "เลือก พนักงานเจ้าของบัญชี"));
                emp_id.Items.Add(new ComboItem(-1, "ไม่ใช่พนักงาน"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        emp_id.Items.Add(new ComboItem(Convert.ToInt32(Item["emp_id"].ToString()), Item["owner_name"].ToString()));
                    }
                }
            }
            else
            {
                emp_id.Items.Add(new ComboItem(0, "เกิดความผิดพลาด !!"));
            }

            emp_id.SelectedIndex = 0;

            if (!string.IsNullOrEmpty(user_id))
            {
                values = new()
                {
                    { "user_id", user_id.Trim() }
                };

                Obj = DB.Post("User/getUserData/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                        if (Item.Keys.Count > 0)
                        {
                            username.Text          = Item["username"].ToString();
                            manual_owner_name.Text = (Item["manual_owner_name"] ?? "").ToString();
                            if (Item["is_admin"].ToString() == "1")
                            {
                                is_admin.Checked = true;
                            }

                            if (Item["can_approve"].ToString() == "1")
                            {
                                can_approve.Checked = true;
                            }

                            if (Item["can_use_web"].ToString() == "1")
                            {
                                can_use_web.Checked  = true;
                                web_TreeView.Enabled = true;
                            }
                            else
                            {
                                web_TreeView.Enabled = false;
                            }

                            foreach (ComboItem cb in emp_id.Items)
                            {
                                if (cb.Key.ToString() == Item["emp_id"].ToString())
                                {
                                    emp_id.Text = cb.Value;
                                    break;
                                }
                            }

                            string[] BranchList = Item["branch_list"].ToString().Split(new string[] { "!!" }, StringSplitOptions.None);
                            foreach (string Branch in BranchList)
                            {
                                TreeNode[] Nodes = branch_TreeView.Nodes.Find(Branch, true);
                                if (Nodes.Length == 1)
                                {
                                    Nodes[0].Checked = true;
                                }
                            }

                            string[] MenuList = Item["menu_list"].ToString().Split(new string[] { "!!" }, StringSplitOptions.None);
                            foreach (string Menu in MenuList)
                            {
                                TreeNode[] Nodes = menu_TreeView.Nodes.Find(Menu, true);
                                if (Nodes.Length == 1)
                                {
                                    Nodes[0].Checked = true;
                                }
                            }

                            string[] MenuWebList = Item["menu_web_list"].ToString().Split(new string[] { "!!" }, StringSplitOptions.None);
                            foreach (string Menu in MenuWebList)
                            {
                                TreeNode[] Nodes = web_TreeView.Nodes.Find(Menu, true);
                                if (Nodes.Length == 1)
                                {
                                    Nodes[0].Checked = true;
                                }
                            }
                        }
                    }
                }
            }
            GF.closeLoading();
        }
Example #29
0
        private void config_employee_card_Load(object sender, EventArgs e)
        {
            GF.showLoading(this);
            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID }
            };

            Dictionary <string, object> Obj = DB.Post("Employee/getEmpCardFileName/", values);

            if (Obj != null)
            {
                if (Obj.ContainsKey("result"))
                {
                    Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                    if (Item.Keys.Count > 0)
                    {
                        if (string.IsNullOrEmpty(Item["filename"]?.ToString()))
                        {
                            this.Height = minHeight;
                        }
                        else
                        {
                            bool isFTPPicture = false;
                            if (File.Exists(GF.Settings("emp_card") + Item["filename"]?.ToString()))
                            {
                                thePicture = Image.FromFile(GF.Settings("emp_card") + Item["filename"]?.ToString());
                            }
                            else
                            {
                                isFTPPicture = true;
                                thePicture   = FTP.download("emp_card", Item["filename"]?.ToString());
                            }

                            var destRect  = new Rectangle(0, 0, 502, 325);
                            var destImage = new Bitmap(502, 325);

                            destImage.SetResolution(thePicture.HorizontalResolution, thePicture.VerticalResolution);

                            using (var graphics = Graphics.FromImage(destImage))
                            {
                                graphics.CompositingMode    = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
                                graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                                graphics.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                                graphics.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                                graphics.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

                                using var wrapMode = new System.Drawing.Imaging.ImageAttributes();
                                wrapMode.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
                                graphics.DrawImage(thePicture, destRect, 0, 0, thePicture.Width, thePicture.Height, GraphicsUnit.Pixel, wrapMode);
                            }

                            if (isFTPPicture)
                            {
                                var downloadedMessageInfo = new DirectoryInfo(GF.Settings("emp_card"));

                                foreach (FileInfo file in downloadedMessageInfo.GetFiles())
                                {
                                    file.Delete();
                                }
                                destImage.Save(GF.Settings("emp_card") + Item["filename"]?.ToString(), System.Drawing.Imaging.ImageFormat.Jpeg);
                            }
                            pictureBox.Image = destImage;
                        }
                    }
                }
            }
            else
            {
                this.Height = minHeight;
                GF.closeLoading();
                GF.Error("เกิดความผิดพลาดในการรับชื่อไฟล์จาก Server !");
            }
            this.CenterToScreen();
            GF.closeLoading();
        }
        public trainer_job_list()
        {
            InitializeComponent();

            GF.showLoading(this);

            Dictionary <string, string> values = new()
            {
                { "branch_id", GF.Settings("branch_id") }
            };

            Dictionary <string, object> Obj = DB.Post("Employee/getTrainer/", values);

            if (Obj != null)
            {
                trainer_emp_id.Items.Add(new ComboItem(0, "ทุกคน"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        trainer_emp_id.Items.Add(new ComboItem(GF.toInt(Item["trainer_emp_id"].ToString()), Item["trainer_name"].ToString()));
                    }
                }

                trainer_emp_id.SelectedIndex = 0;
                GF.resizeComboBox(trainer_emp_id);
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("during", "ระหว่างเวลา"));
            DGVC.Add(new dgvColumn("detail", "รายละเอียด", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("trainer_name", "เทรนเนอร์", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("confirm_by", "ยืนยันว่าเกิดขึ้นจริง โดย"));
            DGVC.Add(new dgvColumn("confirm_datetime", "วันเวลา ที่ยืนยันว่าเกิดขึ้นจริง"));
            DGVC.Add(new dgvColumn("create_by", "สร้าง โดย"));
            DGVC.Add(new dgvColumn("create_datetime", "สร้าง เมื่อ"));
            DGVC.Add(new dgvColumn("last_modified_by", "ปรับปรุงล่าสุด โดย"));
            DGVC.Add(new dgvColumn("last_modified_datetime", "ปรับปรุงล่าสุด เมื่อ"));
            DGVC.Add(new dgvColumn("trainer_job_id", "trainer_job_id", DataGridViewContentAlignment.MiddleLeft, false));
            btn_dgv.initColumn(DGVC);

            btn_dgv.DGV.MouseClick += (ss, ee) =>
            {
                if (ee.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    if (btn_dgv.DGV.HitTest(ee.X, ee.Y).ColumnIndex > -1 && btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex > -1)
                    {
                        btn_dgv.DGV.Rows[btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex].Selected = true;
                        btn_dgv.theContextMenu.Items.Clear();
                        if (btn_dgv.DGV.SelectedRows.Count == 1)
                        {
                            btn_dgv.theContextMenu.Items.Add("แก้ไข", null, new EventHandler(EditEvent));
                            if (string.IsNullOrEmpty((btn_dgv.DGV.SelectedRows[0].Cells["confirm_by"].Value ?? "").ToString()))
                            {
                                btn_dgv.theContextMenu.Items.Add("ยืนยันว่าเกิดขึ้นจริง", null, new EventHandler(ConfirmEvent));
                            }
                        }
                    }
                }
            };

            GF.closeLoading();

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            this.CenterToScreen();
        }