Exemple #1
0
 private void Find_Doc(string temp_id) //非新增或編號狀態下帶出的資料
 {
     if (!String.IsNullOrEmpty(temp_id))
     {
         string strsql = String.Format(
             @"SELECT id,name,english_name,currency_sign,country_id,sunaccount_rate,bp_formula,remark,create_by,create_date,update_by,update_date 
         FROM dbo.bs_money Where state='0' order by id ", temp_id);
         DataTable dt = clsApp.GetDataTable(strsql);
         dgvDetails.DataSource = dt;
         if (dt.Rows.Count == 0)
         {
             if (mLanguage == "2")
             {
                 msgCustom = "The No. of the data does not exist.";
             }
             else
             {
                 msgCustom = "編號資料不存在!";
             }
             MessageBox.Show(msgCustom, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
             SetObjValue.ClearObjValue(this.Controls, "2");
             return;
         }
         else
         {
             mID = txtid.Text;//保存臨時的ID號
         }
     }
 }
Exemple #2
0
        private void Find_doc(string temp_id) //非新增或編號狀態下帶出的資料
        {
            if (!String.IsNullOrEmpty(temp_id))
            {
                string strsql = String.Format(@"SELECT A.*,B.name as country_name FROM dbo.bs_brand A with(nolock) 
                                                LEFT JOIN bs_country B with(nolock) ON A.origin=B.id WHERE A.id='{0}'", temp_id);
                dtBrand = clsApp.GetDataTable(strsql);
                if (dtBrand.Rows.Count == 0)
                {
                    if (mLanguage == "2")
                    {
                        msgCustom = "The Brand No. of the data does not exist.";
                    }
                    else
                    {
                        msgCustom = "牌子編號資料不存在!";
                    }
                    MessageBox.Show(msgCustom, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    SetObjValue.ClearObjValue(this.Controls, "2");
                    return;
                }
                else
                {
                    string strsql1 = String.Format("SELECT * FROM dbo.bs_brand_group with(nolock) WHERE id='{0}'", temp_id);
                    dtBrand_group           = clsApp.GetDataTable(strsql1);
                    strsql1                 = String.Format("SELECT * FROM dbo.bs_brand_office with(nolock) WHERE id='{0}'", temp_id);
                    dtBrand_office          = clsApp.GetDataTable(strsql1);
                    gridControl1.DataSource = dtBrand_group;
                    gridControl2.DataSource = dtBrand_office;

                    mID = txtID.Text;//保存臨時的ID號
                }
                Set_Master_Data(dtBrand);
            }
        }
Exemple #3
0
        private void Edit()
        {
            if (!(txtID.Text == ""))
            {
                if (BTNAPPROVE.Tag.ToString() == "1")
                {
                    //已批準狀態,不可以編輯!
                    MessageBox.Show(clsCommon.GetTitle("t_ check_is_can_edit"), myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                if (BTNAPPROVE.Tag.ToString() == "2")
                {
                    //注銷狀態,不可以編輯!
                    MessageBox.Show(clsCommon.GetTitle("t_ check_is_can_cancel"), myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                objToolbar.Set_Button_Enable_Status(toolStrip1, false);
                objToolbar.SetToolBar();//重檢查按鈕的權限
                SetObjValue.SetEditBackColor(tabPoPurchase.TabPages[0].Controls, true);
                Set_Grid_Status(true);
                m_state = "EDIT";
                txtID.Properties.ReadOnly       = true;
                txtID.BackColor                 = System.Drawing.Color.White;
                lueseparate.Properties.ReadOnly = true;
                lueseparate.BackColor           = System.Drawing.Color.White;

                tabPoPurchase.SelectedIndex = 0;
            }
        }
Exemple #4
0
 private void Edit()  //編號
 {
     if (txtid.Text == "")
     {
         return;
     }
     if (luestate.EditValue.ToString() == "2")
     {
         string msg;
         if (mLanguage == "2")
         {
             msg = "Cannot be edited because the current status is cancel.";
         }
         else
         {
             msg = "當前記錄為註銷狀態為,不可以進行編輯!";
         }
         MessageBox.Show(msg, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     mState = "Edit";
     SetButtonSatus(false);
     SetObjValue.SetEditBackColor(panel1.Controls, true);
     txtupdate_by.Text         = DBUtility._user_id;
     txtupdate_date.Text       = DateTime.Now.Date.ToString();
     txtid.Properties.ReadOnly = true;
     txtid.BackColor           = System.Drawing.Color.White;
 }
Exemple #5
0
        private void AddNew()          //新增
        {
            mState = "NEW";
            myBDS1.AddNew();

            txtID.Focus();
            SetButtonSatus(false);
            Set_Grid_Status(true);

            SetObjValue.SetEditBackColor(panel1.Controls, true);
            SetObjValue.ClearObjValue(panel1.Controls, "1");
            //DataRow dr = dtMostly.NewRow(); //插一空行
            //dtMostly.Rows.InsertAt(dr, 0);
            txtID.Text = clsApp.ExecuteSqlReturnObject(@"Select dbo.fn_get_max_no('T') AS max_no");
            //GetID_No();
            txtID.Properties.ReadOnly = true;
            txtID.BackColor           = Color.White;

            txtremark.Text            = "";
            txtState.Text             = "0";
            dtDelivery_date.EditValue = DateTime.Now.Date.ToString("yyyy-MM-dd").Substring(0, 10);

            dtDetails.Clear();
            gridControl1.DataSource = myBDS2;
            tabControl1.SelectTab(0);//跳至第一頁
        }
Exemple #6
0
        private void Edit()          //編輯
        {
            if (txtID.Text == "")
            {
                return;
            }
            if (!clsCommon.Is_Allow_Edit_Data("T", dtDelivery_date.Text))
            {
                MessageBox.Show("已超过修改数据的期限!", "提示信息");
                return;
            }

            SetButtonSatus(false);
            SetObjValue.SetEditBackColor(panel1.Controls, true);
            Set_Grid_Status(true);
            mState = "EDIT";

            //txtID.Properties.ReadOnly = true;
            txtID.Properties.ReadOnly = true;
            txtID.BackColor           = Color.White;
            //txtserial_no.Properties.ReadOnly = true;
            //txtserial_no.BackColor = Color.White;
            //chkIs_large.Properties.ReadOnly = true;
            //chkIs_large.BackColor = Color.White;

            tabControl1.SelectTab(0);//跳至第一頁
        }
Exemple #7
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            if (txtMenu_id.Text != "" && txtWindow_id.Text != "")
            {
                MessageBox.Show("当前节点菜单项已是最末级別菜单,不可再建立它的下一层子菜单!", "提示信息");
                return;
            }

            mState = "NEW";
            SetButtonSatus(false);
            SetObjValue.SetEditBackColor(panel1.Controls, true);
            Clear_obj_text();
            if (cur_node_name != "")
            {
                if (cur_node_name == "MENU_MANAGE")
                {
                    txtPrent_menu_id.EditValue = "";
                }
                else
                {
                    txtPrent_menu_id.EditValue = cur_node_name;
                }
                txtRelatively_station.Text = Get_Seq(cur_node_name);
            }
            txtCreateby.Text   = DBUtility._user_id;
            txtCreatedate.Text = DateTime.Now.Date.ToString("yyyy/MM/dd hh:ss");
            chkVisible.Checked = true;
        }
Exemple #8
0
 private void Find_doc(string temp_id) //非新增或編號狀態下帶出的資料
 {
     if (!String.IsNullOrEmpty(temp_id))
     {
         string    strsql = String.Format("SELECT * FROM dbo.dbo.bs_season WHERE id='{0}'", temp_id);
         DataTable dt     = clsApp.GetDataTable(strsql);
         dgvDetails.DataSource = dt;
         if (dt.Rows.Count == 0)
         {
             if (str_language == "2")
             {
                 msgCustom = "The NO. of the data does not exist.";
             }
             else
             {
                 msgCustom = "編號資料不存在!";
             }
             MessageBox.Show(msgCustom, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
             SetObjValue.ClearObjValue(this.Controls, "2");
             return;
         }
         else
         {
             mID = txtID.Text;//保存臨時的ID號
         }
         Set_Master_Data(dt);
     }
 }
Exemple #9
0
        public frmPoPurchaseBillEditFare(frmPoPurchaseBill frmParent, string edit_status, string id, string ver)
        {
            InitializeComponent();
            myParentForm = frmParent;
            m_state      = edit_status;
            m_id         = id;
            m_ver        = ver;

            if (m_state != "")
            {
                if (frmPoPurchaseBill.bds_fare.Count > 0)
                {
                    SetObjValue.SetEditBackColor(this.Controls, true);
                }
            }
            else
            {
                SetObjValue.SetEditBackColor(this.Controls, false);
                btnItemAdd.Enabled = false;
                btnItemDel.Enabled = false;
            }
            bdnav.BindingSource = frmPoPurchaseBill.bds_fare;
            clsTranslate obj_ctl = new clsTranslate(this.Controls, DBUtility._language);

            obj_ctl.Translate();
        }
Exemple #10
0
 private void Find_doc(string temp_id) //非新增或編號狀態下帶出的資料
 {
     if (!String.IsNullOrEmpty(temp_id))
     {
         string strsql = string.Format(
             @"SELECT group_id, id,isnull(name,'') as name,isnull(english_name,'') as english_name,
             remark,create_by,create_date,update_by,update_date,state
             FROM dbo.bs_type  with(nolock)                   
             WHERE group_id='{0}' AND id='{1}'", txtgroup_id.EditValue, temp_id);
         DataTable dt = clsApp.GetDataTable(strsql);
         dgvDetails.DataSource = dt;
         if (dt.Rows.Count == 0)
         {
             if (mLanguage == "2")
             {
                 msgCustom = "The Code of the data does not exist.";
             }
             else
             {
                 msgCustom = "編號資料不存在!";
             }
             MessageBox.Show(msgCustom, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
             SetObjValue.ClearObjValue(this.Controls, "2");
             return;
         }
         else
         {
             mID = txtid.Text;//保存臨時的ID號
         }
         Set_Master_Data(dt);
     }
 }
Exemple #11
0
 private void Find_Doc(string temp_id) //非新增或編號狀態下帶出的資料
 {
     if (!String.IsNullOrEmpty(temp_id))
     {
         string strsql = String.Format(
             @"SELECT * FROM dbo.bs_unit order by kind,id ", temp_id);
         DataTable dt = clsApp.GetDataTable(strsql);
         bds1.DataSource       = dt;
         dgvDetails.DataSource = bds1;
         if (dt.Rows.Count == 0)
         {
             if (mLanguage == "2")
             {
                 msgCustom = "The No. of the data does not exist.";
             }
             else
             {
                 msgCustom = "編號資料不存在!";
             }
             MessageBox.Show(msgCustom, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
             SetObjValue.ClearObjValue(this.Controls, "2");
             return;
         }
         else
         {
             mID = txtid.Text;//保存臨時的ID號
         }
     }
 }
Exemple #12
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            bds1.AddNew();
            bds1.EndEdit();
            mState = "NEW";
            SetButtonSatus(false);

            ////dgvDetails.DataSource = dtDetail;
            //dgvDetails.MultiSelect = false;
            //// dgvRecView.Rows[dgvRecView.Rows.Count - 1].Selected = true;
            //dgvDetails.CurrentCell = dgvDetails.Rows[0].Cells[0];
            //dgvDetails.CurrentCell = dgvDetails.Rows[this.dgvDetails.Rows.Count - 1].Cells[0];

            SetObjValue.SetEditBackColor(panel1.Controls, true);
            state.EditValue  = "0";
            create_by.Text   = DBUtility._user_id;
            create_date.Text = DateTime.Now.Date.ToString();
            string ls_max_serial = clsApp.ExecuteSqlReturnObject(@"Select CONVERT(int,max(log_no)) + 1 as log_no FROM dbo.cd_goodscode");

            if (ls_max_serial != "")
            {
                log_no.Text = string.Format("{0:d4}", int.Parse(ls_max_serial));
            }
            else
            {
                log_no.Text = string.Format("{0:d4}", 1);
            }
        }
Exemple #13
0
 /// <summary>
 /// 添加明細表新行
 /// </summary>
 private void AddNew_Item()
 {
     if (!String.IsNullOrEmpty(txtID.EditValue.ToString())) // 有內容
     {
         //if (Check_Details_Valid())
         //{
         //    return;
         //}
         Set_Grid_Status(true);
         SetObjValue.SetEditBackColor(tabPage1.Controls, true);
         bds2.AddNew();
         //dgvDetails.AddNewRow();//新增
         dgvDetails.SetRowCellValue(dgvDetails.FocusedRowHandle, "id", txtID.EditValue.ToString());
         //dgvDetails.SetRowCellValue(dgvDetails.FocusedRowHandle, "sequence_id", (dgvDetails.RowCount + 1).ToString("0000")+"h");
         //dgvDetails.SetRowCellValue(dgvDetails.FocusedRowHandle, "sec_unit", "KG");
         ColumnView view = (ColumnView)dgvDetails;                //初始單元格焦點
         view.FocusedColumn = view.Columns["serial_no"];
         view.Focus();
         txtserial_no.Focus();
         splitContainer1.Panel1Collapsed = false;
     }
     else
     {
         MessageBox.Show("公司代码不可为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtID.Focus();
     }
 }
Exemple #14
0
        private void Edit()  //編號
        {
            if (dgvDetails.RowCount == 0)
            {
                return;
            }

            if (luestate.EditValue.ToString() == "2")
            {
                string msg;
                if (mLanguage == "2")
                {
                    msg = "Cannot be edited because the current status is cancel.";
                }
                else
                {
                    msg = "當前記錄為註銷狀態為,不可以進行編輯!";
                }
                MessageBox.Show(msg, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            SetButtonSatus(false);
            SetObjValue.SetEditBackColor(this.Controls, true);
            mState = "EDIT";

            txtid.Properties.ReadOnly = true;
            txtid.BackColor           = System.Drawing.Color.White;

            txtgroup_id.Properties.ReadOnly = true;
            txtgroup_id.BackColor           = System.Drawing.Color.White;
        }
Exemple #15
0
 private void Find_doc(string temp_id)         //主檔非新增的情況下,保存或取消時重新查出資料
 {
     if (!String.IsNullOrEmpty(temp_id))
     {
         string sql_h = String.Format(@"Select * FROM dbo.delivery_mostly with(nolock) Where id ='{0}' AND state <>'2'", temp_id);
         dtMostly = clsApp.GetDataTable(sql_h);
         string sql_d = String.Format(@"Select * From dbo.delivery_details with(nolock) Where id='{0}'", temp_id);
         dtDetails = clsApp.GetDataTable(sql_d);
         if (dtMostly.Rows.Count > 0)
         {
             myBDS1.DataSource = dtMostly;
         }
         else
         {
             //清空数据
             dtDetails.Clear();
             myBDS2.DataSource = dtDetails;
             SetObjValue.ClearObjValue(tabPage1.Controls, "2");
             return;
         }
         dtDetails.Clear();
         dtDetails               = clsApp.GetDataTable(sql_d);
         myBDS2.DataSource       = dtDetails;
         gridControl1.DataSource = myBDS2;
         //设置时间格式
         //txtlicence_valid_date.EditValue = clsPub.Return_String_Date(txtlicence_valid_date.EditValue.ToString());
         mID = txtID.EditValue.ToString();                //保存臨時的ID號
     }
 }
Exemple #16
0
 private void Cancel() //取消
 {
     mState = "";
     SetButtonSatus(true);
     SetObjValue.SetEditBackColor(this.Controls, false);
     dtDetails.RejectChanges();
     dgvDetails.Focus();
 }
Exemple #17
0
 private void AddNew()  //新增
 {
     mState = "NEW";
     txtID.Focus();
     SetButtonSatus(false);
     SetObjValue.SetEditBackColor(this.panel1.Controls, true);
     SetObjValue.ClearObjValue(this.panel1.Controls, "1");
 }
Exemple #18
0
        //private void Set_Row_Position(string _doc) //定位到當前行
        //{
        //    for (int i = 0; i < dgvDetails.RowCount; i++)
        //    {
        //        if (_doc == dgvDetails.Rows[i].Cells["id"].Value.ToString())
        //        {
        //            dgvDetails.CurrentCell = dgvDetails.Rows[i].Cells["id"]; //設置光標定位到當前選中的行
        //            dgvDetails.Rows[i].Selected = true;
        //            break;
        //        }
        //    }
        //}

        private void AddNew()  //新增
        {
            bds1.AddNew();
            mState = "NEW";
            SetButtonSatus(false);
            SetObjValue.SetEditBackColor(panel1.Controls, true);
            txtcreate_by.Text   = DBUtility._user_id;
            txtcreate_date.Text = DateTime.Now.Date.ToString();
        }
Exemple #19
0
 private void Cancel() //取消
 {
     bds1.CancelEdit();
     SetButtonSatus(true);
     SetObjValue.SetEditBackColor(panel1.Controls, false);
     mState = "";
     txtid.Properties.ReadOnly = true;
     Load_Date();
 }
Exemple #20
0
 private void btnItemDel_Click(object sender, EventArgs e)
 {
     frmPoPurchaseBill.bds_fare.EndEdit();
     myParentForm.Del_Item_Fare();
     if (frmPoPurchaseBill.bds_fare.Count == 0)
     {
         SetObjValue.SetEditBackColor(this.Controls, false);
     }
 }
Exemple #21
0
 private void Cancel()         //取消
 {
     myBds.CancelEdit();
     SetButtonSatus(true);
     SetObjValue.SetEditBackColor(tabPage1.Controls, false);
     SetObjValue.ClearObjValue(tabPage1.Controls, "2");
     Set_Grid_Status(false);
     mState = "";
 }
Exemple #22
0
 private void BTNEDIT_Click(object sender, EventArgs e)
 {
     if (dgvDetails.RowCount == 0)
     {
         return;
     }
     SetButtonSatus(false);
     SetObjValue.SetEditBackColor(this.panel1.Controls, true);
 }
Exemple #23
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     bds1.AddNew();
     mState = "NEW";
     SetButtonSatus(false);
     SetObjValue.SetEditBackColor(panel1.Controls, true);
     txtcreate_by.Text   = DBUtility._user_id;
     txtcreate_date.Text = DateTime.Now.Date.ToString();
 }
Exemple #24
0
 private void btnUndo_Click(object sender, EventArgs e)
 {
     bds1.CancelEdit();
     SetButtonSatus(true);
     SetObjValue.SetEditBackColor(panel1.Controls, false);
     mState = "";
     txtid.Properties.ReadOnly = true;
     Load_Date();
 }
Exemple #25
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dgvDetails.Rows.Count == 0)
            {
                return;
            }

            //dgvDetails.CurrentCell.RowIndex;行號
            //Select a Cell Focus
            dgvDetails.CurrentCell = dgvDetails.Rows[0].Cells["id"];
            //Selected a Row
            dgvDetails.Rows[0].Selected = true;

            bool flag_datavalid = false;

            for (int i = 0; i < dgvDetails.Rows.Count; i++)
            {
                if (dgvDetails.Rows[i].Cells["id"].Value.ToString() == "" || dgvDetails.Rows[i].Cells["name"].Value.ToString() == "")
                {
                    flag_datavalid         = true;
                    dgvDetails.CurrentCell = dgvDetails.Rows[i].Cells["id"];//選中當前空白的行
                    break;
                }
            }
            if (flag_datavalid)
            {
                MessageBox.Show("Payment Condition id cannot be empty !", myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                bds1.EndEdit();
                SqlCommandBuilder SCB = new SqlCommandBuilder(SDA);
                SDA.InsertCommand = SCB.GetInsertCommand();
                SDA.UpdateCommand = SCB.GetUpdateCommand();

                SDA.Update(dtDetail);
                //MessageBox.Show(myMsg.msgSave_ok, myMsg.msgTitle);
                DBUtility.myMessageBox(myMsg.msgSave_ok, myMsg.msgTitle);
                SCB = null;

                SetButtonSatus(true);
                SetObjValue.SetEditBackColor(panel1.Controls, false);
                mState = "";
                txtid.Properties.ReadOnly = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #26
0
 private void Cancel() //取消
 {
     SetButtonSatus(true);
     SetObjValue.SetEditBackColor(this.panel1.Controls, false);
     mState = "";
     if (!String.IsNullOrEmpty(mID))
     {
         Find_doc(mID);
     }
 }
Exemple #27
0
        private void AddNew()  //新增
        {
            mState = "NEW";
            txtID.Focus();
            SetButtonSatus(false);
            SetObjValue.SetEditBackColor(this.Controls, true);
            SetObjValue.ClearObjValue(this.Controls, "1");

            dgvDetails.Enabled = false;
        }
Exemple #28
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     bds1.AddNew();
     //txtID.Focus();
     SetButtonSatus(false);
     SetObjValue.SetEditBackColor(this.panel1.Controls, true);
     SetObjValue.ClearObjValue(this.panel1.Controls, "1");
     txtUpdateby.Text    = DBUtility._user_id;
     txtUpdate_date.Text = clsPub.GetCurrentDatetime();
 }
Exemple #29
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (txtMenu_id.Text == "")
     {
         return;
     }
     mState = "EDIT";
     SetButtonSatus(false);
     SetObjValue.SetEditBackColor(panel1.Controls, true);
 }
Exemple #30
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dgvDetails.Rows.Count == 0)
            {
                return;
            }
            //bds1.EndEdit();
            //dgvDetails.CurrentCell.RowIndex;行號
            //Select a Cell Focus
            dgvDetails.CurrentCell = dgvDetails.Rows[0].Cells["id"];
            //Selected a Row
            dgvDetails.Rows[0].Selected = true;

            bool flag_datavalid = false;

            for (int i = 0; i < dgvDetails.Rows.Count; i++)
            {
                if (dgvDetails.Rows[i].Cells["id"].Value.ToString() == "")
                {
                    flag_datavalid         = true;
                    dgvDetails.CurrentCell = dgvDetails.Rows[i].Cells["id"];//選中當前空白的行
                    break;
                }
            }
            if (flag_datavalid)
            {
                MessageBox.Show("公司资料不可为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                bds1.EndEdit();
                SqlCommandBuilder SCB = new SqlCommandBuilder(SDA);
                SDA.InsertCommand = SCB.GetInsertCommand();
                SDA.UpdateCommand = SCB.GetUpdateCommand();

                SDA.Update(dtDetail);
                MessageBox.Show("更新成功!", "提示信息");
                SCB = null;

                SetButtonSatus(true);
                SetObjValue.SetEditBackColor(panel1.Controls, false);
                mState = "";
                txtId.textBox.ReadOnly = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }