コード例 #1
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid()
        {
            SchoolDropBLL SchoolDropBLLObj = new SchoolDropBLL();

            gv_Details.DataSource = SchoolDropBLLObj.GetAllSchoolDropReason();
            gv_Details.DataBind();
        }
コード例 #2
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk = (CheckBox)sender;
                GridViewRow gr  = (GridViewRow)chk.Parent.Parent;

                string        schooldropreasonID = ((Literal)gr.FindControl("litSchoolDropID")).Text;
                SchoolDropBLL SchoolDropBLLObj   = new SchoolDropBLL();
                message = SchoolDropBLLObj.ObsoleteSchoolDrop(Convert.ToInt32(schooldropreasonID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                BindGrid();
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
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 gv_Details_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["SchooldropreasonID"] = e.CommandArgument;

                GetSchoolDropDetails();
                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                int           reasonid         = Convert.ToInt32(e.CommandArgument);
                SchoolDropBLL SchoolDropBLLObj = new SchoolDropBLL();
                message = SchoolDropBLLObj.Delete(Convert.ToInt32(e.CommandArgument));

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

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                cleardetails();
                SetUpdateMode(false);
                BindGrid();
            }
        }
コード例 #4
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private string Insert()
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            string uID = Session["USER_ID"].ToString();

            SchoolDropReasonBOobj = new SchoolDropReasonBO();
            SchoolDropReasonBOobj.Schooldropreason = txtReasonDropped.Text.ToString();
            SchoolDropReasonBOobj.Description      = txtDescription.Text.ToString();
            SchoolDropReasonBOobj.Createddate      = System.DateTime.Now;
            SchoolDropReasonBOobj.Isdeleted        = false;
            SchoolDropReasonBOobj.Createdby        = Convert.ToInt32(uID);
            SchoolDropBLL SchoolDropBLLObj = new SchoolDropBLL();

            try
            {
                message = SchoolDropBLLObj.Insert(SchoolDropReasonBOobj);
            }
            catch (Exception ex)
            {
                string errorMsg = ex.Message.ToString();
                Response.Write(errorMsg);
            }
            finally
            {
                SchoolDropBLLObj = null;
            }
            return(message);
        }
コード例 #5
0
        /// <summary>
        /// calls inser method to save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            try
            {
                if (ViewState["SchooldropreasonID"].ToString() == "0")
                {
                    message = Insert();

                    AlertMessage = "alert('" + message + "');";

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

                    //   ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('School Drop reason details added successfully');", true);
                }
                else
                {
                    string uID      = Session["USER_ID"].ToString();
                    int    reasonid = Convert.ToInt32(ViewState["SchooldropreasonID"]);
                    SchoolDropReasonBOobj                  = new SchoolDropReasonBO();
                    SchoolDropReasonBOobj.Description      = txtDescription.Text.ToString();
                    SchoolDropReasonBOobj.Schooldropreason = txtReasonDropped.Text.ToString();
                    SchoolDropReasonBOobj.Createdby        = Convert.ToInt32(uID);;
                    SchoolDropBLL SchoolDropBLLObj = new SchoolDropBLL();
                    message = SchoolDropBLLObj.Update(SchoolDropReasonBOobj, reasonid);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                        cleardetails();
                        SetUpdateMode(false);
                    }
                    //BindGrid(true, true);
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('School Drop reason details updated successfully');", true);
                    //cleardetails();
                }
                BindGrid();
                //btnSave.Text = "Save";
            }
            catch (Exception ex)
            {
                string errorMsg = ex.Message.ToString();
                Response.Write(errorMsg);
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
コード例 #6
0
        /// <summary>
        ///To fetch details from database and assign to textbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetSchoolDropDetails()
        {
            SchoolDropBLL SchoolDropBLLObj   = new SchoolDropBLL();
            int           SchooldropreasonID = 0;

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

            SchoolDropReasonBOobj = new SchoolDropReasonBO();
            SchoolDropReasonBOobj = SchoolDropBLLObj.GetschoolDropReasonbyID(SchooldropreasonID);
            txtReasonDropped.Text = SchoolDropReasonBOobj.Schooldropreason;
            txtDescription.Text   = SchoolDropReasonBOobj.Description;
            //ConcernIDTextBox.Text = SchoolDropReasonBOobj.SchooldropreasonID.ToString();
        }
コード例 #7
0
        /// <summary>
        ///To delete a row from grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gv_Details_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int           reasonid         = Int32.Parse(gv_Details.DataKeys[e.RowIndex].Value.ToString());
            SchoolDropBLL SchoolDropBLLObj = new SchoolDropBLL();

            try
            {
                SchoolDropBLLObj.Delete(reasonid);
                BindGrid();
            }
            catch (Exception ee)
            {
                string errorMsg = ee.Message.ToString();
                Response.Write(errorMsg);
            }
            finally
            {
                SchoolDropBLLObj = null;
            }

            gv_Details.EditIndex = -1;
            BindGrid();
        }