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() },
        static void doPrint()
        {
            try
            {
                print_receipt.printerResolution = new PrinterResolution();
                GF.printError("INIT PRINT DOCUMENT FOR 'SHOP RECEIPT' ...");

                if (GF.Settings("receipt_printer") == "")
                {
                    GF.Error("ไม่พบ PRINTER สำหรับออกใบเสร็จ !!");
                    GF.closeLoading();
                }
                else if (GF.Settings("receipt_printer") == "ไม่มี")
                {
                    GF.Error("ไม่สามารถพิมพ์ใบเสร็จได้ จนกว่าจะตั้งค่า PRINTER สำหรับออกใบเสร็จ !!");
                    GF.closeLoading();
                    return;
                }
                else
                {
                    print_receipt.printerName = GF.Settings("receipt_printer");
                    GF.printError("PRINTER : " + print_receipt.printerName);
                }

                initPrintDocument();
            }
            catch (Exception e)
            {
                GF.printError(e.Message + "\r\n\r\n" + e.StackTrace.ToString());
                GF.Error(e.Message, "PRINTER ERROR !!");
                GF.closeLoading();
            }
        }
Exemplo n.º 3
0
        private void save_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(password.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'รหัสผ่าน' !!");
                password.Select();
                return;
            }

            if (!string.IsNullOrEmpty(password.Text.Trim()) && string.IsNullOrEmpty(verify_password.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ยืนยันรหัสผ่าน' !!");
                verify_password.Select();
                return;
            }

            if (!string.IsNullOrEmpty(password.Text.Trim()) && verify_password.Text.Trim() != password.Text.Trim())
            {
                GF.Error("'ยืนยันรหัสผ่าน' ที่กรอกไม่ตรงกับ 'รหัสผ่าน' !!");
                verify_password.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "password", password.Text.Trim() },
                { "user_id", GF.userID }
            };
Exemplo n.º 4
0
        private void picture_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(member_no.Text.Trim()) || string.IsNullOrEmpty(member_id.Trim()))
            {
                GF.Error("ต้องมี 'หมายเลขสมาชิก' ก่อน !!");
                return;
            }

            if (Global.Capture.List().Count > 0)
            {
                using var member_picture = new member_picture(member_no.Text.Trim());
                member_picture.Owner     = this;
                member_picture.ShowDialog();
                this.BringToFront();
                this.Activate();
            }
            else
            {
                GF.Error("ไม่พบ กล้อง WebCam !!\r\nกรุณาติดตั้ง กล้อง WebCam ก่อน !");
                return;
            }

            if (!string.IsNullOrEmpty(member_no.Text.Trim()) && !string.IsNullOrEmpty(pictureFilename.Trim()))
            {
                GF.getImage(GF.Settings("tmp_path") + pictureFilename, ref picture, "member_picture");
            }
        }
        private void get_excel_btn_Click(object sender, EventArgs e)
        {
            if (year_txt.Text.Trim() == string.Empty)
            {
                GF.Error("ยังไม่ได้ระบุ 'ปี พ.ศ.' !");
                return;
            }

            // month_range
            report_type = string.Empty;
            for (int i = 0; i < month_range.Items.Count; i++)
            {
                if (month_range.GetItemCheckState(i) == CheckState.Checked)
                {
                    report_type = (month_range.Items[i] as ComboItem).Key.ToString();
                }
            }

            if (string.IsNullOrEmpty(report_type))
            {
                GF.Error("ยังไม่ได้เลือก 'ช่วงเดือน' !");
                return;
            }
            generate();
        }
