Example #1
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      CONCERNID     = ((Literal)gr.FindControl("litCONCERNID")).Text;
                ConcernBLL  ConcernBLLobj = new ConcernBLL();
                message = ConcernBLLobj.ObsoleteConcern(Convert.ToInt32(CONCERNID), 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;
            }
        }
Example #2
0
        /// <summary>
        /// to get the concern details
        /// </summary>
        /// <param name="lastItemSelected"></param>

        private void GetConcer(bool lastItemSelected)
        {
            ConcernBLL  objConcer   = new ConcernBLL();
            ConcernList ConcernList = new ConcernList();

            ConcernList = objConcer.GetConcern();
            PAPConcernsDropDownList.Items.Clear();

            PAPConcernsDropDownList.DataSource     = ConcernList;
            PAPConcernsDropDownList.DataTextField  = "ConcernName";
            PAPConcernsDropDownList.DataValueField = "ConcernID";
            PAPConcernsDropDownList.DataBind();
            PAPConcernsDropDownList.Items.Insert(0, new ListItem("-- Select --", "0"));
            PAPConcernsDropDownList.SelectedIndex = 0;

            if (PAPConcernsDropDownList.Items.FindByText("Other") != null)
            {
                ListItem LastListItem = new ListItem(PAPConcernsDropDownList.Items.FindByText("Other").Text, PAPConcernsDropDownList.Items.FindByText("Other").Value);
                PAPConcernsDropDownList.Items.Remove(PAPConcernsDropDownList.Items.FindByText("Other"));
                PAPConcernsDropDownList.Items.Add(LastListItem);
                if (lastItemSelected)
                {
                    PAPConcernsDropDownList.Items[PAPConcernsDropDownList.Items.Count - 1].Selected = true;
                }
                else
                {
                    PAPConcernsDropDownList.SelectedIndex = 0;
                }
            }
        }
Example #3
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>
        private void BindGrid(bool addRow, bool deleteRow)
        {
            ConcernBLL ConcernBLLobj = new ConcernBLL();

            grdConcern.DataSource = ConcernBLLobj.GETALLCONCERN();
            grdConcern.DataBind();
        }
Example #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 grdConcern_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["ConcernID"] = e.CommandArgument;
                int concrnID = Convert.ToInt32(ViewState["ConcernID"]);
                GetConcernDetails(concrnID);
                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                ConcernBLL ConcernBLLobj = new ConcernBLL();
                message = ConcernBLLobj.DeleteConcern(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data Deleted successfully";
                }

                clear();
                SetUpdateMode(false);
                BindGrid(false, true);
            }
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Example #5
0
        /// <summary>
        /// get the Grid value into textBox
        /// </summary>
        private void GetConcernDetails(int ConcernID)
        {
            ConcernBLL ConcernBLLobj = new ConcernBLL();
            //int ConcernID = 0;

            //if (ViewState["CONCERNID"] != null)
            //    ConcernID = Convert.ToInt32(ViewState["CONCERNID"]);

            ConcernBO ConcernObj = new ConcernBO();

            ConcernObj = ConcernBLLobj.GetConcernById(ConcernID);

            ConcernTextBox.Text   = ConcernObj.ConcernName;
            ConcernIDTextBox.Text = ConcernObj.ConcernID.ToString();
            //int ConcernID_test = Convert.ToInt32(ConcernObj.ConcernID);
        }
