Esempio n. 1
0
        private void itemInfoAdd()
        {
            #region 判斷
            string msg = "";
            if (string.IsNullOrEmpty(txtAmount.Text))
            {
                msg = "請輸入金額";
            }
            else if (!int.TryParse(txtAmount.Text, out int n))
            {
                msg = "金額欄位請輸入數字";
            }
            else if (string.IsNullOrEmpty(txtName.Text))
            {
                msg = "請選擇商品資訊";
            }

            if (!string.IsNullOrEmpty(msg))
            {
                APConfig.SweetAlert(ShowBoxType.alert, msg);
                return;
            }
            #endregion
            DataGridViewRowCollection rows = dgvItem.Rows;
            rows.Add(new Object[] { ddlVendor.SelectedItem.ToString(), txtName.Text, txtType.Text, txtColor.Text, txtSize.Text, txtAmount.Text, dpkImportDTTM.Value.ToShortDateString(), txtComment.Text });
            clearPage();
            loadTotalAmount();
        }
Esempio n. 2
0
        private void itemInfoAdd()
        {
            #region 判斷
            string msg = "";
            if (string.IsNullOrEmpty(serno))
            {
                msg = "請選取進貨單!";
            }
            else if (string.IsNullOrEmpty(txtExportAmount.Text))
            {
                msg = "請輸入出貨金額";
            }
            else if (!int.TryParse(txtExportAmount.Text, out int n))
            {
                msg = "出貨金額欄位請輸入數字";
            }
            else if (dpkExportDTTM.Value < dpkImportDTTM.Value)
            {
                msg = "出貨日期無法小於進貨日期!";
            }

            if (!string.IsNullOrEmpty(msg))
            {
                APConfig.SweetAlert(ShowBoxType.alert, msg);
                return;
            }
            #endregion
            DataGridViewRowCollection rows = dgvItem.Rows;
            rows.Add(new Object[] { serno, txtCode.Text, txtName.Text, txtType.Text, txtColor.Text, txtExportAmount.Text, ddlDealer.SelectedItem.ToString(), dpkExportDTTM.Value.ToShortDateString(), txtExportComment.Text });
            clearTextBox();
            loadTotalAmount();
        }
Esempio n. 3
0
        private void dgvItem_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row    = this.dgvItem.SelectedRows[0];
            string          status = row.Cells["dgvItem_Status"].Value.ToString();

            if (status == InventoryStatus.已出貨.ToString())
            {
                this.Hide();
                InventoryExportEdit form = new InventoryExportEdit(mode, row.Cells["dgvItem_Serno"].Value.ToString());
                form.ShowDialog();
                this.Close();
            }
            else if (status == InventoryStatus.庫存中.ToString())
            {
                this.Hide();
                InventoryImportEdit form = new InventoryImportEdit(mode, row.Cells["dgvItem_Serno"].Value.ToString());
                form.ShowDialog();
                this.Close();
            }
            else if (status == InventoryStatus.已退貨.ToString())
            {
                this.Hide();
                InventoryReturnEdit form = new InventoryReturnEdit(mode, row.Cells["dgvItem_Serno"].Value.ToString());
                form.ShowDialog();
                this.Close();
            }
            else
            {
                APConfig.SweetAlert(ShowBoxType.alert, "請聯繫Hugo!");
                this.Close();
            }
        }
Esempio n. 4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         dgvInventory.EndEdit();
         List <string> sernolist    = new List <string>();
         string        delSernoList = "";
         foreach (DataGridViewRow row in dgvInventory.Rows)
         {
             DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[1];
             if ((bool)chk.Value)
             {
                 sernolist.Add(row.Cells["dgvInventory_Serno"].Value.ToString());
             }
         }
         delSernoList = APConfig.sqlArrayFormat(string.Join(",", sernolist));
         Inventory ent         = new Inventory(APConfig.Conn);
         string    sConditions = ent.getCondition(Inventory.ncConditions.sernolist.ToString(), delSernoList);
         ent.deleteAll(sConditions);
         APConfig.SweetAlert(ShowBoxType.alert, "刪除完成");
         this.Close();
     }
     catch (Exception ex)
     {
         APConfig.SweetAlert(ShowBoxType.alert, string.Format("刪除失敗 {0}", ex.Message));
     }
 }