Exemplo n.º 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();
        }
        private void save_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(emp_code.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'รหัสพนักงาน' !!");
                emp_code.Select();
                return;
            }

            if (string.IsNullOrEmpty(fullname.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ชื่อ - สกุล' !!");
                fullname.Select();
                return;
            }

            if (string.IsNullOrEmpty(nickname.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ชื่อเล่น' !!");
                nickname.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "emp_code", emp_code.Text.Trim() },
                { "fullname", fullname.Text.Trim() },
Exemplo n.º 8
0
        public static bool validateTime(MaskedTextBox MTB)
        {
            if (MTB.Text.Trim().Length == 1)
            {
                return(true);
            }

            if (!MTB.MaskFull)
            {
                GF.Error("กรุณากรอก 'เวลา' ให้ครบ !!");
                MTB.Select();
                return(false);
            }

            string[] tmp   = MTB.Text.Split(':');
            int      hours = Convert.ToInt32(tmp[0]);
            int      mins  = Convert.ToInt32(tmp[1]);

            if (hours < 0 || hours > 23)
            {
                GF.Error("ชั่วโมง ต้องอยู่ระหว่าง 00 ถึง 23 !!");
                MTB.Select();
                return(false);
            }

            if (mins < 0 || mins > 59)
            {
                GF.Error("นาที ต้องอยู่ระหว่าง 00 ถึง 59 !!");
                MTB.Select();
                return(false);
            }

            return(true);
        }
        private void save_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(drop_start.Text.Replace("_", "").Replace(" ", "").Replace("/", "").Trim()))
            {
                GF.Error("กรุณากรอก 'ดรอปตั้งแต่วันที่' !!");
                drop_start.Select();
                return;
            }

            if (drop_start.Text.Trim().Length < 10)
            {
                GF.Error("กรุณากรอก 'ดรอปตั้งแต่วันที่' ให้ครบ !!\r\n\r\n(หาก วัน หรือ เดือน เป็นเลขตัวเดียว ให้เติม 0 ข้างหน้า)");
                drop_start.Select();
                return;
            }

            if (string.IsNullOrEmpty(day_amount.Text.Trim()))
            {
                GF.Error("ยังไม่ได้กรอก 'จำนวนวัน' !!");
                day_amount.Select();
                return;
            }

            if (string.IsNullOrEmpty(drop_note.Text.Trim()))
            {
                GF.Error("ยังไม่ได้กรอก 'สาเหตุการดรอป' !!");
                drop_note.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "member_id", member_id },
                { "drop_start", drop_start.Text.Trim() },
        static void doPrint()
        {
            try
            {
                preview_bill_header.printerResolution = new PrinterResolution();
                Console.WriteLine("INIT PRINT DOCUMENT FOR 'RECEIPT' ...");

                if (GF.Settings("receipt_printer") == "")
                {
                    GF.Error("ไม่พบ PRINTER สำหรับออกใบเสร็จ !!");
                    GF.closeLoading();
                }
                else
                {
                    preview_bill_header.printerName = GF.Settings("receipt_printer");
                    Console.WriteLine("PRINTER : " + preview_bill_header.printerName);
                }

                initPrintDocument();
            }
            catch (Exception e)
            {
                GF.Error(e.Message, "PRINTER ERROR !!");
                GF.closeLoading();
            }
        }
Exemplo n.º 11
0
        public static Image download(string folderName, string fileName)
        {
            if (string.IsNullOrEmpty(folderName))
            {
                Console.WriteLine("\r\nระบุ folderName !!\r\n");
                GF.Error("เกิดความผิดพลาดในการ download ไฟล์จาก server !!\r\n\r\nกรุณาติดต่อผู้ดูแลเกี่ยวกับปัญหานี้ ...");
                return(null);
            }
            Console.WriteLine("folderName = " + folderName);

            if (fileName.IndexOf(GF.Settings("tmp_path")) != -1)
            {
                fileName = fileName.Replace(GF.Settings("tmp_path"), "");
            }

            if (string.IsNullOrEmpty(fileName))
            {
                Console.WriteLine("\r\nระบุ fileName !!\r\n");
                GF.Error("เกิดความผิดพลาดในการ download ไฟล์จาก server !!\r\n\r\nกรุณาติดต่อผู้ดูแลเกี่ยวกับปัญหานี้ ...");
                return(null);
            }
            Console.WriteLine("fileName = " + fileName);

            Image returnImage = null;

            try
            {
                FtpWebRequest request = open(WebRequestMethods.Ftp.DownloadFile, folderName, fileName);
                if (request != null)
                {
                    FtpWebResponse response = (FtpWebResponse)request.GetResponse();

                    Stream responseStream = response.GetResponseStream();

                    if (response.StatusCode == FtpStatusCode.OpeningData)
                    {
                        returnImage = Bitmap.FromStream(responseStream);
                    }
                    else
                    {
                        GF.Error("(" + response.StatusCode.ToString() + ") " + response.StatusDescription);
                        Console.WriteLine("FTP :: FILE [" + fileName + "] DOWNLOAD FAILED !! (" + response.StatusCode.ToString() + ") " + response.StatusDescription);
                        returnImage = null;
                    }

                    response.Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                GF.Error("เกิดความผิดพลาดในการดึงไฟล์รูปภาพสมาชิกจาก Server !");
                return(null);
            }
            Console.WriteLine("FTP :: FILE [" + fileName + "] DOWNLOAD SUCCEEDED !!");
            return(returnImage);
        }
Exemplo n.º 12
0
 public static bool hasReceiptPrinter()
 {
     if (GF.Settings("receipt_printer") == "ไม่มี")
     {
         GF.Error("ใบเสร็จจะถูกพิมพ์ก็ต่อเมื่อมีการตั้งค่าเครื่องพิมพ์เท่านั้น !!");
         return(false);
     }
     return(true);
 }
 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() },
Exemplo n.º 14
0
        public static bool upload(string folderName, string file_path, string new_fileName)
        {
            if (!new_fileName.Trim().ToLower().Contains(".jpg"))
            {
                GF.Error("ต้องเป็นไฟล์สกุล .JPG เท่านั้น !!");
                return(false);
            }
            bool          boolReturn = false;
            FtpWebRequest request    = open(WebRequestMethods.Ftp.UploadFile, folderName, new_fileName);

            if (request != null)
            {
                try
                {
                    // Copy the contents of the file to the request stream.
                    byte[] fileContents = File.ReadAllBytes(file_path);

                    request.RenameTo      = new_fileName;
                    request.ContentLength = fileContents.Length;

                    Stream requestStream;
                    using (requestStream = request.GetRequestStream())
                    {
                        requestStream.Write(fileContents, 0, fileContents.Length);
                        requestStream.Close();

                        FtpWebResponse response = (FtpWebResponse)request.GetResponse();

                        if (response.StatusCode == FtpStatusCode.ClosingData)
                        {
                            boolReturn = true;
                        }
                        else
                        {
                            GF.Error("(" + response.StatusCode.ToString() + ") " + response.StatusDescription);
                            Console.WriteLine("FTP :: FILE [" + new_fileName + "] UPLOAD FAILED !! (" + response.StatusCode.ToString() + ") " + response.StatusDescription);
                            boolReturn = false;
                        }

                        response.Close();
                    }
                }
                catch (Exception e)
                {
                    GF.Error("เกิดความผิดพลาด !!\r\n\r\n" + e.Message);
                    boolReturn = false;
                    return(boolReturn);
                }
            }
            Console.WriteLine("FTP :: FILE [" + new_fileName + "] UPLOAD SUCCEEDED !!");
            return(boolReturn);
        }
Exemplo n.º 15
0
 public static void printError(string debugText)
 {
     try
     {
         sw = new StreamWriter(GF.Settings("tmp_path") + "error.txt", true);
         sw.WriteLine("[ " + NOW() + " ] " + debugText);
         sw.Close();
     }
     catch (Exception e)
     {
         GF.Error(e.Message);
     }
 }
        private void save_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(reason.Text.Trim()))
            {
                GF.Error("กรุณาระบุ 'สาเหตุ' !!");
                reason.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "bill_id", bill_id },
                { "void_by", GF.userID },
