コード例 #1
0
        public frmProcessSetup()
        {
            InitializeComponent();
            defbal  = new DefaultBAL();
            procbal = new ProcessSetupBAL();

            proc = new tbl_000_PROCESS();
        }
コード例 #2
0
        private void AssignRecord()
        {
            Boolean IsAdding = false;

            proclist_toadd    = new List <tbl_000_PROCESS>();
            proclist_toupdate = new List <tbl_000_PROCESS>();
            proclist_gridall  = new List <tbl_000_PROCESS>();
            try
            {
                if (mgridList.RowCount > 0)
                {
                    for (int i = 0; i < mgridList.RowCount; i++)
                    {
                        if (mgridList.Rows[i].IsNewRow)
                        {
                            continue;
                        }

                        int    existingyear     = Convert.ToInt32(mgridList.Rows[i].Cells["colYEARUSED"].Value);
                        string existingsubpcode = mgridList.Rows[i].Cells["colSubProcessCode"].Value.ToString();
                        proc = procbal.GetAll().Where(w => w.YEARUSED == existingyear && w.SubProcessCode == existingsubpcode).FirstOrDefault();
                        if (proc == null)
                        {
                            proc     = new tbl_000_PROCESS();
                            IsAdding = true;
                        }
                        proc.SubProcessCode  = mgridList.Rows[i].Cells["colSubProcessCode"].Value.ToString();
                        proc.ItemDescription = mgridList.Rows[i].Cells["colItemDesc"].Value.ToString();
                        proc.ProcessCode     = mcboDefaults.SelectedValue.ToString();
                        proc.StandardA       = Convert.ToDecimal(mgridList.Rows[i].Cells["colSP_HC"].Value);
                        proc.StandardB       = Convert.ToDecimal(mgridList.Rows[i].Cells["colCavity"].Value);
                        proc.Remarks         = BPSUtilitiesV1.NZ(mgridList.Rows[i].Cells["colRemarks"].Value, "").ToString();
                        if (IsAdding)
                        {
                            //to add
                            proc.YEARUSED    = UserSettings.LogInYear;
                            proc.CreatedDate = DateTime.Now;
                            proc.CreatedBy   = UserSettings.Username;
                            proc.IsCopied    = false;
                            proc.CopyDate    = DateTime.Now;
                            proc.IsImported  = false;
                            proc.ImportDate  = DateTime.Now;
                            proc.ImportBy    = UserSettings.Username;
                            proclist_toadd.Add(proc);
                        }
                        else
                        {
                            //to update
                            proc.UpdatedDate = DateTime.Now;
                            proc.UpdatedBy   = UserSettings.Username;
                            proclist_toupdate.Add(proc);
                        }
                        //all data
                        proclist_gridall.Add(proc);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }