コード例 #1
0
ファイル: MNEGoalNameDAL.cs プロジェクト: abigabaw/wis
        /// <summary>
        /// To Get All MNE Goal Name Details
        /// </summary>
        /// <returns></returns>
        public MNEGoalList GetAllMNEGoalNameDetails()
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_MST_MNE_GET_ALLGOALNAMES";


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

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

            MNEGoalBO   MNEGoalBOObj   = null;
            MNEGoalList MNEGoalListObj = new MNEGoalList();

            MNEGoalBOObj = new MNEGoalBO();
            while (dr.Read())
            {
                MNEGoalBOObj           = new MNEGoalBO();
                MNEGoalBOObj.GoalID    = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("GOALID")));
                MNEGoalBOObj.GoalName  = dr.GetString(dr.GetOrdinal("GOALNAME"));
                MNEGoalBOObj.ISDELETED = dr.GetString(dr.GetOrdinal("ISDELETED"));
                MNEGoalListObj.Add(MNEGoalBOObj);
            }
            dr.Close();
            return(MNEGoalListObj);
        }
コード例 #2
0
ファイル: MNEGoalName.aspx.cs プロジェクト: abigabaw/wis
        /// <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 gvGoalName_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["GOALID"] = e.CommandArgument;

                MNEGoalBLL objMNEGoalBLL = new MNEGoalBLL();
                MNEGoalBO  objMNEGoalBO  = new MNEGoalBO();
                objMNEGoalBO     = objMNEGoalBLL.GetMNEGoalNameDetailsbyID(Convert.ToInt32(ViewState["GOALID"]));
                txtGoalName.Text = objMNEGoalBO.GoalName;

                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                string     message       = string.Empty;
                MNEGoalBLL objMNEGoalBLL = new MNEGoalBLL();
                message = objMNEGoalBLL.DeleteGoalName(Convert.ToInt32(e.CommandArgument));

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                if (message != "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "alert('" + message + "');", true);
                }
                ClearData();
                SetUpdateMode(false);
                BindGrid();
            }
        }
コード例 #3
0
ファイル: MNEGoalNameDAL.cs プロジェクト: abigabaw/wis
        /// <summary>
        /// To Update MNE Goal Details
        /// </summary>
        /// <param name="GoalNameBOObj"></param>
        /// <returns></returns>
        public string UpdateMNEGoalDetails(MNEGoalBO GoalNameBOObj)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);

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

            dcmd.CommandType = CommandType.StoredProcedure;
            string result = "";

            try
            {
                dcmd.Parameters.Add("GOALNAME_", GoalNameBOObj.GoalName);
                dcmd.Parameters.Add("UPDATEDBY_", GoalNameBOObj.CreatedBy);
                dcmd.Parameters.Add("GOALID_", GoalNameBOObj.GoalID);
                dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;
                dcmd.ExecuteNonQuery();

                if (dcmd.Parameters["errorMessage_"].Value != null)
                {
                    result = dcmd.Parameters["errorMessage_"].Value.ToString();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                dcmd.Dispose();
                cnn.Close();
                cnn.Dispose();
            }

            return(result);
        }
コード例 #4
0
ファイル: MNEGoalNameDAL.cs プロジェクト: abigabaw/wis
        /// <summary>
        /// To Insert MNE Goal Details
        /// </summary>
        /// <param name="GoalNameBOObj"></param>
        /// <returns></returns>
        public string InsertMNEGoalDetails(MNEGoalBO GoalNameBOObj)
        {
            string           result = "";
            OracleConnection Con    = new OracleConnection(AppConfiguration.ConnectionString);

            Con.Open();
            OracleCommand cmd = new OracleCommand("USP_MST_MNE_INSERT_GOAL", Con);

            cmd.CommandType = CommandType.StoredProcedure;
            int Count = Convert.ToInt32(cmd.CommandType);

            try
            {
                cmd.Parameters.Add("GOALNAME_", GoalNameBOObj.GoalName);
                cmd.Parameters.Add("CREATEDBY_", GoalNameBOObj.CreatedBy);
                cmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;

                cmd.ExecuteNonQuery();
                if (cmd.Parameters["errorMessage_"].Value != null)
                {
                    result = cmd.Parameters["errorMessage_"].Value.ToString();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                cmd.Dispose();
                Con.Close();
                Con.Dispose();
            }

            return(result);
        }
コード例 #5
0
ファイル: MNEGoalBLL.cs プロジェクト: abigabaw/wis
        /// <summary>
        /// To Update MNE Goal Details
        /// </summary>
        /// <param name="GoalNameBOObj"></param>
        /// <returns></returns>
        public string UpdateMNEGoalDetails(MNEGoalBO GoalNameBOObj)
        {
            MNEGoalNameDAL MNEGoalNameDALObj = new MNEGoalNameDAL();

            return(MNEGoalNameDALObj.UpdateMNEGoalDetails(GoalNameBOObj));
        }
コード例 #6
0
ファイル: MNEGoalBLL.cs プロジェクト: abigabaw/wis
        /// <summary>
        /// To Insert MNE Goal Details
        /// </summary>
        /// <param name="GoalNameBOObj"></param>
        /// <returns></returns>
        public string InsertMNEGoalDetails(MNEGoalBO GoalNameBOObj)
        {
            MNEGoalNameDAL MNEGoalNameDALObj = new MNEGoalNameDAL();

            return(MNEGoalNameDALObj.InsertMNEGoalDetails(GoalNameBOObj));
        }
コード例 #7
0
ファイル: MNEGoalName.aspx.cs プロジェクト: abigabaw/wis
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>



        private void SaveGoalNameDetails()
        {
            MNEGoalBO MNEGoalBOObj = null;
            string    message      = "";

            if (Convert.ToInt32(ViewState["GOALID"]) == 0)
            {
                try
                {
                    MNEGoalBOObj = new MNEGoalBO();
                    MNEGoalBLL MNEGoalBLLObj = new MNEGoalBLL();
                    MNEGoalBOObj.GoalName  = txtGoalName.Text.ToString().Trim();
                    MNEGoalBOObj.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());
                    message = MNEGoalBLLObj.InsertMNEGoalDetails(MNEGoalBOObj);
                    ClearData();
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                    }
                    if (message != "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "alert('" + message + "');", true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                try
                {
                    MNEGoalBOObj = new MNEGoalBO();
                    MNEGoalBLL MNEGoalBLLObj = new MNEGoalBLL();

                    MNEGoalBOObj.GoalID    = Convert.ToInt32(ViewState["GOALID"]);
                    MNEGoalBOObj.GoalName  = txtGoalName.Text.ToString().Trim();
                    MNEGoalBOObj.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());
                    message = MNEGoalBLLObj.UpdateMNEGoalDetails(MNEGoalBOObj);
                    ClearData();
                    SetUpdateMode(false);
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                    }

                    if (message != "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "alert('" + message + "');", true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    MNEGoalBOObj = null;
                }
            }
        }