Exemplo n.º 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();
        }
Exemplo n.º 18
0
        private void save_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(reason.Text.Trim()))
            {
                GF.Error("กรุณาระบุ 'สาเหตุ' !!");
                reason.Select();
                return;
            }

            if (MessageBox.Show("คุณแน่ใจหรือไม่ ที่จะ VOID รายการนี้ ?\r\n\r\nเมื่อ VOID แล้วจะไม่สามารถยกเลิกได้อีก ต้องสร้างรายการใหม่เท่านั้น !", "คำเตือน", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                Dictionary <string, string> values = new()
                {
                    { "member_pt_id", _member_pt_id },
                    { "void_reason", reason.Text.Trim() },
Exemplo n.º 19
0
        public static bool validateDateTime(MaskedTextBox MTB)
        {
            if (MTB.Text.Trim().Length == 4)
            {
                return(true);
            }

            if (!MTB.MaskFull)
            {
                GF.Error("กรุณากรอก 'วันที่' ให้ครบ !!");
                MTB.Select();
                return(false);
            }

            string[] tmp   = MTB.Text.Split('/');
            int      day   = Convert.ToInt32(tmp[0]);
            int      month = Convert.ToInt32(tmp[1]);
            int      year  = Convert.ToInt32(tmp[2]) - 543;

            if (day <= 0)
            {
                GF.Error("วันที่ ต้องมากกว่า 1 !!");
                MTB.Select();
                return(false);
            }

            if (month <= 0 || month > 12)
            {
                GF.Error("เดือน ต้องอยู่ระหว่าง 1-12 !!");
                MTB.Select();
                return(false);
            }

            if (year <= 0 || year > 9999)
            {
                GF.Error("ปี ต้องอยู่ระหว่าง 1-9999 !!");
                MTB.Select();
                return(false);
            }

            if (day > DateTime.DaysInMonth(year, month))
            {
                GF.Error("ปี " + (year + 543).ToString() + " เดือน " + month.ToString("00") + " มี " + DateTime.DaysInMonth(year, month).ToString("00") + " วัน !!");
                MTB.Select();
                return(false);
            }
            return(true);
        }
Exemplo n.º 20
0
 public static void getImage(string pictureFile, ref PictureBox picture, string FTPfolderName)
 {
     if (File.Exists(pictureFile))
     {
         tmpImg        = Image.FromFile(pictureFile);
         picture.Image = tmpImg;
     }
     else
     {
         picture.Image = FTP.download(FTPfolderName, pictureFile);
         if (picture.Image == null)
         {
             GF.Error("ไม่พบไฟล์รูป บน Server !!\r\nกรุณาถ่ายรูปอีกครั้ง !!");
         }
     }
 }
Exemplo n.º 21
0
        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();
        }
Exemplo n.º 22
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();
        }
Exemplo n.º 23
0
        public void calculateExpiryDate()
        {
            if (string.IsNullOrEmpty(start_date.Text.Replace(" ", "").Replace("/", "").Trim()))
            {
                expiry_date.Text = "-";
                return;
            }

            if (start_date.Text.Trim().Length < 10)
            {
                expiry_date.Text = "-";
                return;
            }

            if (string.IsNullOrEmpty(age.Text.Trim()))
            {
                expiry_date.Text = "-";
                return;
            }

            if (Convert.ToInt32(age.Text.Trim()) <= 0)
            {
                expiry_date.Text = "-";
                return;
            }

            int months = Convert.ToInt32(age.Text.Trim());

            string[] tmpDate = start_date.Text.Split('/');

            if (!DateTime.TryParse(((Convert.ToInt32(tmpDate[2]) - 543)).ToString("0000") + "-" + Convert.ToInt32(tmpDate[1]).ToString("00") + "-" + Convert.ToInt32(tmpDate[0]).ToString("00"), out var DateStart))
            {
                string errTxt = "วัน เดือน ปี ไม่อยู่ในรูปแบบที่ถูกต้อง !\r\nค่าปัจจุบัน : " + start_date;
                GF.printError("***" + errTxt + "*** (DateTime.TryParse @ member_pt.calculateExpiryDate)");
                //GF.submitErrorLog();
                GF.Error(errTxt);
                return;
            }

            DateTime DateEnd = DateStart.AddMonths(months).AddDays(-1);

            expiry_date.Text = DateEnd.Day.ToString("00") + "/" + DateEnd.Month.ToString("00") + "/" + (DateEnd.Year + 543).ToString("0000");
        }
Exemplo n.º 24
0
        private void manage_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(branch_name.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ชื่อเต็ม สาขา' !!");
                branch_name.Select();
                return;
            }

            if (string.IsNullOrEmpty(prefix.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ตัวย่อ' !!");
                prefix.Select();
                return;
            }

            if (string.IsNullOrEmpty(company_name.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ชื่อบริษัท' !!");
                company_name.Select();
                return;
            }

            if (string.IsNullOrEmpty(address.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ที่อยู่' !!");
                address.Select();
                return;
            }

            if (string.IsNullOrEmpty(tax_id.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'เลขประจำตัวผู้เสียภาษี' !!");
                tax_id.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "branch_name", branch_name.Text.Trim() },
                { "prefix", prefix.Text.Trim() },
        private void save_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(member_type_name.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ชื่อประเภทสมาชิก' !!");
                member_type_name.Select();
                return;
            }

            if (string.IsNullOrEmpty(month_amount.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'อายุ' !!");
                month_amount.Select();
                return;
            }

            if (Convert.ToInt32(month_amount.Text.Trim()) <= 0)
            {
                GF.Error("'อายุ' ต้องมากกว่า 0 !!");
                month_amount.Select();
                return;
            }

            if (string.IsNullOrEmpty(price.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ราคา' !!");
                price.Select();
                return;
            }

            if (Convert.ToInt32(price.Text.Trim()) <= 0)
            {
                GF.Error("'ราคา' ต้องมากกว่า 0 !!");
                price.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "member_type_name", member_type_name.Text.Trim() },
                { "month_amount", month_amount.Text.Trim() },
Exemplo n.º 26
0
        private void save_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(product_name.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ชื่อสินค้า' !!");
                product_name.Select();
                return;
            }

            if (string.IsNullOrEmpty(price.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'ราคา' !!");
                price.Select();
                return;
            }

            if (Convert.ToInt32(price.Text.Trim()) <= 0)
            {
                GF.Error("'ราคา' ต้องมากกว่า 0 !!");
                price.Select();
                return;
            }

            if (string.IsNullOrEmpty(alert_amount.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'แจ้งเตือนเมื่อคงเหลือ' !!");
                alert_amount.Select();
                return;
            }

            if (Convert.ToInt32(alert_amount.Text.Trim()) <= 0)
            {
                GF.Error("'แจ้งเตือนเมื่อคงเหลือ' ต้องมากกว่า 0 !!");
                alert_amount.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "product_name", product_name.Text.Trim() },
                { "price", price.Text.Trim() },
Exemplo n.º 27
0
        private void manage_btn_Click(object sender, EventArgs e)
        {
            if (trainer_emp_id.SelectedIndex == 0)
            {
                GF.Error("ยังไม่ได้เลือก 'เทรนเนอร์' !!");
                trainer_emp_id.Select();
                return;
            }

            if (job_date.Text.Trim().Length < 10)
            {
                GF.Error("ยังไม่ได้กรอก 'วันที่'\r\nหรือ ยังกรอกไม่ครบ !!");
                job_date.Select();
                return;
            }

            if (start_time.Text.Trim().Length < 5)
            {
                GF.Error("ยังไม่ได้กรอก 'เวลาเริ่มต้น'\r\nหรือ ยังกรอกไม่ครบ !!");
                start_time.Select();
                return;
            }

            if (end_time.Text.Trim().Length < 5)
            {
                GF.Error("ยังไม่ได้กรอก 'เวลาสิ้นสุด'\r\nหรือ ยังกรอกไม่ครบ !!");
                end_time.Select();
                return;
            }

            if (string.IsNullOrEmpty(detail.Text.Trim()))
            {
                GF.Error("ยังไม่ได้กรอก 'รายละเอียด' !!");
                detail.Select();
                return;
            }

            Dictionary <string, string> values = new()
            {
                { "trainer_emp_id", (trainer_emp_id.SelectedItem as ComboItem).Key.ToString() },
                { "job_date", job_date.Text.Trim() },
Exemplo n.º 28
0
        public static bool validateCardExpiry(MaskedTextBox MTB)
        {
            if (!MTB.MaskFull)
            {
                GF.Error("กรุณากรอก 'วันหมดอายุบัตร' ให้ครบ !!");
                MTB.Select();
                return(false);
            }

            string[] tmp   = MTB.Text.Split('/');
            var      month = Convert.ToInt32(tmp[0]);

            if (month <= 0 || month > 12)
            {
                GF.Error("เดือน ต้องอยู่ระหว่าง 1-12 !!");
                MTB.Select();
                return(false);
            }

            return(true);
        }
Exemplo n.º 29
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();
        }
Exemplo n.º 30
0
        private void add_payment_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(price.Text.Trim()))
            {
                GF.Error("กรุณาระบุ 'ราคา' ก่อน !!");
                price.Select();
                return;
            }

            calculatePaid();
            if (Convert.ToInt32(GF.removeCommaDotFromNumber(total_payment_txt.Text.Trim())) == Convert.ToInt32(price.Text.Trim()))
            {
                GF.Error("ชำระเงินครบแล้ว !!");
                return;
            }
            using member_pt_payment memberPTPayment = new();
            memberPTPayment.max_amount = Convert.ToInt32(price.Text.Trim()) - totalPaid;
            memberPTPayment.Owner      = this;
            memberPTPayment.ShowDialog();
            this.BringToFront();
            this.Activate();
        }