Example #1
0
        /// <summary>
        /// To Get Consultant Type
        /// </summary>
        /// <returns></returns>
        public ConsultantTypeList GetConsultantType()
        {
            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_MST_GET_CONSULTANT";

            cmd             = new OracleCommand(proc, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader   dr                 = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ConsultantTypeBO   objTypeBO          = null;
            ConsultantTypeList objConsultantTypes = new ConsultantTypeList();

            while (dr.Read())
            {
                objTypeBO = new ConsultantTypeBO();
                objTypeBO.ConsultantTypeID = dr.GetInt32(dr.GetOrdinal("CONSULTANTTYPEID"));
                objTypeBO.ConsultantType   = dr.GetString(dr.GetOrdinal("CONSULTANTTYPE"));
                objConsultantTypes.Add(objTypeBO);
            }

            dr.Close();
            return(objConsultantTypes);
        }
Example #2
0
        //get the data in mst_Concern table using USP_MST_GETSELECTCONCERN-SP signal Data based on ID
        public ConsultantTypeBO GetConsultantTypeId(int consultantTypeID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GET_CONSULTANTTYPE";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("c_consultanttype", consultantTypeID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();

            OracleDataReader   dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ConsultantTypeBO   objconsultantType = null;
            ConsultantTypeList Users             = new ConsultantTypeList();

            objconsultantType = new ConsultantTypeBO();
            while (dr.Read())
            {
                if (ColumnExists(dr, "CONSULTANTTYPE") && !dr.IsDBNull(dr.GetOrdinal("CONSULTANTTYPE")))
                {
                    objconsultantType.ConsultantType = dr.GetString(dr.GetOrdinal("CONSULTANTTYPE"));
                }
                if (ColumnExists(dr, "CONSULTANTTYPEID") && !dr.IsDBNull(dr.GetOrdinal("CONSULTANTTYPEID")))
                {
                    objconsultantType.ConsultantTypeID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CONSULTANTTYPEID")));
                }
            }
            dr.Close();


            return(objconsultantType);
        }
Example #3
0
        /// <summary>
        /// to insert data to database
        /// </summary>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string            message = "";
            ConsultantTypeBLL ConsultantTypeBLLobj = null;

            try
            {
                ConsultantTypeBLLobj = new ConsultantTypeBLL();
                ConsultantTypeBO objconsultantType = new ConsultantTypeBO();

                if (Convert.ToInt32(ViewState["consultantTypeID"]) > 0)
                {
                    objconsultantType.ConsultantType   = consultanttypeTextBox.Text.Trim();
                    objconsultantType.ConsultantTypeID = Convert.ToInt32(ViewState["consultantTypeID"]);

                    message = ConsultantTypeBLLobj.EDITConsultantType(objconsultantType);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                    }

                    SetUpdateMode(false);
                }
                else
                {
                    objconsultantType.ConsultantType = consultanttypeTextBox.Text.Trim();
                    objconsultantType.CreatedBy      = Convert.ToInt32(Session["USER_ID"]);

                    message = ConsultantTypeBLLobj.insert(objconsultantType);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                    }
                }

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                clearfields();
                BindGrid(true, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ConsultantTypeBLLobj = null;
            }
        }
Example #4
0
        /// <summary>
        /// get the Grid value into textBox
        /// </summary>
        private void GetConsultantTypeDetails()
        {
            ConsultantTypeBLL ConsultantTypeBLLobj = new ConsultantTypeBLL();
            int consultantTypeID = 0;

            if (ViewState["consultantTypeID"] != null)
            {
                consultantTypeID = Convert.ToInt32(ViewState["consultantTypeID"]);
            }

            ConsultantTypeBO objconsultantType = new ConsultantTypeBO();

            objconsultantType = ConsultantTypeBLLobj.GetConsultantTypeId(consultantTypeID);

            consultanttypeTextBox.Text = objconsultantType.ConsultantType;
        }
Example #5
0
        /// <summary>
        /// To EDIT Consultant Type
        /// </summary>
        /// <param name="objconsultantType"></param>
        /// <returns></returns>
        public string EDITConsultantType(ConsultantTypeBO objconsultantType)
        {
            ConsultantTypeDAL ConsultantTypeDALobj = new ConsultantTypeDAL(); //Data pass -to Database Layer

            try
            {
                return(ConsultantTypeDALobj.EDITConsultantType(objconsultantType));
            }
            catch
            {
                throw;
            }
            finally
            {
                ConsultantTypeDALobj = null;
            }
        }
Example #6
0
        /// <summary>
        /// To insert into database
        /// </summary>
        /// <param name="objconsultantType"></param>
        /// <returns></returns>
        public string insert(ConsultantTypeBO objconsultantType)
        {
            string           returnResult = "";
            OracleConnection cnn          = new OracleConnection(AppConfiguration.ConnectionString);

            cnn.Open();
            OracleCommand dcmd = new OracleCommand("USP_MST_INS_CONSULTANTTYPE", cnn);

            dcmd.CommandType = CommandType.StoredProcedure;
            int count = Convert.ToInt32(dcmd.CommandType);

            try
            {
                dcmd.Parameters.Add("CONSULTANTTYPE_", objconsultantType.ConsultantType);
                dcmd.Parameters.Add("CREATEDBY", objconsultantType.CreatedBy);
                dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;

                dcmd.ExecuteNonQuery();

                if (dcmd.Parameters["errorMessage_"].Value != null)
                {
                    returnResult = dcmd.Parameters["errorMessage_"].Value.ToString();
                }

                return(returnResult);
            }
            catch
            {
                throw;
            }
            finally
            {
                dcmd.Dispose();
                cnn.Close();
                cnn.Dispose();
            }
        }