Ejemplo n.º 1
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid(bool addRow, bool deleteRow)
        {
            RelationshipBO  objRel    = new RelationshipBO();
            RelationshipBLL objRElBLL = new RelationshipBLL();

            grdRelationship.DataSource = objRElBLL.GetALLRelationship();
            grdRelationship.DataBind();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// To Update Relation
        /// </summary>
        /// <param name="objRel"></param>
        /// <returns></returns>
        public string UpdateRelation(RelationshipBO objRel)
        {
            OracleConnection con          = new OracleConnection(AppConfiguration.ConnectionString);
            string           returnResult = string.Empty;

            {
                OracleCommand myCommand;
                myCommand             = new OracleCommand("USP_MST_UPD_RELATIONSHIP", con);
                myCommand.Connection  = con;
                myCommand.CommandType = CommandType.StoredProcedure;
                myCommand.Parameters.Add("RELATIONSHIPID", objRel.RELATIONSHIPID);
                if (string.IsNullOrEmpty(objRel.RELATIONSHIP) == true)
                {
                    myCommand.Parameters.Add("RELATION", objRel.RELATIONSHIP);
                }
                else
                {
                    myCommand.Parameters.Add("RELATION", objRel.RELATIONSHIP);
                    //myCommand.Parameters.Add("RELATION", objRel.RELATIONSHIP);
                }
                myCommand.Parameters.Add("UPDATEDBY", objRel.UserID);
                //myCommand.Parameters.Add("UPDATEDBY", UPDATEDBY);
                con.Open();
                //result = myCommand.ExecuteNonQuery();

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

                myCommand.ExecuteNonQuery();

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

                //  return returnResult;
                con.Close();
            }
            return(returnResult);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>


        protected void btn_Save_Click(object sender, EventArgs e)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            RelationshipBO objRel = new RelationshipBO();

            objRel.RELATIONSHIPID = int.Parse(ViewState["RELATIONSHIPID"].ToString());
            objRel.RELATIONSHIP   = txtrel.Text.Trim();
            objRel.UserID         = Convert.ToInt32(Session["USER_ID"].ToString());
            RelationshipBLL objRelBLL = new RelationshipBLL();

            if (objRel.RELATIONSHIPID == 0)
            {
                message = objRelBLL.AddRelation(objRel);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Relationship added successfully');", true);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                    //BindGrid(true, true);
                }
            }
            else
            {
                message = objRelBLL.UpdateRelationship(objRel);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('Relationship updated successfully');", true);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                    SetUpdateMode(false);
                }
                btn_Save.Text = "Save";
                ViewState["RELATIONSHIPID"] = 0;
            }

            //ClearDetails();
            //BindGrid(true, false);
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Ejemplo n.º 4
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 grdRelationship_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["RELATIONSHIPID"] = e.CommandArgument;
                RelationshipBO  objRel    = null;
                RelationshipBLL objrelBLL = new RelationshipBLL();
                objRel = objrelBLL.GetRelationshipByID(Convert.ToInt32(ViewState["RELATIONSHIPID"]));

                if (objRel != null)
                {
                    txtrel.Text = objRel.RELATIONSHIP;
                }
                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }

            else if (e.CommandName == "DeleteRow")
            {
                // ViewState["RELATIONSHIPID"] = e.CommandArgument;
                RelationshipBLL objrelBLL = new RelationshipBLL();
                message = objrelBLL.DeleteRelation(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data Deleted successfully";
                }
                SetUpdateMode(true);
                BindGrid(false, true);
            }

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// To Add Relation
        /// </summary>
        /// <param name="objRelr"></param>
        /// <returns></returns>
        public string AddRelation(RelationshipBO objRelr)
        {
            OracleConnection con          = new OracleConnection(AppConfiguration.ConnectionString);
            string           returnResult = string.Empty;

            {
                OracleCommand myCommand;
                myCommand             = new OracleCommand("USP_MST_INS_RELATIONSHIP", con);
                myCommand.Connection  = con;
                myCommand.CommandType = CommandType.StoredProcedure;
                //Relationship objrel = new Relationship();
                myCommand.Parameters.Add("@RELATION_", objRelr.RELATIONSHIP);
                myCommand.Parameters.Add("@ISDELETEDIN", "False");
                myCommand.Parameters.Add("@CREATEDBY", objRelr.UserID);
                con.Open();
                //result = myCommand.ExecuteNonQuery();

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

                myCommand.ExecuteNonQuery();

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


                con.Close();
            }
            //return objRelr;
            return(returnResult);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// To Update Relation
        /// </summary>
        /// <param name="objRel"></param>
        /// <returns></returns>
        public string UpdateRelationship(RelationshipBO objRel)
        {
            RelationshipDAL objRelDAL = new RelationshipDAL();

            return(objRelDAL.UpdateRelation(objRel));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// To Add Relation
        /// </summary>
        /// <param name="objRel"></param>
        /// <returns></returns>
        public string AddRelation(RelationshipBO objRel)
        {
            RelationshipDAL objRelDAL = new RelationshipDAL();

            return(objRelDAL.AddRelation(objRel));
        }