예제 #1
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid(bool addRow, bool deleteRow)
        {
            SocialSupportBLL SocialSupportBLLObj = new SocialSupportBLL();

            gvSupportedBy.DataSource = SocialSupportBLLObj.GetALLSchoolDetails();
            gvSupportedBy.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;
                ViewState["SUPPORTEDBYID"] = ((Literal)gr.FindControl("litSUPPORTEDBYID")).Text;
                SocialSupportBLL SocialSupportBLLObj = new SocialSupportBLL();
                message = SocialSupportBLLObj.ObsoleteSocialSupport(Convert.ToInt32(ViewState["SUPPORTEDBYID"]), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                BindGrid(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        //To get Helped most from the table MST_SUPPORT
        public void Gethelpedmost()
        {
            string SUPPORTID = string.Empty;

            if (helpedDropDownList.SelectedValue.ToString() == "")
            {
                SUPPORTID = "0";
                //msgSaveLabel.Text = null; // if value is select then error msg will display
            }
            else
            {
                // SHOCKID = typeofshockDropDownList.SelectedValue.ToString(); // get UI screen Value
                DataSet Ds = new DataSet();

                //  MajorshockBLL help_BLL = new MajorshockBLL(); // Function or object creation for next layer
                SocialSupportBLL help_BLL = new SocialSupportBLL();
                objSocialSupportList = new SocialSupportList();
                //  Ds = help_BLL.Gethelp(SUPPORTID); // data pass through object SHOCKID
                objSocialSupportList = (SocialSupportList)help_BLL.GetSchoolDetails();
                try
                {
                    // if (Ds.Tables[0].Rows.Count > 0) // Data from BLL
                    if (objSocialSupportList.Count > 0)
                    {
                        helpedDropDownList.DataSource = objSocialSupportList;
                        //  helpedDropDownList.DataTextField = Ds.Tables[0].Columns[1].ToString();
                        //helpedDropDownList.DataValueField = Ds.Tables[0].Columns[0].ToString();
                        helpedDropDownList.DataTextField  = "SupportedBy";
                        helpedDropDownList.DataValueField = "SUPPORTEDBYID";
                        helpedDropDownList.DataBind();
                        //  helpedDropDownList.Items.Insert(0, "--Select--");
                    }
                }
                catch (Exception ee)
                {
                    throw ee;
                }
                finally     // set the finally class nothing but Empty the object
                {
                    help_BLL = null;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// to fetch details from database and assign to textbox
        /// </summary>
        private void GetSupportDeatails()
        {
            SocialSupportBLL SocialSupportBLLObj = new SocialSupportBLL();
            SocialSupportBO  SocialSupportBOObj  = new SocialSupportBO();

            int SUPPORTEDBYID = 0;

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

            SocialSupportBOObj = new SocialSupportBO();

            SchoolStatusList SchoolStatusListobj = new SchoolStatusList();

            SocialSupportBOObj = SocialSupportBLLObj.GetSupportById(SUPPORTEDBYID);

            txtSupportedBy.Text   = SocialSupportBOObj.SupportedBy;
            txtSupportedByID.Text = SocialSupportBOObj.SUPPORTEDBYID.ToString();
        }
예제 #5
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 gvSupportedBy_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["SUPPORTEDBYID"] = e.CommandArgument;
                int         SupportEditID = Convert.ToInt32(ViewState["SUPPORTEDBYID"]);
                GridViewRow row           = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                if (row != null)
                {
                    txtSupportedBy.Text = row.Cells[1].Text.ToString();
                }
                SetUpdateMode(true);

                GetSupportDeatails();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                SocialSupportBLL SocialSupportBLLObj = new SocialSupportBLL();
                message = SocialSupportBLLObj.DeleteSupportRow(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                SetUpdateMode(false);
                ClearDetials();
                BindGrid(false, true);
            }

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
예제 #6
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveDetails(SocialSupportBO SocialSupportBOObj)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            if (txtSupportedByID.Text.ToString().Trim() == string.Empty)
            {
                try
                {
                    SocialSupportBOObj = new SocialSupportBO();
                    SocialSupportBLL SocialSupportBLLObj = new SocialSupportBLL();

                    SocialSupportBOObj.SupportedBy   = txtSupportedBy.Text.ToString().Trim();
                    SocialSupportBOObj.SUPPORTEDBYID = Convert.ToInt32(ViewState["SUPPORTEDBYID"]);
                    SocialSupportBOObj.CreatedBy     = Convert.ToInt32(Session["USER_ID"].ToString());
                    message = SocialSupportBLLObj.InsertSupportDetails(SocialSupportBOObj);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        ClearDetials();
                        BindGrid(true, true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                try
                {
                    SocialSupportBOObj = new SocialSupportBO();
                    SocialSupportBLL SocialSupportBLLObj = new SocialSupportBLL();

                    SocialSupportBOObj.SupportedBy = txtSupportedBy.Text.ToString().Trim();
                    int SUPPORTEDBYID = Convert.ToInt32(ViewState["SUPPORTEDBYID"]);
                    SocialSupportBOObj.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());

                    message = SocialSupportBLLObj.EditSupportDetails(SocialSupportBOObj, SUPPORTEDBYID);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                        ClearDetials();
                        BindGrid(true, true);
                        SetUpdateMode(false);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    SocialSupportBOObj = null;
                }
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }