Exemple #1
0
        /// <summary>
        /// 載入表單控制項相關預設值
        /// </summary>
        public void LoadDefaultValue()
        {
            string SQLCommand = "Select A1.ItemsID ,A1.Name,A1.ItemsType , A1.Specifications,A1.ItemsUnit,A1.SellingPrice,A1.CostPrice,A1.MSRP, (A1.ManufacturerID + '-' + A2.CNAME) as Manufacturer , A1.Inventory , A1.SafeInventory , A1.Notes " +
                                "from ItemsInfo A1 INNER JOIN ManufacturerInfo A2 On A1.ManufacturerID = A2.ManufacturerID order by A1.ItemsID ";

            My.MyDatabase MyDb = new My.MyDatabase();

            DataView DV = MyDb.CreateDataView(SQLCommand, "ItemsInfo");

            this.dgvItemsInfo.DataSource = DV;

            //dataGridView表頭名稱中文化
            dgvItemsInfo.Columns[0].HeaderText  = "商品編號";
            dgvItemsInfo.Columns[1].HeaderText  = "商品名稱";
            dgvItemsInfo.Columns[2].HeaderText  = "商品類別";
            dgvItemsInfo.Columns[3].HeaderText  = "商品規格";
            dgvItemsInfo.Columns[4].HeaderText  = "基本單位";
            dgvItemsInfo.Columns[5].HeaderText  = "出貨價格";
            dgvItemsInfo.Columns[6].HeaderText  = "進貨價格";
            dgvItemsInfo.Columns[7].HeaderText  = "建議售價";
            dgvItemsInfo.Columns[8].HeaderText  = "進貨廠商";
            dgvItemsInfo.Columns[9].HeaderText  = "庫存量";
            dgvItemsInfo.Columns[10].HeaderText = "安全庫存量";
            dgvItemsInfo.Columns[11].HeaderText = "備註";

            tsslDataCount.Text = DV.Count.ToString();

            //凍結 中文名稱 欄位
            this.dgvItemsInfo.Columns["NAME"].Frozen = true;

            //設定點選任一儲存格變選取所屬資料列的所有資料
            this.dgvItemsInfo.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //替代資料列樣式
            this.dgvItemsInfo.RowsDefaultCellStyle.BackColor            = Color.AliceBlue;
            this.dgvItemsInfo.AlternatingRowsDefaultCellStyle.BackColor = Color.Ivory;

            //自動調整資料列與資料行的高度與寬度
            this.dgvItemsInfo.AutoResizeColumns();
            this.dgvItemsInfo.AutoResizeRows();

            //防止在 DataGridView 控制項中新增和刪除資料列
            this.dgvItemsInfo.AllowUserToAddRows    = false;
            this.dgvItemsInfo.AllowUserToDeleteRows = false;

            //列標頭依據顯示內容自動調整大小
            this.dgvItemsInfo.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);

            toolTip1.SetToolTip(txtItemsID, "請輸入[商品編號]!");
            toolTip1.SetToolTip(txtNAME, "請輸入公司[商品名稱]!");
            tsbAddNew.ToolTipText = "按下[新增]鈕,以進行商品新增動作!";
            tsbUpdate.ToolTipText = "按下[更改]鈕,以進行商品更改動作!";
            tsbDelete.ToolTipText = "按下[刪除]鈕,以進行商品刪除動作!";
            tsbClear.ToolTipText  = "按下[清除]鈕,以進行輸入欄位資料清除動作!";
            tsbExit.ToolTipText   = "按下[離開]鈕,會將本表單進行關閉!";
        }
