Exemplo n.º 1
0
        public void Save_MasterList(GridView gvMaster, string groupID, string staffID)
        {
            try
            {
                int seq = 0;
                if (_MasterAddEdit == 1)//for Edit,to delete old master then to new insert
                {
                    MatGroup.GroupMaster_Del("UPDATE", groupID);
                }

                for (int i = 0; i < gvMaster.RowCount; i++)
                {
                    Boolean unboundVal = Convert.ToBoolean(gvMaster.GetRowCellValue(i, "ACTIVE"));
                    int     _active    = Convert.ToInt32(unboundVal);
                    string  matID      = gvMaster.GetRowCellValue(i, "ROW_MAT_ID").ToString().Trim();
                    if (unboundVal == true)
                    {
                        seq = seq + 1;
                        MatGroup.GroupMaster_Save("INSERT", groupID, matID, seq, staffID, _active);
                    }

                    ////แบบ insert ที่ไม่ได้ติ๊กด้วย active=0
                    //seq = seq + 1;
                    //MatGroup.GroupMaster_Save("INSERT", groupID, matID, seq, staffID,_active);
                }
                MessageBox.Show("บันทึกข้อมูลเรียบร้อย!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnMas_Cancel_Click(null, null);
                btnMas_Find_Click(null, null);//reload form master list
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void btn_SaveMaterial_Click(object sender, EventArgs e)
        {
            try
            {
                string txtMatCode = tbMatCode.Text.Trim();
                string txtMatName = tbMatName.Text.Trim();
                string txtStaff   = tbStaff.Text.Trim();
                string txtMatID   = "0";
                if (string.IsNullOrEmpty(txtMatCode) || string.IsNullOrEmpty(txtMatName) || string.IsNullOrEmpty(txtStaff))
                {
                    MessageBox.Show("กรุณาป้อนข้อมูลให้ครบถ้วน!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tbMatName.Focus();
                    return;
                }
                if (MatGroup.check_Has_MatCode(txtMatCode) && _MatAddEdit == 0)//check for insert
                {
                    MessageBox.Show("รหัส Mat นี้ซ้ำกับในระบบ! กรุณาตรวจสอบด้วย", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tbMatCode.Focus();
                    tbStaff.Text = string.Empty;
                    return;
                }

                if (MatGroup.check_Has_MatName(txtMatName))
                {
                    MessageBox.Show("ชื่อนี้มีการป้อนไปแล้ว! กรุณาตรวจสอบด้วย", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tbMatName.Focus();
                    tbStaff.Text = string.Empty;
                    return;
                }
                if (!frm1.CheckStaff(txtStaff))
                {
                    MessageBox.Show("ไม่พบรหัสพนักงาน!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tbStaff.Text = string.Empty;
                    tbStaff.Focus();
                    return;
                }
                if (_MatAddEdit == 0)//insert
                {
                    MatGroup.Material_Save("INSERT", txtMatCode, txtMatName, txtStaff, txtMatID);
                }
                else//update
                {
                    txtMatID = lbl_ID.Text.Trim();
                    MatGroup.Material_Save("UPDATE", txtMatCode, txtMatName, txtStaff, txtMatID);
                }
                MessageBox.Show("บันทึกข้อมูลเรียบร้อย!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Clear_MaterialForm();
                btn_FindMaterial_Click(null, null);
                btnMas_Find_Click(null, null);//reload form master list
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
 private void gvMasterList_RowClick(object sender, RowClickEventArgs e)
 {
     try
     {
         string    groupID = gvMasterList.GetRowCellValue(gvMasterList.FocusedRowHandle, "ROW_GROUP_ID").ToString().Trim();
         DataTable dt      = MatGroup.dt_GetMasterGroup(groupID);
         gCtrl_ShowList.DataSource = dt;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 private void btn_FindMaterial_Click(object sender, EventArgs e)
 {
     try
     {
         string  matName = tbMaterial_Find.Text.Trim();
         DataSet ds      = MatGroup.ds_Material(matName);
         gridControl1.DataSource = ds.Tables[1];
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
 private void btnG_Find_Click(object sender, EventArgs e)
 {
     try
     {
         string  GroupMatName = tbG_Find.Text.Trim();
         DataSet ds           = MatGroup.ds_MatGroup(GroupMatName);
         gCtrl_Gmat.DataSource = ds.Tables[1];
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 6
0
 private void btnMas_Find_Click(object sender, EventArgs e)
 {
     try
     {
         string  GroupMatName = tbMas_Gname.Text.Trim();
         DataSet ds           = MatGroup.ds_MatGroup(GroupMatName);
         gCtrl_MasterList.DataSource = ds.Tables[2];
         gCtrl_ShowList.DataSource   = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 7
0
 //======================== TAB SET Master material group =========================================//
 public void Load_MatMasterList()
 {
     try
     {
         DataSet ds = MatGroup.ds_MatMasterList();
         gCtrl_GroupMas.DataSource = ds.Tables[2];
         //ControlsUtils.BindLookUpEdit(cStockLu, ds.Tables[1], "COLOR", "COLOR", false);
         ControlsUtils.BindLookUpEdit(luEdit_GroupID, ds.Tables[3], "RG_NAME", "ROW_GROUP_ID", false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 8
0
        public bool CheckSave_Master(string groupID)
        {
            bool ck = false;

            for (int i = 0; i < gv_GroupMas.RowCount; i++)
            {
                Boolean unboundVal = Convert.ToBoolean(gv_GroupMas.GetRowCellValue(i, "ACTIVE"));
                string  matID      = gv_GroupMas.GetRowCellValue(i, "ROW_MAT_ID").ToString().Trim();
                if (unboundVal == true)
                {
                    if (MatGroup.check_Has_MasterGroup(groupID, matID))
                    {
                        ck = true;
                        break;
                    }
                }
            }
            return(ck);
        }
Exemplo n.º 9
0
 private void btnMas_Del_Click(object sender, EventArgs e)
 {
     try
     {
         if (_MasterAddEdit == 1)
         {
             //string groupID = string.IsNullOrEmpty(luEdit_GroupID.Text) ? "" : luEdit_GroupID.EditValue.ToString();
             string groupID  = lblMat_GroupID.Text.Trim();
             string MasStaff = txtMas_staff.Text.Trim();
             if (!frm1.CheckStaff(MasStaff))
             {
                 MessageBox.Show("ไม่พบรหัสพนักงาน!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtMas_staff.Text = string.Empty;
                 txtMas_staff.Focus();
                 return;
             }
             if (MatGroup.Check_MasterGroup_Ref(groupID))//check มีการผูกรหัส group ไปใช้ยัง
             {
                 MessageBox.Show("ไม่สามารถลบได้! \nเนื่องจากใช้ใน Master group แล้ว", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtMas_staff.Text = string.Empty;
                 txtMas_staff.Focus();
                 return;
             }
             if (MessageBox.Show("ต้องการลบใช่หรือไม่?", "Confirm!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
             {
                 MatGroup.GroupMaster_Del("DELETE", groupID);
                 MessageBox.Show("ลบข้อมูลเรียบร้อย!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 btnMas_Cancel_Click(null, null);
                 btnMas_Find_Click(null, null);//reload form master list
             }
         }
         else
         {
             MessageBox.Show("กรุณากด แก้ไข หน้าหลักเพื่อทำการลบ!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 10
0
        private void lnk_Edit_Click(object sender, EventArgs e)
        {
            string groupID = gvMasterList.GetRowCellValue(gvMasterList.FocusedRowHandle, "ROW_GROUP_ID").ToString();

            //0=add, 1=edit
            _MasterAddEdit                  = 1;
            luEdit_GroupID.Visible          = false;
            tbMat_GroupName.Visible         = true;
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            //Load_MatMasterList();//reload luEdit_GroupID
            string masterName = MatGroup.RG_MasterName(groupID);

            //luEdit_GroupID.Text = masterName;
            tbMat_GroupName.Text      = masterName;
            lblMat_GroupID.Text       = groupID;
            txtMas_staff.Text         = string.Empty;
            luEdit_GroupID.Enabled    = false;
            gCtrl_GroupMas.DataSource = null;
            gCtrl_GroupMas.DataSource = MatGroup.dt_GetEditMasterGroup(groupID);
        }
Exemplo n.º 11
0
 private void btnMat_Del_Click(object sender, EventArgs e)
 {
     try
     {
         if (_MatAddEdit == 1)
         {
             string txtMatID = lbl_ID.Text.Trim();
             string txtStaff = tbStaff.Text.Trim();
             if (!frm1.CheckStaff(txtStaff))
             {
                 MessageBox.Show("ไม่พบรหัสพนักงาน!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 tbStaff.Text = string.Empty;
                 tbStaff.Focus();
                 return;
             }
             if (MatGroup.Check_Material_Ref(txtMatID))//check มีการผูกรหัส material ไปใช้ยัง
             {
                 MessageBox.Show("ไม่สามารถลบได้! \nเนื่องจากใช้ใน Master group แล้ว", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 tbStaff.Text = string.Empty;
                 tbStaff.Focus();
                 return;
             }
             if (MessageBox.Show("ต้องการลบใช่หรือไม่?", "Confirm!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
             {
                 MatGroup.Material_Save("DELETE", "", "", txtStaff, txtMatID);
                 MessageBox.Show("ลบข้อมูลเรียบร้อย!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 Clear_MaterialForm();
                 btn_FindMaterial_Click(null, null);
             }
         }
         else
         {
             MessageBox.Show("กรุณากด Double Click รายการด้านล่าง เพื่อทำการลบ!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        public void showBomAccDetail(BomModel data)
        {
            mruBu.Text       = data.bu;
            txtBsys.Text     = data.sku;
            mruUColor.Text   = data.uColor;
            mruSize.Text     = data.size;
            mruPack.Text     = data.packB;
            mruStic.Text     = data.sticker;
            mruInk.Text      = data.ink;
            mruTitanium.Text = data.titanium;
            txtBoxQty.Text   = data.boxqty;
            txtseason.Text   = data.season;
            txtBraArt.Text   = data.braart;
            txtBraColor.Text = data.bracolor;
            txtBraSize.Text  = data.brasize;
            //get data from another class
            MatGroup.f1 = form1;
            string matGroupName = MatGroup.Get_MatGroupName(data.matGroupID);

            luEdit_GroupMat.EditValue = luEdit_GroupMat.Properties.GetKeyValueByDisplayText(matGroupName);
        }