Esempio n. 1
0
 /// <summary>
 /// To Add Consultant
 /// </summary>
 /// <param name="objCon"></param>
 /// <returns></returns>
 public string AddConsultant(ConsultantBO objCon)
 {
     {
         ConsultantDAL objConDAL = new ConsultantDAL();
         return(objConDAL.AddConsultant(objCon));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// To Add Consultant
        /// </summary>
        /// <param name="objCon"></param>
        /// <returns></returns>
        public string AddConsultant(ConsultantBO objCon)
        {
            string result = "";

            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);

            OracleCommand myCommand;

            myCommand             = new OracleCommand("USP_TRN_INS_CONSULTANT", con);
            myCommand.Connection  = con;
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.Parameters.Add("CONSULTANTNAME_", objCon.ConsultName);
            myCommand.Parameters.Add("PROJECTID_", objCon.ProjectID);
            myCommand.Parameters.Add("CONSULTANTTYPE_", objCon.ConsultType);
            myCommand.Parameters.Add("ADDRESS_", objCon.Address);
            myCommand.Parameters.Add("CONTACTNUMBER_", objCon.ConNumber);
            myCommand.Parameters.Add("CONTACTPERSON_", objCon.ConPerson);
            myCommand.Parameters.Add("EMAILADDRESS_", objCon.EmailAddress);
            myCommand.Parameters.Add("ISDELETEDIN_", "False");
            myCommand.Parameters.Add("CREATEDBY_", objCon.CreatedBy);
            myCommand.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;

            con.Open();
            myCommand.ExecuteNonQuery();
            con.Close();

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

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// To Get Consultant By ID
        /// </summary>
        public ConsultantBO GetConsultantByID(int ConID)
        {
            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_TRN_GET_CONSULTANTBYID";

            cmd             = new OracleCommand(proc, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("CONSULTANTID", ConID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr         = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ConsultantBO     objCon     = null;
            ConsultantList   objConList = new ConsultantList();

            while (dr.Read())
            {
                objCon              = new ConsultantBO();
                objCon.ConsultID    = (Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CONSULTANTID"))));
                objCon.ConsultName  = dr.GetValue(dr.GetOrdinal("CONSULTANTNAME")).ToString();
                objCon.ConsultType  = dr.GetValue(dr.GetOrdinal("CONSULTATIONTYPE")).ToString();
                objCon.ConPerson    = dr.GetValue(dr.GetOrdinal("CONTACTPERSON")).ToString();
                objCon.ConNumber    = dr.GetValue(dr.GetOrdinal("CONTACTNUMBER")).ToString();
                objCon.Address      = dr.GetValue(dr.GetOrdinal("ADDRESS")).ToString();
                objCon.EmailAddress = dr.GetValue(dr.GetOrdinal("EMAILADDRESS")).ToString();
                objConList.Add(objCon);
            }

            dr.Close();
            return(objCon);
        }
Esempio n. 4
0
        /// <summary>
        /// To Update Consultant
        /// </summary>
        /// <param name="objCon"></param>
        /// <returns></returns>
        public int UpdateConsultant(ConsultantBO objCon)
        {
            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);
            int result           = 0;

            {
                OracleCommand myCommand;
                myCommand             = new OracleCommand("USP_TRN_UPD_CONSULTANT", con);
                myCommand.Connection  = con;
                myCommand.CommandType = CommandType.StoredProcedure;
                myCommand.Parameters.Add("CONSULTANTID", objCon.ConsultID);

                myCommand.Parameters.Add("@CONSULTANTNAME", objCon.ConsultName);
                myCommand.Parameters.Add("@CONSULTATIONTYPE", objCon.ConsultType);
                myCommand.Parameters.Add("@ADDRESS", objCon.Address);
                myCommand.Parameters.Add("@CONTACTPERSON", objCon.ConPerson);
                myCommand.Parameters.Add("@CONTACTNUMBER", objCon.ConNumber);
                myCommand.Parameters.Add("@EMAILADDRESS", objCon.EmailAddress);
                myCommand.Parameters.Add("UPDATEDBY", objCon.UpdatedBy);

                con.Open();
                result = myCommand.ExecuteNonQuery();
                con.Close();
            }
            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid(bool addRow, bool deleteRow)
        {
            ConsultantBO  objCon    = new ConsultantBO();
            ConsultantBLL objConBLL = new ConsultantBLL();

            grdConsultant.DataSource = objConBLL.GetConsultant(Convert.ToInt32(Session["PROJECT_ID"]));
            grdConsultant.DataBind();
        }
Esempio n. 6
0
        /// <summary>
        /// To bind values to dropdownlist
        /// </summary>
        private void Bindconsultantname()
        {
            ConsultantBO  objCon    = new ConsultantBO();
            ConsultantBLL objConBLL = new ConsultantBLL();

            ddlconsultantname.DataSource     = objConBLL.GetConsultant(0);
            ddlconsultantname.DataTextField  = "ConsultName";
            ddlconsultantname.DataValueField = "ConsultID";
            ddlconsultantname.DataBind();
        }
Esempio n. 7
0
        /// <summary>
        /// Saves details to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            string       message = "";
            ConsultantBO objCon  = new ConsultantBO();

            objCon.ConsultID    = int.Parse(ViewState["CONSULTANTID"].ToString());
            objCon.ProjectID    = Convert.ToInt32(Session["PROJECT_ID"]);
            objCon.ConsultName  = txtConsultantname.Text.Trim();
            objCon.ConsultType  = DrpConsultantType.SelectedItem.Value;
            objCon.EmailAddress = TxtEmailaddress.Text.Trim();
            string strMax = TxtAddress.Text.ToString().Trim();

            if (strMax.Trim().Length >= 399)
            {
                strMax = TxtAddress.Text.ToString().Trim().Substring(0, 399);
            }
            objCon.Address   = strMax;
            objCon.ConNumber = TxtContactNum.Text.Trim();
            objCon.ConPerson = TxtContactPerson.Text.Trim();

            ConsultantBLL objConBLL = new ConsultantBLL();

            if (objCon.ConsultID == 0)
            {
                objCon.CreatedBy = Convert.ToInt32(Session["USER_ID"]);
                message          = objConBLL.AddConsultant(objCon);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                }
            }
            else
            {
                objCon.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);
                objConBLL.UpdateConsultant(objCon);
                message = "Data updated successfully";
                SetUpdateMode(false);
            }

            ClearDetails();
            BindGrid(true, false);

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdConsultant_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["CONSULTANTID"] = e.CommandArgument;
                ConsultantBO  objCon    = new ConsultantBO();
                ConsultantBLL objConBLL = new ConsultantBLL();
                objCon = objConBLL.GetConsultantByID(Convert.ToInt32(ViewState["CONSULTANTID"]));

                if (objCon != null)
                {
                    txtConsultantname.Text = objCon.ConsultName;

                    DrpConsultantType.ClearSelection();
                    if (DrpConsultantType.Items.FindByValue(objCon.ConsultType) != null)
                    {
                        DrpConsultantType.Items.FindByValue(objCon.ConsultType).Selected = true;
                    }

                    TxtEmailaddress.Text  = objCon.EmailAddress;
                    TxtAddress.Text       = objCon.Address;
                    TxtContactNum.Text    = objCon.ConNumber;
                    TxtContactPerson.Text = objCon.ConPerson;
                }
                SetUpdateMode(true);
            }

            else if (e.CommandName == "DeleteRow")
            {
                ConsultantBLL objConBLL = new ConsultantBLL();
                objConBLL.DeleteConsultant(Convert.ToInt32(e.CommandArgument));
                ClearDetails();
                SetUpdateMode(false);
                BindGrid(false, true);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// To Update Consultant
        /// </summary>
        /// <param name="objCon"></param>
        public void UpdateConsultant(ConsultantBO objCon)
        {
            ConsultantDAL objConDAL = new ConsultantDAL();

            objConDAL.UpdateConsultant(objCon);
        }