Exemplo n.º 1
0
        /// <summary>
        /// To Get Shocks Experienced By Id
        /// </summary>
        /// <param name="ShockID"></param>
        /// <returns></returns>
        public ShocksExperiencedBO GetShocksExperiencedById(int ShockID)
        {
            cnn = new OracleConnection(con);

            proc = "USP_MST_GET_SHOCKSEXP_BYID";

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

            cmd.Connection.Open();

            OracleDataReader    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ShocksExperiencedBO objShocksExperienced = null;

            while (dr.Read())
            {
                objShocksExperienced = new ShocksExperiencedBO();

                if (ColumnExists(dr, "SHOCKID") && !dr.IsDBNull(dr.GetOrdinal("SHOCKID")))
                {
                    objShocksExperienced.ShocksExperiencedID = dr.GetInt32(dr.GetOrdinal("SHOCKID"));
                }
                if (ColumnExists(dr, "SHOCKEXPERIENCED") && !dr.IsDBNull(dr.GetOrdinal("SHOCKEXPERIENCED")))
                {
                    objShocksExperienced.ShocksExperience = dr.GetString(dr.GetOrdinal("SHOCKEXPERIENCED"));
                }
            }
            dr.Close();

            return(objShocksExperienced);
        }
Exemplo n.º 2
0
        /// <summary>
        /// To Update Shocks Experienced
        /// </summary>
        /// <param name="oShocksExperienced"></param>
        /// <returns></returns>
        public string UpdateShocksExperienced(ShocksExperiencedBO oShocksExperienced)
        {
            string returnResult = string.Empty;

            cnn = new OracleConnection(con);

            proc = "USP_MST_UPD_SHOCKSEXPERIENCED";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection.Open();
            cmd.Parameters.Add("shockid_", oShocksExperienced.ShocksExperiencedID);
            cmd.Parameters.Add("shockexperienced_", oShocksExperienced.ShocksExperience);

            cmd.Parameters.Add("updatedby_", oShocksExperienced.CreatedBy);

            cmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;

            cmd.ExecuteNonQuery();

            if (cmd.Parameters["errorMessage_"].Value != null)
            {
                returnResult = cmd.Parameters["errorMessage_"].Value.ToString();
            }
            else
            {
                returnResult = string.Empty;
            }

            return(returnResult);
        }
Exemplo n.º 3
0
        //private string DeleteShocksExperienced()
        //{
        //    objShocksExperiencedBLL = new ShocksExperiencedBLL();
        //    int ShocksExperiencedID = 0;
        //    int Result = 0;
        //    if (ViewState["ShockID"] != null)
        //        ShocksExperiencedID = Convert.ToInt32(ViewState["ShockID"].ToString());

        //    Result = objShocksExperiencedBLL.DeleteShocksExperienced(ShocksExperiencedID);
        //}
        #endregion

        #region Save Record
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            objShocksExperienced    = new ShocksExperiencedBO();
            objShocksExperiencedBLL = new ShocksExperiencedBLL();

            string AlertMessage = string.Empty;
            string message      = string.Empty;

            //Assignement
            objShocksExperienced.ShocksExperience = txtShocksExperienced.Text.Trim();

            if (ViewState["ShockID"] != null)
            {
                objShocksExperienced.ShocksExperiencedID = Convert.ToInt32(ViewState["ShockID"].ToString());
            }

            objShocksExperienced.IsDeleted = "False";

            //if (Session["USER_ID"] != null)
            objShocksExperienced.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());

            if (objShocksExperienced.ShocksExperiencedID < 1)
            {
                //If ShocksExperiencedID does Not exists then SaveShocksExperienced
                objShocksExperienced.ShocksExperiencedID = -1;//For New ShocksExperienced
                message = objShocksExperiencedBLL.AddShocksExperienced(objShocksExperienced);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                    BindGrid(true, true);
                }
            }
            else
            {
                //If ShocksExperiencedID exists then UpdateShocksExperienced
                message = objShocksExperiencedBLL.UpdateShocksExperienced(objShocksExperienced); //For Updating ShocksExperienced
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                    BindGrid(true, true);
                    SetUpdateMode(false);
                }
            }

            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// To update details into database
        /// </summary>
        private void GetShocksExperiencedDetails()
        {
            objShocksExperiencedBLL = new ShocksExperiencedBLL();
            int ShocksExperiencedID = 0;

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

            objShocksExperienced = new ShocksExperiencedBO();
            objShocksExperienced = objShocksExperiencedBLL.GetShocksExperiencedById(ShocksExperiencedID);

            txtShocksExperienced.Text = objShocksExperienced.ShocksExperience;
        }
Exemplo n.º 5
0
        /// <summary>
        /// To Get ALL Shocks Experienced
        /// </summary>
        /// <returns></returns>
        public ShocksExperiencedList GetALLShocksExperienced()//(ShocksExperienced oShocksExperienced)
        {
            proc = "USP_MST_GETALL_SHOCKSEXP";
            cnn  = new OracleConnection(con);
            ShocksExperiencedBO objShocksExperienced = null;

            ShocksExperiencedList lstShocksExperiencedList = new ShocksExperiencedList();

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            try
            {
                cmd.Connection.Open();
                OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                while (dr.Read())
                {
                    objShocksExperienced = new ShocksExperiencedBO();

                    if (ColumnExists(dr, "SHOCKID") && !dr.IsDBNull(dr.GetOrdinal("SHOCKID")))
                    {
                        objShocksExperienced.ShocksExperiencedID = dr.GetInt32(dr.GetOrdinal("SHOCKID"));
                    }
                    if (ColumnExists(dr, "SHOCKEXPERIENCED") && !dr.IsDBNull(dr.GetOrdinal("SHOCKEXPERIENCED")))
                    {
                        objShocksExperienced.ShocksExperience = dr.GetString(dr.GetOrdinal("SHOCKEXPERIENCED"));
                    }
                    if (ColumnExists(dr, "isdeleted") && !dr.IsDBNull(dr.GetOrdinal("isdeleted")))
                    {
                        objShocksExperienced.IsDeleted = dr.GetString(dr.GetOrdinal("isdeleted"));
                    }
                    lstShocksExperiencedList.Add(objShocksExperienced);
                }

                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(lstShocksExperiencedList);
        }
Exemplo n.º 6
0
        /// <summary>
        /// To Update Shocks Experienced
        /// </summary>
        /// <param name="oShocksExperienced"></param>
        /// <returns></returns>
        public string UpdateShocksExperienced(ShocksExperiencedBO oShocksExperienced)
        {
            objShocksExperiencedDAL = new ShocksExperiencedDAL();

            return(objShocksExperiencedDAL.UpdateShocksExperienced(oShocksExperienced));
        }
Exemplo n.º 7
0
        /// <summary>
        /// To Add Shocks Experienced
        /// </summary>
        /// <param name="oShocksExperienced"></param>
        /// <returns></returns>
        public string AddShocksExperienced(ShocksExperiencedBO oShocksExperienced)
        {
            objShocksExperiencedDAL = new ShocksExperiencedDAL();

            return(objShocksExperiencedDAL.SaveShocksExperienced(oShocksExperienced));
        }