Example #1
0
        private void InsertRole()
        {
            string result = string.Empty;
            Role   role   = null;

            try
            {
                DataRow rowRole = this.dtbRole.Rows[0];
                if (rowRole != null)
                {
                    role = new Role();

                    role.ROLE_ID   = rowRole["ROLE_ID"].ToString().ToUpper();
                    role.ROLE_NAME = rowRole["ROLE_NAME"].ToString();
                    role.REC_STAT  = (bool)rowRole["REC_STAT"];
                }

                using (AdministratorBLL adminBll = new AdministratorBLL())
                {
                    result = adminBll.InsertRole(role, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                this.FormState = eFormState.ReadOnly;
                //Get all Invoice on Invoice List
                this.GetRoleList();

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdRole.Views[0];
                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "ROLE_ID", role.ROLE_ID);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntRole.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }
            }
        }
Example #2
0
        public void InsertParty()
        {
            string result = string.Empty;
            Party  party  = null;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                party = new Party();

                party.PARTY_ID   = string.Empty;
                party.PARTY_NAME = this.txtPARTY_NAME.Text;
                party.PARTY_TYPE = (string)this.icbPARTY_TYPE.EditValue;
                party.ADD1       = this.txtADD1.Text;
                party.ADD2       = this.txtADD2.Text;
                party.ADD3       = this.txtADD3.Text;
                party.ADD4       = this.txtADD4.Text;
                party.TEL        = this.txtTEL.Text;
                party.FAX        = this.txtFAX.Text;
                party.EMAIL      = this.txtEMAIL.Text;
                party.PIC        = this.txtPIC.Text;
                party.REMARK     = this.txtREMARK.Text;
                party.REC_STAT   = (bool)this.icbREC_STAT.EditValue;


                using (PartyBLL partyBll = new PartyBLL())
                {
                    result = partyBll.InsertParty(ref party, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.Cursor    = Cursors.Default;
                this.FormState = eFormState.ReadOnly;

                this.GetPartyList(string.Empty);

                if (result.Equals("OK"))
                {
                    this.txtPARTY_ID.Text = party.PARTY_ID;
                    GridView viewList = (GridView)this.grdParty.Views[0];
                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "PARTY_ID", party.PARTY_ID);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntParty.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }
            }
        }
Example #3
0
        private void InsertMachine()
        {
            string result = string.Empty;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                MaterialType mtlType = new MaterialType();

                mtlType.SEQ_NO   = this.txtSEQ_NO.Text;
                mtlType.NAME     = this.txtNAME.Text;
                mtlType.REMARK   = this.txtREMARK.Text;
                mtlType.REC_STAT = (bool)this.icbREC_STAT.EditValue;


                using (MaterialTypeBLL mtlTypeBll = new MaterialTypeBLL())
                {
                    result = mtlTypeBll.InsertMTLType(mtlType, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.Cursor    = Cursors.Default;
                this.FormState = eFormState.ReadOnly;

                this.GetMTLTypeList(string.Empty);

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdMTLType.Views[0];
                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "SEQ_NO", this.txtSEQ_NO.Text);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntMaterial.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }
            }
        }
        public void UpdateQCReturn()
        {
            string      result   = string.Empty;
            QCReturnHdr qcReturn = new QCReturnHdr();

            try
            {
                #region "QC Return Header"

                qcReturn.RT_NO    = this.txtRT_NO.Text;
                qcReturn.RT_DATE  = this.txtRT_DATE.DateTime;
                qcReturn.WH_ID    = this.lueWarehouse.EditValue.ToString();
                qcReturn.RT_TYPE  = this.lueReturnType.EditValue.ToString();
                qcReturn.REMARK   = this.txtREMARK.Text;
                qcReturn.REC_STAT = (bool)this.icbREC_STAT.EditValue;

                #endregion

                using (QCReturnBLL qcReturnBll = new QCReturnBLL())
                {
                    result = qcReturnBll.UpdateQCReturn(qcReturn, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Update Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.FormState = eFormState.ReadOnly;
                //Get all Invoice on Invoice List
                this.GetQCReturnList(this.lueWarehouse.EditValue.ToString(), null, null);

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdQCReturn.Views[0];
                    viewList.ClearSorting();

                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "RT_NO", qcReturn.RT_NO);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntQCReturn.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }

                this.Cursor = Cursors.Default;
            }
        }
