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

            grdconsultanttype.DataSource = ConsultantTypeBLLobj.GetALLConsultantType();
            grdconsultanttype.DataBind();
        }
Example #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            consultantTypeID     = ((Literal)gr.FindControl("litconsultantTypeID")).Text;
                int               consultantTypeID_    = Convert.ToInt32(consultantTypeID);
                ConsultantTypeBLL ConsultantTypeBLLobj = new ConsultantTypeBLL();
                message = ConsultantTypeBLLobj.ObsoleteconsultantType(consultantTypeID_, Convert.ToString(chk.Checked), Convert.ToInt32(Session["USER_ID"]));
                //Convert.ToString(chk.Checked), Convert.ToInt32(Session["USER_ID"]));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
                BindGrid(false, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #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 grdconsultanttype_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["consultantTypeID"] = e.CommandArgument;
                GetConsultantTypeDetails();
                SetUpdateMode(true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                ConsultantTypeBLL ConsultantTypeBLLobj = new ConsultantTypeBLL();
                string            message = string.Empty;

                message = ConsultantTypeBLLobj.DeleteConsultantType(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                SetUpdateMode(false);
                clearfields();
                BindGrid(false, true);
            }
        }
Example #4
0
        /// <summary>
        /// to insert data to database
        /// </summary>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string            message = "";
            ConsultantTypeBLL ConsultantTypeBLLobj = null;

            try
            {
                ConsultantTypeBLLobj = new ConsultantTypeBLL();
                ConsultantTypeBO objconsultantType = new ConsultantTypeBO();

                if (Convert.ToInt32(ViewState["consultantTypeID"]) > 0)
                {
                    objconsultantType.ConsultantType   = consultanttypeTextBox.Text.Trim();
                    objconsultantType.ConsultantTypeID = Convert.ToInt32(ViewState["consultantTypeID"]);

                    message = ConsultantTypeBLLobj.EDITConsultantType(objconsultantType);

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

                    SetUpdateMode(false);
                }
                else
                {
                    objconsultantType.ConsultantType = consultanttypeTextBox.Text.Trim();
                    objconsultantType.CreatedBy      = Convert.ToInt32(Session["USER_ID"]);

                    message = ConsultantTypeBLLobj.insert(objconsultantType);

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

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                clearfields();
                BindGrid(true, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ConsultantTypeBLLobj = null;
            }
        }
Example #5
0
        /// <summary>
        /// get the Grid value into textBox
        /// </summary>
        private void GetConsultantTypeDetails()
        {
            ConsultantTypeBLL ConsultantTypeBLLobj = new ConsultantTypeBLL();
            int consultantTypeID = 0;

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

            ConsultantTypeBO objconsultantType = new ConsultantTypeBO();

            objconsultantType = ConsultantTypeBLLobj.GetConsultantTypeId(consultantTypeID);

            consultanttypeTextBox.Text = objconsultantType.ConsultantType;
        }