Exemple #2
0
        /// <summary>
        /// 載入表單控制項相關預設值
        /// </summary>
        public void LoadDefaultValue()
        {
            string SQLCommand = "Select * from EmployeeInfo order by EmployeeID ";

            My.MyDatabase MyDb = new My.MyDatabase();

            DataView DV = MyDb.CreateDataView(SQLCommand, "EmployeeInfo");

            this.dgvEmployeeInfo.DataSource = DV;

            //dataGridView表頭名稱中文化
            dgvEmployeeInfo.Columns[0].HeaderText  = "職員編號";
            dgvEmployeeInfo.Columns[1].HeaderText  = "中文名稱";
            dgvEmployeeInfo.Columns[2].HeaderText  = "英文名稱";
            dgvEmployeeInfo.Columns[3].HeaderText  = "相片";
            dgvEmployeeInfo.Columns[4].HeaderText  = "性別";
            dgvEmployeeInfo.Columns[5].HeaderText  = "生日";
            dgvEmployeeInfo.Columns[6].HeaderText  = "血型";
            dgvEmployeeInfo.Columns[7].HeaderText  = "身分證字號";
            dgvEmployeeInfo.Columns[8].HeaderText  = "通訊地址";
            dgvEmployeeInfo.Columns[9].HeaderText  = "專長";
            dgvEmployeeInfo.Columns[10].HeaderText = "到職日期";
            dgvEmployeeInfo.Columns[11].HeaderText = "職稱";
            dgvEmployeeInfo.Columns[12].HeaderText = "最高學歷";
            dgvEmployeeInfo.Columns[13].HeaderText = "電話";
            dgvEmployeeInfo.Columns[14].HeaderText = "在職狀態";

            tsslDataCount.Text = DV.Count.ToString();

            //凍結 中文名稱 欄位
            this.dgvEmployeeInfo.Columns["CNAME"].Frozen = true;

            //設定點選任一儲存格變選取所屬資料列的所有資料
            this.dgvEmployeeInfo.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //替代資料列樣式
            this.dgvEmployeeInfo.RowsDefaultCellStyle.BackColor            = Color.AliceBlue;
            this.dgvEmployeeInfo.AlternatingRowsDefaultCellStyle.BackColor = Color.Ivory;

            //自動調整資料列與資料行的高度與寬度
            this.dgvEmployeeInfo.AutoResizeColumns();
            //this.dgvEmployeeInfo.AutoResizeRows();

            //防止在 DataGridView 控制項中新增和刪除資料列
            this.dgvEmployeeInfo.AllowUserToAddRows    = false;
            this.dgvEmployeeInfo.AllowUserToDeleteRows = false;

            toolTip1.SetToolTip(txtEmployeeID, "請輸入[職員編號]!");
            toolTip1.SetToolTip(txtCNAME, "請輸入職員[中文名稱]!");
            tsbAddNew.ToolTipText = "按下[新增]鈕,以進行職員新增動作!";
            tsbUpdate.ToolTipText = "按下[更改]鈕,以進行職員更改動作!";
            tsbDelete.ToolTipText = "按下[刪除]鈕,以進行職員刪除動作!";
            tsbClear.ToolTipText  = "按下[清除]鈕,以進行輸入欄位資料清除動作!";
            tsbExit.ToolTipText   = "按下[離開]鈕,會將本表單進行關閉!";
        }
Exemple #3
0
        /// <summary>
        /// 載入表單控制項相關預設值
        /// </summary>
        public void LoadDefaultValue()
        {
            string SQLCommand = "Select * from CompanyInfo order by CompanyID ";

            My.MyDatabase MyDb = new My.MyDatabase();

            DataView DV = MyDb.CreateDataView(SQLCommand, "CompanyInfo");

            this.dgvCompanyInfo.DataSource = DV;

            //dataGridView表頭名稱中文化
            dgvCompanyInfo.Columns[0].HeaderText  = "公司編號";
            dgvCompanyInfo.Columns[1].HeaderText  = "中文名稱";
            dgvCompanyInfo.Columns[2].HeaderText  = "英文名稱";
            dgvCompanyInfo.Columns[3].HeaderText  = "統一編號";
            dgvCompanyInfo.Columns[4].HeaderText  = "公司類型";
            dgvCompanyInfo.Columns[5].HeaderText  = "負責人";
            dgvCompanyInfo.Columns[6].HeaderText  = "聯絡人";
            dgvCompanyInfo.Columns[7].HeaderText  = "公司電話";
            dgvCompanyInfo.Columns[8].HeaderText  = "聯絡人手機";
            dgvCompanyInfo.Columns[9].HeaderText  = "公司傳真";
            dgvCompanyInfo.Columns[10].HeaderText = "公司地址";
            dgvCompanyInfo.Columns[11].HeaderText = "網站";
            dgvCompanyInfo.Columns[12].HeaderText = "備註";

            tsslDataCount.Text = DV.Count.ToString();

            //凍結 中文名稱 欄位
            this.dgvCompanyInfo.Columns["CNAME"].Frozen = true;

            //設定點選任一儲存格變選取所屬資料列的所有資料
            this.dgvCompanyInfo.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //替代資料列樣式
            this.dgvCompanyInfo.RowsDefaultCellStyle.BackColor            = Color.AliceBlue;
            this.dgvCompanyInfo.AlternatingRowsDefaultCellStyle.BackColor = Color.Ivory;

            //自動調整資料列與資料行的高度與寬度
            this.dgvCompanyInfo.AutoResizeColumns();
            this.dgvCompanyInfo.AutoResizeRows();

            //防止在 DataGridView 控制項中新增和刪除資料列
            this.dgvCompanyInfo.AllowUserToAddRows    = false;
            this.dgvCompanyInfo.AllowUserToDeleteRows = false;

            toolTip1.SetToolTip(txtCompanyID, "請輸入[公司編號]!");
            toolTip1.SetToolTip(txtCNAME, "請輸入公司[中文名稱]!");
            tsbAddNew.ToolTipText = "按下[新增]鈕,以進行公司新增動作!";
            tsbUpdate.ToolTipText = "按下[更改]鈕,以進行公司更改動作!";
            tsbDelete.ToolTipText = "按下[刪除]鈕,以進行公司刪除動作!";
            tsbClear.ToolTipText  = "按下[清除]鈕,以進行輸入欄位資料清除動作!";
            tsbExit.ToolTipText   = "按下[離開]鈕,會將本表單進行關閉!";
        }