Example #5
0
        private void InsertUser()
        {
            string result = string.Empty;

            try
            {
                User user = new User();

                user.USER_ID     = (string)this.txtUSER_ID.EditValue;
                user.USER_NAME   = (string)this.txtUSER_NAME.EditValue;
                user.WARE_ID     = (string)this.txtWARE_ID.EditValue;
                user.LOGIN       = (string)this.txtLOGIN.EditValue;
                user.PWD         = (string)this.txtPWD.EditValue;
                user.EMPLOYEE_ID = (string)UiUtility.IsNullValue(this.txtEMPLOYEE_ID.EditValue, "");
                user.ROLE_ID     = (string)this.lueDefaultRole.EditValue;

                user.REMARK   = (string)UiUtility.IsNullValue(this.txtREMARK.EditValue, "");
                user.EMAIL    = (string)UiUtility.IsNullValue(this.txtEMAIL.EditValue, "");
                user.COMP_ID  = (string)UiUtility.IsNullValue(this.txtCOMP_ID.EditValue, "");
                user.REC_STAT = (bool)this.icbREC_STAT.EditValue;

                using (AdministratorBLL adminBll = new AdministratorBLL())
                {
                    result = adminBll.InsertUser(user, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    this.UpdateUserRole();
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.FormState = eFormState.ReadOnly;
                //Get all Invoice on Invoice List
                this.GetUserList();

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdUserList.Views[0];
                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "USER_ID", this.txtUSER_ID.Text);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntUser.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }
            }
        }
Example #6
0
        public void InsertMaterial()
        {
            string   result   = string.Empty;
            Material material = null;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                material = new Material();

                material.MTL_SEQ_NO = this.txtMTL_SEQ_NO.Text;
                material.MTL_CODE   = this.txtMTL_CODE.Text;
                material.MTL_NAME   = this.txtMTL_NAME.Text;
                material.MTL_GRADE  = this.txtMTL_GRADE.Text;
                material.MTL_COLOR  = this.txtMTL_COLOR.Text;
                if (this.lueUNIT.EditValue != null)
                {
                    material.UNIT = (string)this.lueUNIT.EditValue;
                }
                material.STD_QTY   = Convert.ToDecimal(this.txtSTD_QTY.EditValue, NumberFormatInfo.InvariantInfo);
                material.MIN_QTY   = Convert.ToDecimal(this.txtMIN_QTY.EditValue, NumberFormatInfo.InvariantInfo);
                material.MAX_QTY   = Convert.ToDecimal(this.txtMAX_QTY.EditValue, NumberFormatInfo.InvariantInfo);
                material.PARTY_ID  = this.btePARTY_ID.Text;
                material.MTL_IMAGE = (Bitmap)this.picMTL_IMAGE.Image;
                if (this.lueLOCATION_ID.EditValue != null)
                {
                    material.LOCATION_ID = (string)this.lueLOCATION_ID.EditValue;
                }
                material.REMARK   = this.txtREMARK.Text;
                material.REC_STAT = (bool)this.icbREC_STAT.EditValue;

                string userid = ((frmMainMenu)this.ParentForm).UserID;
                using (MaterialBLL materialBll = new MaterialBLL())
                {
                    result = materialBll.InsertMaterial(ref material, userid);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.Cursor    = Cursors.Default;
                this.FormState = eFormState.ReadOnly;

                this.GetMaterialList(string.Empty);

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdMaterial.Views[0];

                    viewList.ClearSorting();

                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "MTL_SEQ_NO", material.MTL_SEQ_NO);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntProduct.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }
            }
        }
Example #7
0
        private void UpdateProgram()
        {
            string result = string.Empty;

            try
            {
                M_Program program = new M_Program();

                program.PROG_ID   = (string)this.txtPROG_ID.EditValue;
                program.PROG_NAME = (string)UiUtility.IsNullValue(this.txtPROG_NAME.EditValue, "");
                program.PROG_KEY  = (string)UiUtility.IsNullValue(this.txtPROG_KEY.EditValue, "");
                program.PROG_TYPE = (string)this.luePROG_TYPE.EditValue;
                if (this.txtORDER_BY.EditValue != null)
                {
                    program.ORDER_BY = (int)this.txtORDER_BY.EditValue;
                }

                program.ICON        = (string)UiUtility.IsNullValue(this.txtICON.EditValue, "");
                program.DESCRIPTION = (string)UiUtility.IsNullValue(this.txtDESCRIPTION.EditValue, "");
                program.REC_STAT    = (bool)this.icbREC_STAT.EditValue;



                using (AdministratorBLL adminBll = new AdministratorBLL())
                {
                    result = adminBll.UpdateProgram(program, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    GridView view = (GridView)this.grdProgramList.Views[0];
                    view.BeginDataUpdate();

                    view.SetFocusedRowCellValue("PROG_ID", program.PROG_ID);
                    view.SetFocusedRowCellValue("PROG_NAME", program.PROG_NAME);
                    view.SetFocusedRowCellValue("PROG_TYPE", program.PROG_TYPE);
                    view.SetFocusedRowCellValue("ORDER_BY", program.ORDER_BY);
                    view.SetFocusedRowCellValue("REC_STAT", program.REC_STAT);

                    view.EndDataUpdate();

                    NotifierResult.Show("Update Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                NotifierResult.Show(ex.Message, "Error", 50, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.FormState = eFormState.ReadOnly;
                //Get all Invoice on Invoice List
                this.lueProgramType.EditValue = this.luePROG_TYPE.EditValue;

                this.GetProgramList(this.lueProgramType.EditValue.ToString(), string.Empty);

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdProgramList.Views[0];
                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "PROG_ID", this.txtPROG_ID.Text);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntProgram.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }

                    //Reload Menu
                    ((frmMainMenu)this.ParentForm).ReloadMenu();
                }
            }
        }