Esempio n. 5
0
 private void login()
 {
     if (checkLogin())
     {
         AccountInfo view = new AccountInfo(APConfig.Conn);
         view.Conditions = view.getCondition(AccountInfo.ncConditions.ACCOUNT.ToString(), txtLoginAccount.Text);
         if (view.load())
         {
             if (view.ACT_PASSWORD != txtLoginPassword.Text)
             {
                 APConfig.SweetAlert(ShowBoxType.alert, "密碼錯誤!");
             }
             else
             {
                 APConfig.AccountName = view.ACT_NAME;
                 APConfig.SweetAlert(ShowBoxType.alert, string.Format("歡迎使用!\r\n{0}", view.ACT_NAME));
                 this.Hide();
                 Main form = new Main();
                 form.ShowDialog();
                 this.Close();
             }
         }
         else
         {
             APConfig.SweetAlert(ShowBoxType.alert, "查無此帳號!");
         }
     }
 }
Esempio n. 6
0
        private void btnInventoryDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvInventory.SelectedRows.Count > 0)
                {
                    List <string> sernolist    = new List <string>();
                    string        delSernoList = "";
                    foreach (DataGridViewRow row in dgvInventory.SelectedRows)
                    {
                        sernolist.Add(row.Cells["dgvInventory_Serno"].Value.ToString());
                    }
                    delSernoList = APConfig.sqlArrayFormat(string.Join(",", sernolist));

                    using (var form = new PickInventoryDelete(mode.View, delSernoList))
                    {
                        panelInventory.Visible = false;
                        panelMask.Visible      = true;
                        var result = form.ShowDialog();
                        panelInventory.Visible = true;
                        panelMask.Visible      = false;
                    }
                    inventoryLoadData(ddlInventoryPage.SelectedIndex + 1);
                }
            }
            catch (Exception ex)
            {
                APConfig.SweetAlert(ShowBoxType.alert, string.Format("刪除失敗 {0}", ex.Message));
            }
        }
Esempio n. 7
0
 private void btnInventoryLeft_Click(object sender, EventArgs e)
 {
     if (APConfig.prevPage(ref ddlInventoryPage))
     {
         inventoryLoadData(ddlInventoryPage.SelectedIndex + 1);
     }
 }
Esempio n. 8
0
 private void phraseInitial()
 {
     APConfig.loadEnum <PhraseCategory>(ddlPhraseCategory);
     dgvPhrase.Rows.Clear();
     txtPhraseName.Text  = string.Empty;
     lblPhraseTotal.Text = "0";
 }
Esempio n. 9
0
 private void inventoryInitial()
 {
     dgvInventory.Rows.Clear();
     APConfig.loadPhrase(ddlInventoryDealer, PhraseCategory.負責人.ToString(), true);
     APConfig.loadPhrase(ddlInventoryVendor, PhraseCategory.供應商.ToString(), true);
     APConfig.loadEnum <InventoryStatus>(ddlInventoryStatus, "", true);
     txtInventoryName.Text            = string.Empty;
     ckbInventoryINDTTM.Checked       = false;
     ckbInventoryOUTDTTM.Checked      = false;
     ckbInventoryRETURNDTTM.Checked   = false;
     ddlInventoryVendor.SelectedIndex = 0;
     ddlInventoryDealer.SelectedIndex = 0;
     ddlInventoryStatus.SelectedIndex = 0;
     dpkInventoryINSDTTM.Value        = DateTime.Today;
     dpkInventoryINEDTTM.Value        = DateTime.Today;
     dpkInventoryOUTEDTTM.Value       = DateTime.Today;
     dpkInventoryOUTSDTTM.Value       = DateTime.Today;
     dpkInventoryRETURNSDTTM.Value    = DateTime.Today;
     dpkInventoryRETURNEDTTM.Value    = DateTime.Today;
     lblInventoryINAMT.Text           = "0 元";
     lblInventoryOUTAMT.Text          = "0 元";
     lblInventoryRETURNAMT.Text       = "0 元";
     lblInventoryNETTotal.Text        = "0 元";
     lblInventoryTotal.Text           = "0";
     ddlInventoryPage.Items.Clear();
 }
