Пример #1
0
        private void btnQCDone_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvReactions.Rows.Count > 0)
                {
                    List <int> lstRxnIDs = GetSelectedRxnIDsFromGrid();
                    if (lstRxnIDs != null)
                    {
                        if (ReactionCurationDB.UpdateReactionsQCCompleteStatus(ShipmentRefID, lstRxnIDs, GlobalVariables.UR_ID))
                        {
                            //Refresh Reactions table
                            ReactionInfo objReactionInfo = new ReactionInfo();
                            objReactionInfo.ShipmentRefID = ShipmentRefID;
                            DataTable dtReaction = new DataTable();
                            ReactionCurationDB.SaveReactionInfo(DmlOperations.SELECT, objReactionInfo, out dtReaction);

                            DataTable dtNonQcRxns = GetQcNotCompletedReactionsFromTable(dtReaction);

                            if (dtNonQcRxns != null)
                            {
                                if (dtNonQcRxns.Rows.Count == 0)
                                {
                                    QC_Done      = true;
                                    DialogResult = System.Windows.Forms.DialogResult.OK;
                                    this.Close();
                                }
                                else
                                {
                                    BindNonQCReactionsToGrid(dtNonQcRxns);
                                }
                            }
                            //else
                            //{
                            //    QC_Done = true;
                            //    DialogResult = System.Windows.Forms.DialogResult.OK;
                            //    this.Close();
                            //}
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.WriteErrorLog(ex.ToString());
            }
        }
Пример #2
0
        private void btnCreateRxn_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dtReactions = null;
                int       newRxnSNo   = 0;
                if (cmbRxnNo.SelectedItem != null)
                {
                    int selRxnNo = Convert.ToInt32(cmbRxnNo.Text);
                    newRxnSNo = rbnAfter.Checked ? selRxnNo + 1 : selRxnNo;
                }
                else if (ReactionsTbl.Rows.Count == 0)
                {
                    newRxnSNo = 1;
                }

                if (!chkDuplicateWithRxn.Checked)//New Reaction
                {
                    ReactionInfo rxnInfo = new ReactionInfo();
                    rxnInfo.ShipmentRefID = ShipmentRefID;
                    rxnInfo.ReactionSNo   = newRxnSNo;
                    rxnInfo.UR_ID         = GlobalVariables.UR_ID;

                    if (ReactionCurationDB.SaveReactionInfo(DmlOperations.INSERT, rxnInfo, out dtReactions))
                    {
                        ReactionsTbl = dtReactions;
                        DialogResult = System.Windows.Forms.DialogResult.OK;

                        var query = from r in dtReactions.AsEnumerable()
                                    where r.Field <Int64>("REACTION_SNO") == newRxnSNo
                                    select new
                        {
                            NewRxn_Id = r["REACTION_ID"]
                        };

                        if (query != null)
                        {
                            NewRxnID  = Convert.ToInt32(query.ElementAt(0).NewRxn_Id);
                            NewRxnSNo = newRxnSNo;
                        }

                        DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error in adding new reaction", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else //Duplicate Reaction
                {
                    DialogResult diaRes = MessageBox.Show("Do you want to duplicate the reaction?", GlobalVariables.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (diaRes == System.Windows.Forms.DialogResult.Yes)
                    {
                        int dupRxnID = cmbDuplicateWithRxn.SelectedItem != null?Convert.ToInt32(cmbDuplicateWithRxn.SelectedValue) : 0;

                        int newRxnID = ReactionCurationDB.DuplicateReactionData(ShipmentRefID, dupRxnID, newRxnSNo, GlobalVariables.UR_ID);
                        if (newRxnID > 0)
                        {
                            NewRxnID     = newRxnID;
                            NewRxnSNo    = newRxnSNo;
                            DuplicateRxn = true;
                            DialogResult = System.Windows.Forms.DialogResult.OK;
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Error in duplicating reaction", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.WriteErrorLog(ex.ToString());
            }
        }