Example #8
0
        public void InsertProduct()
        {
            string             result         = string.Empty;
            List <ProdProcess> lstProdProcess = null;
            Product            prod           = null;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                prod = new Product();

                prod.PROD_SEQ_NO     = this.txtPROD_SEQ_NO.Text;
                prod.PRODUCT_NO      = this.txtPRODUCT_NO.Text;
                prod.PRODUCT_NAME    = this.txtPRODUCT_NAME.Text;
                prod.MATERIAL_TYPE   = this.lblMATERIAL_TYPE_CODE.Text;
                prod.PRODUCTION_TYPE = (string)this.luePRODUCTION_TYPE.EditValue;
                prod.MC_NO           = this.lblMC_NO_VALUE.Text;
                prod.BOX_QTY         = Convert.ToInt32(this.txtBOX_QTY.EditValue, NumberFormatInfo.InvariantInfo);
                prod.UNIT            = (string)this.lueUNIT.EditValue;
                prod.PROD_IMAGE      = (Bitmap)this.picPROD_IMAGE.Image;
                prod.REMARK          = this.txtREMARK.Text;
                prod.REC_STAT        = (bool)this.icbREC_STAT.EditValue;

                //add new insert property on 07-Jun-2011
                prod.CUST_PROD_NO  = this.txtCUST_PROD_NO.Text;
                prod.BUYER_PRICE   = (this.txtBUYER_PRICE.EditValue as decimal?) ?? 0.0M;
                prod.SELLING_PRICE = (this.txtSELLING_PRICE.EditValue as decimal?) ?? 0.0M;
                prod.COST_PRICE    = (this.txtCOST_PRICE.EditValue as decimal?) ?? 0.0M;

                if (this.dtbProdProcess.Rows.Count != 0)
                {
                    lstProdProcess = new List <ProdProcess>();
                    int         flag = 0;
                    ProdProcess prodProcess;
                    foreach (DataRow rowProdProcess in this.dtbProdProcess.Rows)
                    {
                        flag = Convert.ToInt32(rowProdProcess["FLAG"], NumberFormatInfo.CurrentInfo);
                        if (flag == 2)
                        {
                            prodProcess             = new ProdProcess();
                            prodProcess.PROD_SEQ_NO = rowProdProcess["PROD_SEQ_NO"].ToString();
                            prodProcess.PROCESS_NO  = rowProdProcess["PROCESS_NO"].ToString();
                            prodProcess.STEP_NO     = (int)rowProdProcess["STEP_NO"];
                            prodProcess.REC_STAT    = (bool)rowProdProcess["REC_STAT"];

                            lstProdProcess.Add(prodProcess);
                        }
                    }
                }

                string userid = ((frmMainMenu)this.ParentForm).UserID;
                using (ProductBLL prodBll = new ProductBLL())
                {
                    result = prodBll.InsertProduct(ref prod, userid);

                    if (lstProdProcess != null)
                    {
                        prodBll.UpdateProductionProcess(lstProdProcess, userid);
                    }
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.Cursor    = Cursors.Default;
                this.FormState = eFormState.ReadOnly;

                this.GetProductList(string.Empty);

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdProduct.Views[0];

                    viewList.ClearSorting();

                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "PROD_SEQ_NO", prod.PROD_SEQ_NO);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntProduct.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }
            }
        }
        private void UpdateProgramType()
        {
            ProgramType programType = null;
            string      result      = string.Empty;

            try
            {
                DataRow rowProgramType = this.dtbProgramType.Rows[0];
                if (rowProgramType != null)
                {
                    programType = new ProgramType();

                    programType.PROG_TYPE      = rowProgramType["PROG_TYPE"].ToString().ToUpper();
                    programType.PROG_TYPE_NAME = rowProgramType["PROG_TYPE_NAME"].ToString();
                    programType.REC_STAT       = (bool)rowProgramType["REC_STAT"];

                    if (!rowProgramType["ORDER_BY"].GetType().Equals(typeof(System.DBNull)))
                    {
                        programType.ORDER_BY = Convert.ToInt32(rowProgramType["ORDER_BY"].ToString());
                    }
                    programType.ICON = rowProgramType["ICON"].ToString();
                }

                using (AdministratorBLL adminBll = new AdministratorBLL())
                {
                    result = adminBll.UpdateProgramType(programType, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Update Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                NotifierResult.Show(ex.Message, "Error", 50, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.GetProgramTypeList();

                this.FormState = eFormState.ReadOnly;

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdProgramType.Views[0];
                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "PROG_TYPE", programType.PROG_TYPE);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntProgramType.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }

                this.btnAddNew.Visible = true;
                this.btnExit.Visible   = true;
            }
        }