Esempio n. 10
0
 private void btnPhraseDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvPhrase.SelectedRows.Count > 0 && APConfig.SweetAlert(ShowBoxType.confirm, string.Format("是否確定要刪除{0}筆?", dgvPhrase.SelectedRows.Count)))
         {
             List <string> sernolist    = new List <string>();
             string        delSernoList = "";
             foreach (DataGridViewRow row in dgvPhrase.SelectedRows)
             {
                 sernolist.Add(string.Format("'{0}'", row.Cells["dgvPhrase_Serno"].Value.ToString()));
             }
             delSernoList = string.Join(",", sernolist);
             Phrase ent         = new Phrase(APConfig.Conn);
             string sConditions = ent.getCondition(Phrase.ncConditions.sernolist.ToString(), delSernoList);
             ent.deleteAll(sConditions);
             phraseLoadData();
             APConfig.SweetAlert(ShowBoxType.alert, "刪除完成");
         }
     }
     catch (Exception ex)
     {
         APConfig.SweetAlert(ShowBoxType.alert, string.Format("刪除失敗 {0}", ex.Message));
     }
 }
Esempio n. 11
0
 public PickInventoryVendor(mode pmode, string pSernoList)
 {
     InitializeComponent();
     mode      = pmode;
     sernolist = APConfig.sqlArrayFormat(pSernoList);
     loadData();
 }
Esempio n. 12
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     if (APConfig.SweetAlert(ShowBoxType.confirm, "確定要離開嗎?"))
     {
         this.Close();
         Environment.Exit(Environment.ExitCode);
     }
 }
Esempio n. 13
0
 public InventoryImportEdit(mode pmode, string pserno = "")
 {
     InitializeComponent();
     APConfig.loadPhrase(ddlVendor, PhraseCategory.供應商.ToString());
     serno = pserno;
     mode  = pmode;
     initView();
 }
Esempio n. 14
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (mode == mode.Add && checkAdd())
     {
         int count = 0;
         foreach (DataGridViewRow row in dgvItem.Rows)
         {
             Inventory ent = new Inventory(APConfig.Conn);
             ent.INV_SERNO    = row.Cells["dgvItem_Serno"].Value.ToString();
             ent.ModifyFields = string.Format("{0};{1};{2};{3};{4};{5}"
                                              , Inventory.ncFields.INV_STATUS.ToString()
                                              , Inventory.ncFields.INV_RETURNAMT.ToString()
                                              , Inventory.ncFields.INV_RETURNDTTM.ToString()
                                              , Inventory.ncFields.INV_RETURNCOMMENT.ToString()
                                              , Inventory.ncFields.INV_MODIFIEDBY.ToString()
                                              , Inventory.ncFields.INV_MODIFIEDDTTM.ToString());
             ent.INV_STATUS        = InventoryStatus.已退貨.ToString();
             ent.INV_RETURNAMT     = Convert.ToInt32(row.Cells["dgvItem_Amount"].Value);
             ent.INV_RETURNCOMMENT = row.Cells["dgvItem_Comment"].Value.ToString();
             ent.INV_RETURNDTTM    = DateTime.Parse(row.Cells["dgvItem_ImportDTTM"].Value.ToString());
             ent.INV_MODIFIEDBY    = APConfig.AccountName;
             ent.INV_MODIFIEDDTTM  = DateTime.Now;
             count += ent.update();
         }
         APConfig.SweetAlert(ShowBoxType.alert, string.Format("退貨完成!\r\n新增 {0} 件退貨單", count.ToString()));
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else if (mode == mode.Edit && checkAdd())
     {
         Inventory ent = new Inventory(APConfig.Conn);
         ent.INV_SERNO    = serno;
         ent.ModifyFields = string.Format("{0};{1};{2};{3};{4}"
                                          , Inventory.ncFields.INV_RETURNAMT.ToString()
                                          , Inventory.ncFields.INV_RETURNDTTM.ToString()
                                          , Inventory.ncFields.INV_RETURNCOMMENT.ToString()
                                          , Inventory.ncFields.INV_MODIFIEDBY.ToString()
                                          , Inventory.ncFields.INV_MODIFIEDDTTM.ToString());
         ent.INV_RETURNAMT     = Convert.ToInt32(txtReturnAmount.Text);
         ent.INV_RETURNDTTM    = DateTime.Parse(dpkReturnDTTM.Value.ToString());
         ent.INV_RETURNCOMMENT = txtReturnComment.Text;
         ent.INV_MODIFIEDBY    = APConfig.AccountName;
         ent.INV_MODIFIEDDTTM  = DateTime.Now;
         ent.update();
         APConfig.SweetAlert(ShowBoxType.alert, "修改完成");
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else if (mode == mode.View)
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         return;
     }
 }