Exemple #4
0
        /// <summary>
        /// 載入表單控制項相關預設值
        /// </summary>
        public void LoadDefaultValue()
        {
            string SQLCommand = "Select A1.ItemsID ,A1.Name,A1.ItemsType , A1.ItemsUnit,A1.SellingPrice,A1.CostPrice,A1.MSRP, (A1.ManufacturerID + '-' + A2.CNAME) as Manufacturer " +
                                "from ItemsInfo A1 INNER JOIN ManufacturerInfo A2 On A1.ManufacturerID = A2.ManufacturerID order by A1.ItemsID ";

            My.MyDatabase MyDb = new My.MyDatabase();

            DataView DV = MyDb.CreateDataView(SQLCommand, "ItemsInfo");

            this.dgvItemsInfo.DataSource = DV;

            //dataGridView表頭名稱中文化
            dgvItemsInfo.Columns[0].HeaderText = "商品編號";
            dgvItemsInfo.Columns[1].HeaderText = "商品名稱";
            dgvItemsInfo.Columns[2].HeaderText = "商品類別";
            dgvItemsInfo.Columns[3].HeaderText = "基本單位";
            dgvItemsInfo.Columns[4].HeaderText = "出貨價格";
            dgvItemsInfo.Columns[5].HeaderText = "進貨價格";
            dgvItemsInfo.Columns[6].HeaderText = "建議售價";
            dgvItemsInfo.Columns[7].HeaderText = "進貨廠商";

            tsslDataCount.Text = DV.Count.ToString();

            dgvItemsInfo.Columns[0].Visible = false;//隱藏商品編號

            //凍結 中文名稱 欄位
            this.dgvItemsInfo.Columns["NAME"].Frozen = true;

            //設定點選任一儲存格變選取所屬資料列的所有資料
            this.dgvItemsInfo.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //替代資料列樣式
            this.dgvItemsInfo.RowsDefaultCellStyle.BackColor            = Color.AliceBlue;
            this.dgvItemsInfo.AlternatingRowsDefaultCellStyle.BackColor = Color.Ivory;

            //自動調整資料列與資料行的高度與寬度
            this.dgvItemsInfo.AutoResizeColumns();
            this.dgvItemsInfo.AutoResizeRows();

            //防止在 DataGridView 控制項中新增和刪除資料列
            this.dgvItemsInfo.AllowUserToAddRows    = false;
            this.dgvItemsInfo.AllowUserToDeleteRows = false;

            //列標頭依據顯示內容自動調整大小
            this.dgvItemsInfo.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);
        }
        /// <summary>
        /// 載入表單控制項相關預設值
        /// </summary>
        public void LoadDefaultValue2()
        {
            string SQLCommand = "Select TOP 100 * from ManagementInfo order by CNAME DESC";

            My.MyDatabase MyDb = new My.MyDatabase();

            DataView DV = MyDb.CreateDataView(SQLCommand, "ManagementInfo");

            this.dataGridView2.DataSource = DV;

            //dataGridView表頭名稱中文化
            dataGridView2.Columns[0].HeaderText = "使用者帳號";
            dataGridView2.Columns[1].HeaderText = "中文名稱";
            dataGridView2.Columns[2].HeaderText = "英文名稱";
            dataGridView2.Columns[3].HeaderText = "性別";
            dataGridView2.Columns[4].HeaderText = "生日";
            dataGridView2.Columns[5].HeaderText = "血型";
            dataGridView2.Columns[6].HeaderText = "身份證字號";
            dataGridView2.Columns[7].HeaderText = "通訊地址";
            dataGridView2.Columns[8].HeaderText = "電話";
            dataGridView2.Columns[9].HeaderText = "職稱";

            tSSL_DataCount2.Text = DV.Count.ToString();


            //設定點選任一儲存格變選取所屬資料列的所有資料
            this.dataGridView2.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //替代資料列樣式
            this.dataGridView2.RowsDefaultCellStyle.BackColor            = Color.AliceBlue;
            this.dataGridView2.AlternatingRowsDefaultCellStyle.BackColor = Color.Ivory;

            //自動調整資料列與資料行的高度與寬度
            this.dataGridView2.AutoResizeColumns();
            this.dataGridView2.AutoResizeRows();

            //防止在 DataGridView 控制項中新增和刪除資料列
            this.dataGridView2.AllowUserToAddRows    = false;
            this.dataGridView2.AllowUserToDeleteRows = false;
        }
