public static void FILL_COMBOBOX(hyflexComboBox CMB_CATEGORY, string QRY, string DisplayMember, string ValueMember, int SelectedIndex) { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter(QRY, CONNECTION.CON)) { DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { CMB_CATEGORY.DataSource = DT; CMB_CATEGORY.DisplayMember = DisplayMember; CMB_CATEGORY.ValueMember = ValueMember; CMB_CATEGORY.SelectedIndex = SelectedIndex; } else { CMB_CATEGORY.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } }
public static void LOAD_CATEGORY(hyflexComboBox CMB_CATEGORY) { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT categry_id,caegory_name FROM category", CONNECTION.CON)) { DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { CMB_CATEGORY.DataSource = DT; CMB_CATEGORY.DisplayMember = "caegory_name"; CMB_CATEGORY.ValueMember = "categry_id"; CMB_CATEGORY.SelectedIndex = -1; } else { CMB_CATEGORY.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } }
public static string GetServer() { try { string serverip = Application.StartupPath + "\\config.ini"; string ip; StreamReader oReader = new StreamReader(serverip); ip = null; if (File.Exists(serverip)) { ip = oReader.ReadToEnd(); oReader.Close(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "invalied ip address", MessageAlertImage.Warning()); mdg.ShowDialog(); Application.Exit(); } return(ip); } catch (Exception EX) { return(EX.Message); } }
public void MessageBox_Action(string szMsg, string szTitle, MSGBOX nType, string szAction) { m_szMessageBox_Type = (uint)nType; m_szMessageBox_Msg = szMsg; m_szMessageBox_Title = szTitle; m_szMessageBox_Action = szAction; }
private void rpt_customers_details_Load(object sender, EventArgs e) { try { String RES_NO = REPORT.RESERVATION_NO; ReportDocument cryRpt = new ReportDocument(); cryRpt.Load(Application.StartupPath + "\\reports\\RECEIPT.rpt"); ParameterFieldDefinitions crParameterFieldDefinitions; ParameterFieldDefinition crParameterFieldDefinition; ParameterValues crParameterValues = new ParameterValues(); ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue(); crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields; crParameterDiscreteValue.Value = RES_NO; crParameterFieldDefinition = crParameterFieldDefinitions["RESERVATION_NO"]; crParameterValues = crParameterFieldDefinition.CurrentValues; crParameterValues.Clear(); crParameterValues.Add(crParameterDiscreteValue); crParameterFieldDefinition.ApplyCurrentValues(crParameterValues); crystalReportViewer1.ReportSource = cryRpt; crystalReportViewer1.Refresh(); } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } }
private async Task ImportAsync() { string res = string.Empty; loadingCircle1.Visible = true; loadingCircle1.Size = new Size(75, 75); loadingCircle1.Active = true; btn_login.Enabled = false; await Task.Run(() => { res = login(); }); loadingCircle1.Active = false; loadingCircle1.Visible = false; loadingCircle1.Size = new Size(1, 1); btn_login.Enabled = true; if (res == "1") { UPDATE_LOGIN(); DASHBOARD d = new DASHBOARD(); d.Show(); this.Hide(); } else if (res == "0") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), "username or password invalied!", MessageAlertImage.Error()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), login(), MessageAlertImage.Alert()); mdg.ShowDialog(); } }
private void LOADCATEGORYlIST_SEARCH_BY_NAME(TextBox txt_cat_name) { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT categry_id,caegory_name FROM category where caegory_name LIKE @caegory_name", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@caegory_name", "%" + txt_category_name.Text + "%"); DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { DGV_CATEGORY.DataSource = DT; DGV_CATEGORY.AutoGenerateColumns = false; } else { DGV_CATEGORY.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } }
private void LOADCATEGORYlIST() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT categry_id,caegory_name FROM category", CONNECTION.CON)) { DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { DGV_CATEGORY.DataSource = DT; DGV_CATEGORY.AutoGenerateColumns = false; } else { DGV_CATEGORY.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } }
private void btn_save_ClickAsync(object sender, EventArgs e) { if (txt_category_name.Text.Length == 0) { txt_category_name.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER CATEGORY NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (btn_save.Text == "SAVE") { Cursor.Current = Cursors.WaitCursor; saveCategory(); LOADCATEGORYlIST(); if (DGV_CATEGORY.Rows.Count > 0) { DGV_CATEGORY.FirstDisplayedScrollingRowIndex = DGV_CATEGORY.RowCount - 1; } Cursor.Current = Cursors.Default; } else if (btn_save.Text == "UPDATE") { Cursor.Current = Cursors.WaitCursor; Updatecategory(); LOADCATEGORYlIST(); BTN_NEW.PerformClick(); Cursor.Current = Cursors.Default; } }
private void Updatecategory() { try { CONNECTION.open_connection(); using (MySqlCommand da = new MySqlCommand("UPDATE category SET caegory_name=@caegory_name WHERE categry_id=@categry_id", CONNECTION.CON)) { da.Parameters.Clear(); da.Parameters.AddWithValue("@categry_id", lbl_category.Text); da.Parameters.AddWithValue("@caegory_name", txt_category_name.Text); if (da.ExecuteNonQuery() > 0) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "CATEGORY UPDATED SUCCESFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "CATEGORY UPDATED SUCCESFULLY!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
//private async Task lOADgRIDVIEW() //{ // loadingCircle1.Visible = true; // loadingCircle1.Size = new Size(75, 75); // loadingCircle1.Active = true; // await Task.Run(() => { // LOADCATEGORYlIST(); // }); // loadingCircle1.Active = false; // loadingCircle1.Visible = false; // loadingCircle1.Size = new Size(1, 1); //} //private async Task SAVECATEGORY() //{ // loadingCircle1.Visible = true; // loadingCircle1.Size = new Size(75, 75); // loadingCircle1.Active = true; // btn_save.Enabled = false; // await Task.Run(() => { // res = saveCategory(); // }); // loadingCircle1.Active = false; // loadingCircle1.Visible = false; // loadingCircle1.Size = new Size(1, 1); // btn_save.Enabled = true; // BTN_NEW.Focus(); // txt_category_name.Clear(); // if (res == "1") // { // lbl_category.Text = GETMAXID(); // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY ADDED SUCCESFULLY!", MessageAlertImage.Warning()); // mdg.ShowDialog(); // } // else if (res == "0") // { // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY ADDED FAILED!", MessageAlertImage.Warning()); // mdg.ShowDialog(); // } // else // { // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), saveCategory(), MessageAlertImage.Alert()); // mdg.ShowDialog(); // } //} //private async Task UPDATE_CATEGORY_NAME() //{ // loadingCircle1.Visible = true; // loadingCircle1.Size = new Size(75, 75); // loadingCircle1.Active = true; // btn_save.Enabled = false; // await Task.Run(() => { // res = updatecategory(); // // LOADCATEGORYlIST(); // }); // loadingCircle1.Active = false; // loadingCircle1.Visible = false; // loadingCircle1.Size = new Size(1, 1); // btn_save.Enabled = true; // BTN_NEW.Focus(); // txt_category_name.Clear(); // lbl_category.Text = "N/A"; // btn_save.Text = "SAVE"; // if (res == "1") // { // lbl_category.Text = GETMAXID(); // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY UPDATED SUCCESFULLY!", MessageAlertImage.Warning()); // mdg.ShowDialog(); // } // else if (res == "0") // { // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY UPDATED FAILED!", MessageAlertImage.Warning()); // mdg.ShowDialog(); // } // else // { // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), saveCategory(), MessageAlertImage.Alert()); // mdg.ShowDialog(); // } //} private void saveCategory() { try { CONNECTION.open_connection(); using (MySqlCommand da = new MySqlCommand("INSERT INTO category(caegory_name) VALUES(@caegory_name)", CONNECTION.CON)) { da.Parameters.Clear(); da.Parameters.AddWithValue("@caegory_name", txt_category_name.Text); if (da.ExecuteNonQuery() > 0) { lbl_category.Text = GETMAXID(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "CATEGORY ADDED SUCCESFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "CATEGORY ADDED FAILED!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
public static double GetTotalTaxPercentage() { try { using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT IFNULL(SUM(precentage),0.00) FROM tax_details", CONNECTION.CON)) { DataTable tbl = new DataTable(); adp.Fill(tbl); if (tbl.Rows.Count > 0) { return(tbl.Rows[0].Field <double>(0)); } else { return(0); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); return(0); } }
public void MessageBox(string szMsg, string szTitle, MSGBOX nType, string szURL) { string szAction = ""; if (!string.IsNullOrEmpty(szURL)) { szAction = "location.href='" + szURL + "';"; } MessageBox_Action(szMsg, szTitle, nType, szAction); }
private async void shapedButton1_Click(object sender, EventArgs e) { if (txt_uname.Text.Length == 0) { pb_u_warning.Visible = true; txt_uname.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "Please enter username", MessageAlertImage.Success()); mdg.ShowDialog(); } else if (txt_pass.Text.Length == 0) { pb_p_warning.Visible = true; txt_pass.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "Please enter password", MessageAlertImage.Alert()); mdg.ShowDialog(); } else { pb_u_warning.Visible = false; pb_u_warning.Visible = false; await ImportAsync(); } }
public void MessageBox(string szMsg, string szTitle, MSGBOX nType, MSGBOX_ACTION nBack) { string szAction = ""; if (nBack == MSGBOX_ACTION.BACK) { //szAction = "history.go(-2);"; string szUrl = PopHistory(); if (szUrl != null) { szAction = "location.href='" + szUrl + "';"; } } else if (nBack == MSGBOX_ACTION.OK) { szAction = "Dlg_OK()"; } else if (nBack == MSGBOX_ACTION.CANCEL) { szAction = "Dlg_Cancel()"; } MessageBox_Action(szMsg, szTitle, nType, szAction); }
public void MessageBox(string szMsg, string szTitle, MSGBOX nType) { MessageBox_Action(szMsg, szTitle, nType, null); }