Esempio n. 15
0
        private void dgvItem_DoubleClick(object sender, EventArgs e)
        {
            DataGridViewRow row = this.dgvItem.SelectedRows[0];

            ddlDealer.SelectedIndex = APConfig.getSelectIndex(ddlDealer, row.Cells["dgvItem_Dealer"].Value.ToString());
            txtExportAmount.Text    = row.Cells["dgvItem_Amount"].Value.ToString();
            dpkExportDTTM.Value     = Convert.ToDateTime(row.Cells["dgvItem_ImportDTTM"].Value);
            txtExportComment.Text   = row.Cells["dgvItem_Comment"].Value.ToString();
        }
Esempio n. 16
0
 public PhraseEdit(mode pmode, string pcategory, string pserno = "")
 {
     InitializeComponent();
     APConfig.loadEnum <PhraseCategory>(ddlCategory, pcategory);
     serno  = pserno;
     mode   = pmode;
     isItem = (pcategory == PhraseCategory.商品資訊.ToString());
     ItemShowColumns(isItem);
     initView();
 }
Esempio n. 17
0
        public Home()
        {
            InitializeComponent();
            APConfig.LoadConfig();
            AccountInfo view = new AccountInfo(APConfig.Conn);

            view.load();

            int a = view.Count;
        }
Esempio n. 18
0
        private void hugo()
        {
            APConfig.AccountName = "Hugo";
            APConfig.SweetAlert(ShowBoxType.alert, string.Format("歡迎使用!\r\n{0}", "HUGO"));
            this.Hide();
            Main form = new Main();

            form.ShowDialog();
            this.Close();
        }
Esempio n. 19
0
 private void btnItemDel_Click(object sender, EventArgs e)
 {
     if (APConfig.SweetAlert(ShowBoxType.confirm, "是否確定要刪除?"))
     {
         foreach (DataGridViewRow row in dgvItem.SelectedRows)
         {
             dgvItem.Rows.RemoveAt(row.Index);
         }
     }
     loadTotalCount();
 }
Esempio n. 20
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (mode == mode.Add && check())
     {
         Phrase ent = new Phrase(APConfig.Conn);
         ent.PHS_SERNO        = My.GenSerNo();
         ent.PHS_CATEGORY     = ddlCategory.SelectedItem.ToString();
         ent.PHS_NAME         = txtName.Text;
         ent.PHS_INDEX        = txtIndex.Text;
         ent.PHS_TYPE         = txtType.Text;
         ent.PHS_COLOR        = txtColor.Text;
         ent.PHS_SIZE         = txtSize.Text;
         ent.PHS_MODIFIEDBY   = APConfig.AccountName;
         ent.PHS_MODIFIEDDTTM = DateTime.Now;
         ent.insert();
         APConfig.SweetAlert(ShowBoxType.alert, "新增完成");
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else if (mode == mode.Edit && check())
     {
         Phrase ent = new Phrase(APConfig.Conn);
         ent.PHS_SERNO    = serno;
         ent.ModifyFields = string.Format("{0};{1};{2};{3},{4},{5},{6}"
                                          , Phrase.ncFields.PHS_NAME.ToString()
                                          , Phrase.ncFields.PHS_INDEX.ToString()
                                          , Phrase.ncFields.PHS_TYPE.ToString()
                                          , Phrase.ncFields.PHS_SIZE.ToString()
                                          , Phrase.ncFields.PHS_COLOR.ToString()
                                          , Phrase.ncFields.PHS_MODIFIEDBY.ToString()
                                          , Phrase.ncFields.PHS_MODIFIEDDTTM.ToString());
         ent.PHS_NAME         = txtName.Text;
         ent.PHS_INDEX        = txtIndex.Text;
         ent.PHS_TYPE         = txtType.Text;
         ent.PHS_COLOR        = txtColor.Text;
         ent.PHS_SIZE         = txtSize.Text;
         ent.PHS_MODIFIEDBY   = APConfig.AccountName;
         ent.PHS_MODIFIEDDTTM = DateTime.Now;
         ent.update();
         APConfig.SweetAlert(ShowBoxType.alert, "修改完成");
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else if (mode == mode.View)
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         return;
     }
 }