Exemple #6
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string SQLCommand = "Select A1.ItemsID ,A1.Name,A1.ItemsType , A1.ItemsUnit,A1.SellingPrice,A1.CostPrice,A1.MSRP, (A1.ManufacturerID + '-' + A2.CNAME) as Manufacturer " +
                                "from ItemsInfo A1 INNER JOIN ManufacturerInfo A2 On A1.ManufacturerID = A2.ManufacturerID " +
                                "Where A1.ItemsID Like '" + txtSearchKeyword.Text.Trim() + "%' OR A1.Name Like '%" + txtSearchKeyword.Text.Trim() + "%'  order by A1.ItemsID ";

            My.MyDatabase MyDb = new My.MyDatabase();

            this.dgvItemsInfo.Columns["NAME"].Frozen = false;
            DataView DV = MyDb.CreateDataView(SQLCommand, "ItemsInfo");

            this.dgvItemsInfo.DataSource             = DV;
            this.dgvItemsInfo.Columns["NAME"].Frozen = true;
            //自動調整資料列與資料行的高度與寬度
            this.dgvItemsInfo.AutoResizeColumns();
            this.dgvItemsInfo.AutoResizeRows();

            if (DV.Count == 0)
            {
                MessageBox.Show("搜尋條件並未找到任何符合資料", "搜尋結果", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            else
            {
                MessageBox.Show("共找到資料筆數" + DV.Count.ToString(), "搜尋結果");
            }

            //dataGridView表頭名稱中文化
            dgvItemsInfo.Columns[0].HeaderText = "商品編號";
            dgvItemsInfo.Columns[1].HeaderText = "商品名稱";
            dgvItemsInfo.Columns[2].HeaderText = "商品類別";
            dgvItemsInfo.Columns[3].HeaderText = "基本單位";
            dgvItemsInfo.Columns[4].HeaderText = "出貨價格";
            dgvItemsInfo.Columns[5].HeaderText = "進貨價格";
            dgvItemsInfo.Columns[6].HeaderText = "建議售價";
            dgvItemsInfo.Columns[7].HeaderText = "進貨廠商";

            tsslDataCount.Text = DV.Count.ToString();
        }
Exemple #7
0
        /// <summary>
        /// 載入表單控制項相關預設值
        /// </summary>
        public void LoadDefaultValue()
        {
            string SQLCommand = "Select TOP 100 * from WinApEvents order by EventTime DESC";

            My.MyDatabase MyDb = new My.MyDatabase();

            DataView DV = MyDb.CreateDataView(SQLCommand, "WinApEvents");

            this.dataGridView1.DataSource = DV;

            //dataGridView表頭名稱中文化
            dataGridView1.Columns[0].HeaderText = "事件編號";
            dataGridView1.Columns[1].HeaderText = "事件觸發時間";
            dataGridView1.Columns[2].HeaderText = "事件類型";
            dataGridView1.Columns[3].HeaderText = "使用者帳號";
            dataGridView1.Columns[4].HeaderText = "執行動作";
            dataGridView1.Columns[5].HeaderText = "細節說明";

            tSSL_DataCount.Text = DV.Count.ToString();


            //設定點選任一儲存格變選取所屬資料列的所有資料
            this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //替代資料列樣式
            this.dataGridView1.RowsDefaultCellStyle.BackColor            = Color.AliceBlue;
            this.dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Ivory;

            //自動調整資料列與資料行的高度與寬度
            this.dataGridView1.AutoResizeColumns();
            this.dataGridView1.AutoResizeRows();

            //防止在 DataGridView 控制項中新增和刪除資料列
            this.dataGridView1.AllowUserToAddRows    = false;
            this.dataGridView1.AllowUserToDeleteRows = false;
        }
Exemple #8
0
        private void LoadAccountsReceivable()
        {
            string SQLCommand = "SELECT  ShipMaster.ShipID,ShipMaster.CustomerID, " +
                                "CustomerInfo.CNAME , ResultUnpaidAmout = case  " +
                                "When RMAMaster.UnpaidAmount is null Then ShipMaster.UnpaidAmount " +
                                "Else " +
                                "RMAMaster.UnpaidAmount " +
                                "End ,ReversalAmount  = case " +
                                "When Reversal.ReversalAmount is null Then 0 " +
                                "Else " +
                                "Reversal.ReversalAmount " +
                                "End ,Reversal.IsReversal " +
                                "FROM  ShipMaster INNER JOIN " +
                                "CustomerInfo ON ShipMaster.CustomerID = CustomerInfo.CustomerID " +
                                "LEFT JOIN RMAMaster ON ShipMaster.ShipID = RMAMaster.StockIDOrShipID " +
                                "LEFT JOIN Reversal ON Reversal.StockIDOrShipID = ShipMaster.ShipID " +
                                "WHERE ShipMaster.UnpaidAmount < 0  AND (RMAMaster.UnpaidAmount is null or RMAMaster.UnpaidAmount < 0) ";

            My.MyDatabase MyDb = new My.MyDatabase();

            DataView DV = MyDb.CreateDataView(SQLCommand, "AccountsReceivable");

            this.dgvAccountsReceivable.DataSource = DV;

            //dataGridView表頭名稱中文化
            dgvAccountsReceivable.Columns[0].HeaderText = "出貨單號";
            dgvAccountsReceivable.Columns[1].HeaderText = "客戶編號";
            dgvAccountsReceivable.Columns[2].HeaderText = "客戶名稱";
            dgvAccountsReceivable.Columns[3].HeaderText = "未收金額";
            dgvAccountsReceivable.Columns[4].HeaderText = "沖銷金額";
            dgvAccountsReceivable.Columns[5].HeaderText = "是否沖銷";

            //凍結 中文名稱 欄位
            this.dgvAccountsReceivable.Columns["CNAME"].Frozen = true;

            //設定點選任一儲存格變選取所屬資料列的所有資料
            this.dgvAccountsReceivable.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //替代資料列樣式
            this.dgvAccountsReceivable.RowsDefaultCellStyle.BackColor            = Color.AliceBlue;
            this.dgvAccountsReceivable.AlternatingRowsDefaultCellStyle.BackColor = Color.Ivory;

            //自動調整資料列與資料行的高度與寬度
            this.dgvAccountsReceivable.AutoResizeColumns();
            this.dgvAccountsReceivable.AutoResizeRows();

            //防止在 DataGridView 控制項中新增和刪除資料列
            this.dgvAccountsReceivable.AllowUserToAddRows    = false;
            this.dgvAccountsReceivable.AllowUserToDeleteRows = false;

            //列標頭依據顯示內容自動調整大小
            this.dgvAccountsReceivable.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);

            //設定不能進行編輯的所有欄位
            dgvAccountsReceivable.Columns["ShipID"].ReadOnly            = true;
            dgvAccountsReceivable.Columns["CustomerID"].ReadOnly        = true;
            dgvAccountsReceivable.Columns["CNAME"].ReadOnly             = true;
            dgvAccountsReceivable.Columns["ResultUnpaidAmout"].ReadOnly = true;
            dgvAccountsReceivable.Columns["ReversalAmount"].ReadOnly    = true;
            dgvAccountsReceivable.Columns["IsReversal"].ReadOnly        = true;
        }