Example #6
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        protected void SaveButton_Click(object sender, EventArgs e)
        {
            //int count = 0;
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            if (MainOccupationTextBox.Text.ToString().Trim() == string.Empty)
            {
                //errMsgMainOccupationLabel.Text = "Enter the Concern";
            }
            else if (MainOccupationIDTextBox.Text.ToString().Trim() == string.Empty)
            {
                OccupationBLL OccupationBLLOBJ = new OccupationBLL();
                try
                {
                    string       uID           = Session["USER_ID"].ToString();
                    OccupationBO objOccupation = new OccupationBO();
                    objOccupation.OCCUPATIONNAME = MainOccupationTextBox.Text.ToString().Trim();
                    objOccupation.UserID         = Convert.ToInt32(uID);

                    OccupationBLL OccupationBLLobj = new OccupationBLL();
                    message = OccupationBLLobj.Insert(objOccupation);

                    //if (count == -1)
                    //{
                    //    msgSaveLabel.Text = "Data saved successfully"; //messageSaveLable
                    //    BindGrid(true, true);
                    //}
                    //else
                    //{
                    //    msgSaveLabel.Text = "Data not saved successfully";
                    //}

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        AllClear();
                        // ClearDetails();
                        BindGrid(true, true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    OccupationBLLOBJ = null;
                }
            }
            //edit the data in the textbox exiting in the Grid
            else if (MainOccupationIDTextBox.Text.ToString().Trim() != string.Empty)
            {
                ConcernBLL concernBLLOBJ = new ConcernBLL();

                try
                {
                    string       uID           = Session["USER_ID"].ToString();
                    OccupationBO objOccupation = new OccupationBO();
                    objOccupation.OCCUPATIONNAME = MainOccupationTextBox.Text.ToString().Trim();
                    objOccupation.OCCUPATIONID   = Convert.ToInt32(MainOccupationIDTextBox.Text.ToString().Trim());
                    objOccupation.UserID         = Convert.ToInt32(uID);

                    OccupationBLL OccupationBLLobj = new OccupationBLL();
                    message = OccupationBLLobj.EDITOccupation(objOccupation);

                    //if (count == -1)
                    //{
                    //    msgSaveLabel.Text = "Data saved successfully"; //messageSaveLable
                    //    BindGrid(true, true);
                    //}
                    //else
                    //{
                    //    msgSaveLabel.Text = "Data not saved successfully";
                    //}

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

                finally
                {
                    concernBLLOBJ = null;
                }
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Example #7
0
        /// <summary>
        ///  save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string message = "";
            int    count   = 0;

            if (ViewState["CROPAGEID"].ToString() == "0")
            {
                CropAgeBLL CropAgeBLLOBJ = new CropAgeBLL();
                try
                {
                    string    uID        = Session["USER_ID"].ToString();
                    CropAgeBO objCropAge = new CropAgeBO();
                    objCropAge.CROPAGE = CropAgeTextBox.Text.ToString().Trim();
                    objCropAge.UserID  = Convert.ToInt32(uID);

                    CropAgeBLL CropAgeBLLLobj = new CropAgeBLL();
                    message = CropAgeBLLLobj.InsertCropAge(objCropAge);

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


                    CropAgeIDTextBox.Text = "0";

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

                finally
                {
                    CropAgeBLLOBJ = null;
                }
            }
            else if (Convert.ToInt32(ViewState["CROPAGEID"].ToString()) > 0)
            {
                ConcernBLL concernBLLOBJ = new ConcernBLL();

                try
                {
                    string    uID        = Session["USER_ID"].ToString();
                    CropAgeBO objCropAge = new CropAgeBO();
                    objCropAge.CROPAGE   = CropAgeTextBox.Text.ToString().Trim();
                    objCropAge.CROPAGEID = Convert.ToInt32(ViewState["CROPAGEID"].ToString());
                    objCropAge.UserID    = Convert.ToInt32(uID);

                    CropAgeBLL CropAgeBLLobj = new CropAgeBLL();
                    message = CropAgeBLLobj.EDITCROPAGE(objCropAge);

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

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

                finally
                {
                    concernBLLOBJ = null;
                }
            }
            SetUpdateMode(false);
            ClearData();
            BindGrid(true, true);
        }
Example #8
0
        /// <summary>
        /// save data to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            // int count = 0;
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            if (ConcernIDTextBox.Text.ToString().Trim() == string.Empty)
            {
                ConcernBLL concernBLLOBJ = new ConcernBLL();

                try
                {
                    string    uID        = Session["USER_ID"].ToString();
                    ConcernBO objConcern = new ConcernBO();
                    objConcern.ConcernName = ConcernTextBox.Text.ToString().Trim();;
                    objConcern.UserID      = Convert.ToInt32(uID);

                    ConcernBLL ConcernBLLobj = new ConcernBLL();
                    message = ConcernBLLobj.Insert(objConcern);

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

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        clear();
                        // ClearDetails();
                        BindGrid(true, true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    concernBLLOBJ = null;
                }
            }
            //edit the data in the textbox exiting in the Grid
            else if (ConcernIDTextBox.Text.ToString().Trim() != string.Empty)
            {
                ConcernBLL concernBLLOBJ = new ConcernBLL();

                try
                {
                    string    uID        = Session["USER_ID"].ToString();
                    ConcernBO objConcern = new ConcernBO();
                    objConcern.ConcernName = ConcernTextBox.Text.ToString().Trim();
                    objConcern.ConcernID   = Convert.ToInt32(ConcernIDTextBox.Text.ToString().Trim());
                    objConcern.UserID      = Convert.ToInt32(uID);

                    ConcernBLL ConcernBLLobj = new ConcernBLL();
                    message = ConcernBLLobj.EDITCONCERN(objConcern);

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

                finally
                {
                    concernBLLOBJ = null;
                }
            }

            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Example #9
0
        /// <summary>
        /// To save details to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string message = "";
            int    count   = 0;

            if (CropDiameterIDTextBox.Text.ToString().Trim() == "0" || CropDiameterIDTextBox.Text.ToString().Trim() == string.Empty)
            {
                CropDiameterBLL CropDiameterBLLOBJ = new CropDiameterBLL();
                try
                {
                    string         uID             = Session["USER_ID"].ToString();
                    CropDiameterBO objCropDiameter = new CropDiameterBO();
                    objCropDiameter.CROPDIAMETER = CropDiameterTextBox.Text.ToString().Trim();
                    objCropDiameter.UserID       = Convert.ToInt32(uID);

                    CropDiameterBLL CropDiameterBLLobj = new CropDiameterBLL();
                    message = CropDiameterBLLobj.InsertCropDiameter(objCropDiameter);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                    }
                    CropDiameterIDTextBox.Text = "0";
                    if (message != "")
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    CropDiameterBLLOBJ = null;
                }

                BindGrid();
            }
            //edit the data in the textbox exiting in the Grid
            else if (CropDiameterIDTextBox.Text.ToString().Trim() != string.Empty)
            {
                ConcernBLL concernBLLOBJ = new ConcernBLL();

                try
                {
                    string         uID             = Session["USER_ID"].ToString();
                    CropDiameterBO objCropDiameter = new CropDiameterBO();
                    objCropDiameter.CROPDIAMETER   = CropDiameterTextBox.Text.ToString().Trim();
                    objCropDiameter.CROPDIAMETERID = Convert.ToInt32(CropDiameterIDTextBox.Text.ToString().Trim());
                    objCropDiameter.UserID         = Convert.ToInt32(uID);

                    CropDiameterBLL CropDiameterBLLobj = new CropDiameterBLL();
                    message = CropDiameterBLLobj.EDITCropDiameter(objCropDiameter);


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

                finally
                {
                    concernBLLOBJ = null;
                }

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

            ClearData();
        }