Esempio n. 21
0
        private bool checkLogin()
        {
            string msg     = "";
            string pattern = @"^[a-zA-Z0-9]+$"; //判斷只有英文數字

            if (!Regex.Match(txtLoginAccount.Text, pattern).Success || !Regex.Match(txtLoginPassword.Text, pattern).Success)
            {
                APConfig.SweetAlert(ShowBoxType.alert, "欄位內容只能包含英文數字!");
                return(false);
            }
            return(true);
        }
Esempio n. 22
0
        private void dgvItem_DoubleClick(object sender, EventArgs e)
        {
            DataGridViewRow row = this.dgvItem.SelectedRows[0];

            ddlVendor.SelectedIndex = APConfig.getSelectIndex(ddlVendor, row.Cells["dgvItem_Vendor"].Value.ToString());
            txtName.Text            = row.Cells["dgvItem_Name"].Value.ToString();
            txtType.Text            = row.Cells["dgvItem_Type"].Value.ToString();
            txtColor.Text           = row.Cells["dgvItem_Color"].Value.ToString();
            txtSize.Text            = row.Cells["dgvItem_Size"].Value.ToString();
            txtAmount.Text          = row.Cells["dgvItem_Amount"].Value.ToString();
            dpkImportDTTM.Value     = Convert.ToDateTime(row.Cells["dgvItem_ImportDTTM"].Value);
            txtComment.Text         = row.Cells["dgvItem_Comment"].Value.ToString();
        }
Esempio n. 23
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(checkSubmit()))
     {
         Account entAccount = new Account(APConfig.Conn);
         entAccount.ACT_SERNO      = My.GenSerNo();
         entAccount.ACT_NAME       = txtName.Text;
         entAccount.ACT_ACCOUNT    = txtAccount.Text;
         entAccount.ACT_PASSWORD   = txtPassword.Text;
         entAccount.ACT_CREATEDTTM = DateTime.Now;
         entAccount.insert();
         APConfig.SweetAlert(ShowBoxType.alert, "新增完成!");
     }
 }
Esempio n. 24
0
 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);
         }
     }
 }
Esempio n. 25
0
 public static ComboBox loadPage(ComboBox c, int maxPage)
 {
     c.Items.Clear();
     for (int i = 1; i <= maxPage; i++)
     {
         c.Items.Add(i.ToString());
     }
     if (c.Items.Count > 0)
     {
         c.SelectedIndex = 0;
     }
     else
     {
         APConfig.SweetAlert(ShowBoxType.alert, "查無資料");
     }
     return(c);
 }
