Example #1
0
        public static bool SaveReactionStepsInfo(DmlOperations dmlEnum, StepInfo rxnStep, out DataTable dtResult)
        {
            bool      blStatus    = false;
            string    strTemp     = String.Empty;
            DataTable dtReactions = new DataTable();

            try
            {
                using (OracleConnection oraCon = ConnectionDB.GetOracleConnection())
                {
                    using (OracleCommand oraCmd = new OracleCommand())
                    {
                        oraCmd.Connection  = oraCon;
                        oraCmd.CommandText = "REACTION_ANALYSIS.DML_REACTION_STEPS";
                        oraCmd.CommandType = CommandType.StoredProcedure;

                        oraCmd.Parameters.Add("PIN_RXN_STEP_ID", OracleDbType.Int32).Value  = rxnStep.StepID;
                        oraCmd.Parameters.Add("PIN_REACTION_ID", OracleDbType.Int32).Value  = rxnStep.ReactionID;
                        oraCmd.Parameters.Add("PIN_RXN_STEP_SNO", OracleDbType.Int32).Value = rxnStep.SerialNo;
                        oraCmd.Parameters.Add("PIN_YIELD", OracleDbType.Varchar2).Value     = rxnStep.StepYield;
                        oraCmd.Parameters.Add("PIC_OPTION", OracleDbType.Varchar2).Value    = dmlEnum.ToString();

                        OracleParameter paramStatus = new OracleParameter();
                        paramStatus.ParameterName = "POC_STATUS";
                        paramStatus.Direction     = ParameterDirection.Output;
                        paramStatus.OracleDbType  = OracleDbType.Varchar2;
                        paramStatus.Size          = 200;
                        oraCmd.Parameters.Add(paramStatus);


                        oraCmd.Parameters.Add("PORC_REACTIONS", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                        //TODO: Need to discuss with sairam to add UR_ID.
                        // oraCmd.Parameters.Add("PIN_UR_ID", OracleDbType.Int32).Value = usrInfo.UserID;

                        using (OracleDataAdapter dataAdapter = new OracleDataAdapter(oraCmd))
                        {
                            dataAdapter.Fill(dtReactions);
                        }
                        if (paramStatus.Value != null)
                        {
                            strTemp = Convert.ToString(oraCmd.Parameters["POC_STATUS"].Value);
                            if (strTemp.ToUpper() == "UPDATE SUCCESS" && dmlEnum == DmlOperations.UPDATE)
                            {
                                blStatus = true;
                            }
                            else if (strTemp.ToUpper() == "INSERT SUCCESS" && dmlEnum == DmlOperations.INSERT)
                            {
                                blStatus = true;
                            }
                            else if (strTemp.ToUpper() == "DELETE SUCCESS" && dmlEnum == DmlOperations.DELETE)
                            {
                                blStatus = true;
                            }
                        }
                        dtResult = dtReactions;
                        return(blStatus);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            dtResult = dtReactions;
            return(blStatus);
        }
Example #2
0
        public static bool SaveReactionInfo(DmlOperations dmlEnum, ReactionInfo rxnInfo, out DataTable dtResult)
        {
            bool      blStatus    = false;
            string    strTemp     = String.Empty;
            DataTable dtReactions = new DataTable();

            try
            {
                using (OracleConnection oraCon = ConnectionDB.GetOracleConnection())
                {
                    using (OracleCommand oraCmd = new OracleCommand())
                    {
                        oraCmd.Connection  = oraCon;
                        oraCmd.CommandText = "REACTION_ANALYSIS.DML_REACTIONS";
                        oraCmd.CommandType = CommandType.StoredProcedure;

                        oraCmd.Parameters.Add("PIN_REACTION_ID", OracleDbType.Int32).Value         = rxnInfo.ReactionID;
                        oraCmd.Parameters.Add("PIN_DOC_ID", OracleDbType.Int32).Value              = rxnInfo.ShipmentRefID;
                        oraCmd.Parameters.Add("PIC_REACTION_SCHEME", OracleDbType.Clob).Value      = rxnInfo.ReactionScheme;
                        oraCmd.Parameters.Add("PIN_REACTION_SNO", OracleDbType.Int32).Value        = rxnInfo.ReactionSNo;
                        oraCmd.Parameters.Add("PIC_OPTION", OracleDbType.Varchar2).Value           = dmlEnum.ToString();
                        oraCmd.Parameters.Add("PIC_RXN_COMMENTS", OracleDbType.Varchar2).Value     = rxnInfo.RxnComments;
                        oraCmd.Parameters.Add("PIC_RXN_MAPPING_TYPE", OracleDbType.Varchar2).Value = rxnInfo.AtomMappingType;

                        oraCmd.Parameters.Add("PIC_COMPLETED_STATUS", OracleDbType.Varchar2).Value = rxnInfo.RxnCompleteStatus;
                        oraCmd.Parameters.Add("PIC_ROLE_NAME", OracleDbType.Varchar2).Value        = rxnInfo.RoleName;
                        oraCmd.Parameters.Add("PIC_IS_IMPORTANT", OracleDbType.Varchar2).Value     = rxnInfo.IsImportantRxn;
                        oraCmd.Parameters.Add("PIN_UR_ID", OracleDbType.Int32).Value = rxnInfo.UR_ID;

                        OracleParameter paramStatus = new OracleParameter();
                        paramStatus.ParameterName = "POC_STATUS";
                        paramStatus.Direction     = ParameterDirection.Output;
                        paramStatus.OracleDbType  = OracleDbType.Varchar2;
                        paramStatus.Size          = 200;
                        oraCmd.Parameters.Add(paramStatus);


                        oraCmd.Parameters.Add("PORC_REACTIONS", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                        //TODO: Need to discuss with sairam to add UR_ID.
                        // oraCmd.Parameters.Add("PIN_UR_ID", OracleDbType.Int32).Value = usrInfo.UserID;

                        using (OracleDataAdapter dataAdapter = new OracleDataAdapter(oraCmd))
                        {
                            dataAdapter.Fill(dtReactions);
                        }
                        if (paramStatus.Value != null)
                        {
                            if (paramStatus.Value.ToString().Length > 0)
                            {
                                strTemp = Convert.ToString(oraCmd.Parameters["POC_STATUS"].Value);
                                if (strTemp.ToUpper() == "UPDATE SUCCESS" && dmlEnum == DmlOperations.UPDATE)
                                {
                                    blStatus = true;
                                }
                                else if (strTemp.ToUpper() == "INSERT SUCCESS" && dmlEnum == DmlOperations.INSERT)
                                {
                                    blStatus = true;
                                }
                                else if (strTemp.ToUpper() == "DELETE SUCCESS" && dmlEnum == DmlOperations.DELETE)
                                {
                                    blStatus = true;
                                }
                            }
                        }
                        dtResult = dtReactions;
                        return(blStatus);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(blStatus);
        }