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() },
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); }
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() },
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กรุณาถ่ายรูปอีกครั้ง !!"); } } }
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 member_picture_FormClosing(object sender, FormClosingEventArgs e) { if (cam != null) { cam.Dispose(); } if (isCameraRunning) { return; } if (picture.Image != null) { var pictureFilename = member_no.Trim() + "_" + new Random().Next(100000, 999999).ToString("000000") + ".jpg"; var destRect = new Rectangle(0, 0, 240, 180); var destImage = new Bitmap(240, 180); destImage.SetResolution(picture.Image.HorizontalResolution, picture.Image.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; var wrapMode = new ImageAttributes(); wrapMode.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY); graphics.DrawImage(picture.Image, destRect, 0, 0, picture.Image.Width, picture.Image.Height, GraphicsUnit.Pixel, wrapMode); wrapMode.Dispose(); } destImage.Save(GF.Settings("tmp_path") + pictureFilename, System.Drawing.Imaging.ImageFormat.Jpeg); (this.Owner as member_manage).picture.Image = destImage; (this.Owner as member_manage).pictureFilename = pictureFilename; (this.Owner as member_manage).isPictureChanged = true; this.Close(); } }
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() },
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"); }
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(); }
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(); }
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") },
public static void addPaymentRow(DataGridView DGV, string[] Data, string payment_type_int) { int index = -1; string payment_type_colName = ""; foreach (DataGridViewColumn DGVC in DGV.Columns) { if (DGVC.Name.IndexOf("payment_type") != -1 && DGVC.Index > 0) { payment_type_colName = DGVC.Name; break; } } foreach (DataGridViewRow DGVR in DGV.Rows) { if (payment_type_int == "0" && DGVR.Cells[payment_type_colName].Value.ToString() == payment_type_int) { index = DGVR.Index; break; } if (payment_type_int == "1" && !string.IsNullOrEmpty(Data[2]) && !string.IsNullOrEmpty(Data[3]) && (DGVR.Cells[payment_type_colName].Value ?? "").ToString() == payment_type_int) { if ((DGVR.Cells[2].Value ?? "").ToString() == Data[2] && (DGVR.Cells[3].Value ?? "").ToString() == Data[3]) { index = DGVR.Index; break; } } } if (index == -1) { DGV.Rows.Add(Data); } else { DataGridViewRow DGVR = DGV.Rows[index]; DGVR.Cells[1].Value = (Convert.ToInt32(GF.removeCommaDotFromNumber(DGVR.Cells[1].Value.ToString())) + Convert.ToInt32(GF.removeCommaDotFromNumber(Data[1]))).ToString(); } }
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() },
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() },
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() },
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); }
void newBill() { print_btn.Visible = false; product_DGV.Rows.Clear(); product_DGV.Enabled = true; calculateGrandTotal(); payment_DGV.Rows.Clear(); payment_DGV.Enabled = true; calculatePaid(); bill_search_btn.Text = "ค้นหาใบเสร็จ"; product_code.Enabled = true; GF.enableBtn(add_product_btn, Color.FromArgb(255, 128, 0)); GF.enableBtn(add_payment_btn, Color.FromArgb(255, 128, 0)); GF.enableBtn(manage_btn, Color.Green); void_btn.Visible = false; void_txt.Visible = false; }
public static Dictionary <string, object> Post(string url, Dictionary <string, string> values = null) { string requestUri = "http://" + GF.Settings("host_url") + "/" + url; Console.WriteLine("URL : " + requestUri); string postData = string.Empty; byte[] postBytes = null; if (values != null) { foreach (KeyValuePair <string, string> obj in values) { string theValue = (obj.Value ?? "").Replace("'", "''"); Console.WriteLine(obj.Key + " = " + theValue); postData += obj.Key + "=" + theValue + "&"; } if (postData.Trim().Length > 0) { postData = postData[0..^ 1];
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { GF.closeLoading(); Exception ex = (Exception)e.ExceptionObject; GF.printError("********** FATAL UNHANDLED EXCEPTION ERROR *********"); GF.printError("[" + ex.TargetSite.ToString() + "]"); GF.printError(ex.ToString() + "\r\n"); GF.printError("FILE : " + new StackTrace(ex, true).GetFrame(0).GetFileName()); GF.printError("LINE : " + new StackTrace(ex, true).GetFrame(0).GetFileLineNumber()); GF.printError("STACK-TRACE : \r\n" + ex.StackTrace.ToString() + "\r\n"); waitHandle.WaitOne(); /*MessageBox.Show("Whoops! Please contact the developers with the following" + " information:\n\n" + ex.Message + ex.StackTrace, + "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);*/ } finally { foreach (Process theProcess in Process.GetProcessesByName("EXCEL")) { theProcess.Kill(); } if (currentProcess != null) { foreach (Process theProcess in Process.GetProcessesByName("FAMS")) { theProcess.Kill(); } } System.Environment.Exit(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 member_manage_FormClosing(object sender, FormClosingEventArgs e) { if (picture.Image != null) { picture.Image.Dispose(); } if (GF.tmpImg != null) { GF.tmpImg.Dispose(); } var downloadedMessageInfo = new DirectoryInfo(GF.Settings("tmp_path")); foreach (FileInfo file in downloadedMessageInfo.GetFiles()) { file.Delete(); } /*if (!string.IsNullOrEmpty(pictureFilename.Trim())) * if (File.Exists(GF.Settings("tmp_path + pictureFilename)) * File.Delete(GF.Settings("tmp_path + pictureFilename);*/ }
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(); }
public member_picture(string _member_no) { InitializeComponent(); member_no = _member_no; hasCamera = !(string.IsNullOrEmpty(GF.Settings("capDevice")) || GF.Settings("capDevice") == "ไม่มี"); if (!hasCamera) { GF.Error("ต้องเลือกกล้อง WebCam ก่อน !"); return; } Rectangle screenRectangle = RectangleToScreen(this.ClientRectangle); int titleHeight = screenRectangle.Top - this.Top; this.Width = Global.Capture.VIDEOWIDTH; this.Height = Global.Capture.VIDEOHEIGHT + titleHeight; //Console.WriteLine(manager.CurrentCamera.CaptureWidth.ToString() + " x " + manager.CurrentCamera.CaptureHeight.ToString()); cam.Render(pb); isCameraRunning = true; }
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;
public employee_manage() { InitializeComponent(); Dictionary <string, string> values = new() { { "user_id", GF.userID } }; Dictionary <string, object> Obj = DB.Post("Branch/BranchList/", values); if (Obj != null) { 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())); } } } branch_id.SelectedIndex = 0; GF.resizeComboBox(branch_id); }
public static bool delete(string folderName, string fileName) { bool boolReturn = false; Console.WriteLine("FTP :: DELETING FILE [" + fileName + "] ..."); FtpWebRequest request = open(WebRequestMethods.Ftp.DeleteFile, folderName, fileName); if (request != null) { FtpWebResponse response = (FtpWebResponse)request.GetResponse(); if (response.StatusCode == FtpStatusCode.FileActionOK) { boolReturn = true; } else { GF.Error("(" + response.StatusCode.ToString() + ") " + response.StatusDescription); Console.WriteLine("FTP :: FILE [" + fileName + "] DELETE FAILED !! (" + response.StatusCode.ToString() + ") " + response.StatusDescription); boolReturn = false; } } Console.WriteLine("FTP :: FILE [" + fileName + "] DELETE SUCCEEDED !!"); return(boolReturn); }
private void stock_btn_Click(object sender, EventArgs e) { GF.closeChildren(new product_stock()); }
private void config_product_btn_Click(object sender, EventArgs e) { GF.closeChildren(new config_product()); }