Esempio n. 26
0
        private string checkSubmit()
        {
            string msg     = "";
            string pattern = @"^[a-zA-Z0-9]+$"; //判斷只有英文數字
            bool   isEmpty = false;

            foreach (Control pages in this.Controls)
            {
                if (pages is Panel)
                {
                    Panel panel = pages as Panel;
                    if (panel.Name.ToString() == "panelSubmit")
                    {
                        foreach (Control c in pages.Controls)
                        {
                            if (c is BunifuMetroTextbox)
                            {
                                BunifuMetroTextbox textBox = c as BunifuMetroTextbox;
                                if (textBox.Text == string.Empty)
                                {
                                    msg     = "欄位不能為空值!";
                                    isEmpty = true;
                                }
                                else if (!Regex.Match(textBox.Text, pattern).Success)
                                {
                                    msg     = "欄位內容只能包含英文數字!";
                                    isEmpty = true;
                                }
                            }
                        }
                    }
                }
            }

            if (!isEmpty && txtPassword.Text != txtPassword2.Text)
            {
                msg = "密碼輸入不相同!";
            }

            if (!string.IsNullOrEmpty(msg))
            {
                APConfig.SweetAlert(ShowBoxType.alert, msg);
            }
            return(msg);
        }
Esempio n. 27
0
        private void itemInfoAdd()
        {
            #region 判斷
            string msg = "";
            if (string.IsNullOrEmpty(serno))
            {
                msg = "請選取庫存!";
            }
            else if (string.IsNullOrEmpty(txtReturnAmount.Text))
            {
                msg = "請輸入退貨金額";
            }
            else if (!int.TryParse(txtReturnAmount.Text, out int n))
            {
                msg = "退貨金額欄位請輸入數字";
            }
            else if (dpkReturnDTTM.Value < dpkDTTM.Value)
            {
                msg = "出貨日期無法小於進貨日期!";
            }

            foreach (DataGridViewRow row in dgvItem.Rows)
            {
                if (serno == row.Cells["dgvItem_Serno"].Value.ToString())
                {
                    msg = "該筆資料已存在列表!";
                    break;
                }
            }

            if (!string.IsNullOrEmpty(msg))
            {
                APConfig.SweetAlert(ShowBoxType.alert, msg);
                return;
            }
            #endregion
            DataGridViewRowCollection rows = dgvItem.Rows;
            rows.Add(new Object[] { serno, txtCode.Text, txtName.Text, txtType.Text, txtColor.Text, txtReturnAmount.Text, dpkReturnDTTM.Value.ToShortDateString(), txtReturnComment.Text });
            clearPage();
            loadRowColor();
            loadTotalAmount();
        }
Esempio n. 28
0
        private void btnBackUp_Click(object sender, EventArgs e)
        {
            if (APConfig.SweetAlert(ShowBoxType.confirm, "是否確定要備份?"))
            {
                try
                {
                    SqlConnection conn = new SqlConnection(APConfig.Conn.getConnectionString());
                    SqlCommand    cmd  = new SqlCommand(string.Empty, conn);
                    conn.Open();

                    cmd.Parameters.Clear();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "sp_BackupData";

                    SqlParameter result = cmd.Parameters.Add("@result", SqlDbType.Int);
                    result.Direction = ParameterDirection.Output;

                    cmd.ExecuteNonQuery();
                    if (Convert.ToInt32(result.Value) == 1)
                    {
                        APConfig.SweetAlert(ShowBoxType.alert, "備份成功!");
                    }
                    else
                    {
                        APConfig.SweetAlert(ShowBoxType.alert, "備份失敗!");
                    }


                    conn.Close();
                    conn.Dispose();
                }
                catch (Exception ex)
                {
                    APConfig.SweetAlert(ShowBoxType.alert, string.Format("備份失敗!{0}", ex.Message));
                }
            }
        }
Esempio n. 29
0
        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);
        }
Esempio n. 30
0
        private bool checkAdd()
        {
            string msg = "";

            if (mode == mode.Add && dgvItem.RowCount <= 0)
            {
                msg = "商品資訊無法為空!";
            }
            else if (mode == mode.Edit && string.IsNullOrEmpty(txtAmount.Text))
            {
                msg = "商品金額無法為空!";
            }
            else if (mode == mode.Edit && string.IsNullOrEmpty(txtName.Text))
            {
                msg = "商品名稱無法為空!";
            }


            if (!string.IsNullOrEmpty(msg))
            {
                APConfig.SweetAlert(ShowBoxType.alert, msg);
            }
            return(string.IsNullOrEmpty(msg) ? true : false);
        }