private void metroButton2_Click(object sender, EventArgs e)
 {
     this.Close();
     MyCaller._itemno   = "";
     MyCaller._yearused = 0;
     MyCaller.LoadExistingItem();
 }
 private void frmExistingItemLoad_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (isNoOtherActivity)
     {
         MyCaller.mtxtItemNo.Text = "";
         MyCaller.RefreshForm();
     }
 }
Exemple #3
0
        private void SaveRecord()
        {
            try
            {
                FormHelpers.CursorWait(true);
                if (IsValid())
                {
                    var isSuccess = false;
                    var msg       = "";
                    AssignRecord(true);
                    switch (MyState)
                    {
                    case FormState.Add:
                        msg = "Saving";
                        if (pibal.Save(pi))
                        {
                            isSuccess = true;
                        }
                        break;

                    case FormState.Edit:
                        msg = "Updating";
                        if (pibal.Update(pi))
                        {
                            isSuccess = true;
                        }
                        break;
                    }
                    if (isSuccess)
                    {
                        MessageHelpers.ShowInfo(msg + " Successful!");
                        MyCaller.Init_Form();
                        this.Close();
                    }
                    else
                    {
                        MessageHelpers.ShowWarning(msg + " Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
        private void mgridList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                foreach (DataGridViewRow row in mgridList.SelectedRows)
                {
                    _yearused = Convert.ToInt32(row.Cells[0].Value);
                    _itemno   = row.Cells[1].Value.ToString();
                }
                MyCaller._yearused = _yearused;
                MyCaller._itemno   = _itemno;
                MyCaller.LoadExistingItem();
                isNoOtherActivity = false;
                this.Close();
            }
        }
Exemple #5
0
        private void mbtnAdd_Click(object sender, EventArgs e)
        {
            //GridRefresh();
            try
            {
                FormHelpers.CursorWait(true);
                Int32 selectedRowCount = mgridList.Rows.GetRowCount(DataGridViewElementStates.Selected);
                for (int i = 0; i < selectedRowCount; i++)
                {
                    colname = this.mgridList.Columns[2].Name;
                    no      = mgridList.SelectedRows[i].Cells[colname].Value.ToString();
                    if (MyCaller != null)
                    {
                        MyCaller.yearused = yused;
                    }
                    switch (KindOfList)
                    {
                    case "CL":
                        MyCaller.partnoCL = no;
                        MyCaller.LoadGridCL();
                        break;

                    case "MT_PI":
                        MyCaller.moldno = no;
                        MyCaller.LoadGridPI();
                        break;

                    case "MT_VP":
                        MyCaller.partnoVP = no;
                        MyCaller.LoadGridVP();
                        break;

                    case "MT_ASSY":
                        MyCaller.partnoAssy = no;
                        MyCaller.LoadGridAssy();
                        break;

                    case "MPT":
                        var scode = mgridList.SelectedRows[i].Cells[2].Value.ToString();
                        MyCaller.sectioncode = scode.ToString();
                        MyCaller.LoadGridMPT();
                        break;

                    case "ITEM":
                        var icode = mgridList.SelectedRows[i].Cells[2].Value.ToString();
                        var item  = itembal.GetAll().Where(w => w.YEARUSED == yused && w.ItemNo == icode).FirstOrDefault();
                        if (MyCaller_Copier != null)
                        {
                            item = itembal.GetAll().Where(w => w.YEARUSED == PreviousYear && w.ItemNo == icode).FirstOrDefault();
                            MyCaller_Copier.mtxtItemNo.Text = item.ItemNo;
                        }
                        else if (MyCaller_scr != null)
                        {
                            MyCaller_scr.mtxtItemNo.Text   = item.ItemNo;
                            MyCaller_scr.mtxtItemDesc.Text = item.Description;
                        }
                        break;

                    case "CAT":
                        var ccode = mgridList.SelectedRows[i].Cells[2].Value.ToString();
                        cat = catbal.GetByID(ccode, PreviousYear);
                        MyCaller_CopierCat.mtxtCatCode.Text = cat.CATCODE;
                        MyCaller_CopierCat.mtxtCatDesc.Text = cat.CATDESC;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
            this.Close();
        }