private bool check() { string msg = ""; bool isEmpty = false; if (string.IsNullOrEmpty(txtName.Text)) { msg = "欄位不能為空值!"; isEmpty = true; } if (!isEmpty && !string.IsNullOrEmpty(txtIndex.Text) && txtIndex.Text != "0") { PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.category.ToString(), ddlCategory.SelectedItem.ToString()); view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.index.ToString(), txtIndex.Text); if (view.calculateCount() > 0) { msg = "排序已存在!請重新選擇!"; } } if (!string.IsNullOrEmpty(msg)) { APConfig.SweetAlert(ShowBoxType.alert, msg); } return(string.IsNullOrEmpty(msg) ? true : false); }
private void phraseLoadData() { dgvPhrase.Rows.Clear(); DataGridViewRowCollection rows = dgvPhrase.Rows; PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.category.ToString(), ddlPhraseCategory.SelectedItem.ToString()); if (!string.IsNullOrEmpty(txtPhraseName.Text)) { view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.name.ToString(), txtPhraseName.Text); } if (!string.IsNullOrEmpty(txtPhraseType.Text)) { view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.type.ToString(), txtPhraseType.Text); } if (view.load()) { while (!view.IsEof) { rows.Add(new Object[] { view.PHS_SERNO, view.PHS_NAME, view.PHS_TYPE, view.PHS_INDEX }); view.next(); } } lblPhraseTotal.Text = view.calculateCount().ToString(); }
private void ItemSearch() { lbxItem.Items.Clear(); PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.category.ToString(), PhraseCategory.銷售商品資訊.ToString()); if (!string.IsNullOrEmpty(txtName.Text)) { view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.name.ToString(), txtName.Text); } view.load(); while (!view.IsEof) { lbxItem.Items.Add(view.PHS_TYPE + view.PHS_NAME); view.next(); } }
private void ItemSearch() { dgvItem.Rows.Clear(); DataGridViewRowCollection rows = dgvItem.Rows; PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.category.ToString(), PhraseCategory.商品資訊.ToString()); if (!string.IsNullOrEmpty(txtName.Text)) { view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.name.ToString(), txtName.Text); } view.load(); while (!view.IsEof) { rows.Add(new Object[] { view.PHS_NAME, view.PHS_TYPE, view.PHS_COLOR, view.PHS_SIZE }); view.next(); } }
private void initView() { if (mode == mode.Add) { btnOK.ButtonText = "新增"; btnOK.IdleFillColor = Color.FromArgb(33, 166, 117); btnOK.IdleLineColor = Color.FromArgb(33, 166, 117); btnOK.ActiveFillColor = Color.FromArgb(33, 166, 117); btnOK.ActiveLineColor = Color.FromArgb(33, 166, 117); } else if (mode == mode.Edit) { btnOK.ButtonText = "修改"; btnOK.IdleFillColor = Color.FromArgb(255, 161, 0); btnOK.IdleLineColor = Color.FromArgb(255, 161, 0); btnOK.ActiveFillColor = Color.FromArgb(255, 161, 0); btnOK.ActiveLineColor = Color.FromArgb(255, 161, 0); ddlCategory.Enabled = false; PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.serno.ToString(), serno); if (view.load()) { txtName.Text = view.PHS_NAME; txtIndex.Text = view.PHS_INDEX.ToString(); txtType.Text = view.PHS_TYPE; txtColor.Text = view.PHS_COLOR; txtSize.Text = view.PHS_SIZE; APConfig.getSelectIndex(ddlCategory, view.PHS_CATEGORY); } } else if (mode == mode.View) { DisableControls(); btnOK.ButtonText = "確認"; PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.serno.ToString(), serno); if (view.load()) { txtName.Text = view.PHS_NAME; txtIndex.Text = view.PHS_INDEX.ToString(); txtType.Text = view.PHS_TYPE; txtColor.Text = view.PHS_COLOR; txtSize.Text = view.PHS_SIZE; APConfig.getSelectIndex(ddlCategory, view.PHS_CATEGORY); } } }
private bool check() { string msg = ""; bool isEmpty = false; if (string.IsNullOrEmpty(txtName.Text)) { msg = "欄位不能為空值!"; isEmpty = true; } if (!isEmpty) { PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.category.ToString(), ddlCategory.SelectedItem.ToString()); view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.EQname.ToString(), txtName.Text); if (isItem) { view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.EQsize.ToString(), txtSize.Text); view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.EQtype.ToString(), txtType.Text); view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.EQcolor.ToString(), txtColor.Text); } if (view.calculateCount() > 0) { msg = "項目已存在!請確認!"; } } if (!string.IsNullOrEmpty(msg)) { APConfig.SweetAlert(ShowBoxType.alert, msg); } return(string.IsNullOrEmpty(msg) ? true : false); }
public static ComboBox loadPhrase(ComboBox c, string category, bool isALL = false) { c.Items.Clear(); if (isALL) { c.Items.Add("全部"); } PhraseInfo view = new PhraseInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(PhraseInfo.ncConditions.category.ToString(), category); view.load(); while (!view.IsEof) { c.Items.Add(view.PHS_NAME); view.next(); } return(c); }