Example #1
0
        protected void gvResult_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            SponsorCollection dt = ((SponsorCollection)this.gvResult.DataSource);

            PubEntAdmin.BLL.Sponsor l_spon = dt[e.Item.DataSetIndex];
            int    Sponid     = l_spon.SponsorID;
            string SpLongDesc = l_spon.LongDescription;
            //string SpDesc = l_spon.Description;
            string SpCode = l_spon.SponsorCode;

            string Activestatus = ((Button)e.Item.Cells[6].Controls[7]).Text;

            if (Activestatus == "Inactive")
            {
                Boolean sponExist = LU_DAL.SponsorExist(Sponid);

                if (sponExist == false)
                {
                    LU_DAL.DeleteSponsorLU(Sponid);
                    this.BindData();
                }
                else if (sponExist == true)
                {
                    string confirm = "Unable to Inactivate, value associated with Publication.";
                    ((Label)e.Item.Cells[7].Controls[1]).Text = confirm;
                }
            }
            if (Activestatus == "Active")
            {
                int Active = 1;
                LU_DAL.UpdateSponsorLU(Sponid, SpCode, SpLongDesc, Active);
                this.BindData();
            }
        }
Example #2
0
        protected void gvResult_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            SponsorCollection dt = ((SponsorCollection)this.gvResult.DataSource);

            PubEntAdmin.BLL.Sponsor l_spon = dt[e.Item.DataSetIndex];
            int Sponid = l_spon.SponsorID;

            //string SpDesc12 = ((TextBox)e.Item.Cells[1].Controls[1]).Text;

            string SpCode     = ((TextBox)e.Item.Cells[1].Controls[1]).Text;
            string SpLongDesc = ((TextBox)e.Item.Cells[2].Controls[1]).Text;


            bool valid    = false;
            bool validlen = false;

            if (SpLongDesc.Length != 0)
            {
                string longdesc = txtSpLongDesc.Text;
                valid    = PubEntAdminManager.OtherVal(longdesc);
                validlen = PubEntAdminManager.LenVal(longdesc, 101);
            }


            if (SpCode.Length != 0)
            {
                string code = txtSpCode.Text;
                valid    = PubEntAdminManager.OtherVal(code);
                validlen = PubEntAdminManager.LenVal(code, 7);
            }

            if ((valid == false) && (validlen == true))
            {
                SponsorCollection coll = LU_DAL.GetSponsorsbyDesc(SpLongDesc);
                if (coll.Count > 0)
                {
                    string confirm = "The Sponsor already existed.";
                    ((Label)e.Item.Cells[7].Controls[1]).Text = confirm;
                }
                else
                {
                    LU_DAL.UpdateSponsorLU(Sponid, SpCode, SpLongDesc, 1);
                    this.gvResult.EditItemIndex = -1;
                    this.BindData();
                }
            }
            else
            {
                Response.Redirect("InvalidInput.aspx");
            }
        }
Example #3
0
        protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            SponsorCollection dt = ((SponsorCollection)this.gvResult.DataSource);

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PubEntAdmin.BLL.Sponsor l_spon = dt[e.Item.DataSetIndex];

                //delete btn col
                Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button;

                if (l_spon.Checked)
                {
                    ((Label)e.Item.Cells[4].Controls[1]).Text = "Active";
                    l_able.Text = "Inactivate";
                    Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel;
                    ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_spon.SponsorCode) + "]?";
                }
                else
                {
                    ((Label)e.Item.Cells[4].Controls[1]).Text = "Inactive";
                    l_able.Text = "Activate";
                    Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel;
                    ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_spon.SponsorCode) + "]?";

                    ((Button)e.Item.Cells[5].Controls[0]).Enabled = false;
                }
            }
            else if (e.Item.ItemType == ListItemType.EditItem)
            {
                PubEntAdmin.BLL.Sponsor l_spon = dt[e.Item.ItemIndex];
                String status = "";
                if (l_spon.Checked == true)
                {
                    status = "Active";
                }
                else
                {
                    status = "Inactive";
                }
                ((Label)e.Item.Cells[4].Controls[1]).Text = status;

                if (e.Item.Cells[5].Controls[2] is Button)
                {
                    Button l_btnCancel = ((Button)e.Item.Cells[5].Controls[2]);
                    l_btnCancel.ID = "gvResult_Cancel";

                    Panel l_panel = new Panel();
                    l_panel.ID       = "l_panel";
                    l_panel.CssClass = "modalPopup";
                    l_panel.Style.Add("display", "none");
                    l_panel.Width = Unit.Pixel(233);

                    Label l_label = new Label();
                    l_label.Text = "Are you sure you want to continue?";

                    HtmlGenericControl l_div    = new HtmlGenericControl();
                    Button             l_ok     = new Button();
                    Button             l_cancel = new Button();
                    l_ok.ID       = "l_ok";
                    l_ok.Text     = "OK";
                    l_cancel.ID   = "l_cancel";
                    l_cancel.Text = "Cancel";
                    l_div.Controls.Add(l_ok);
                    l_div.Controls.Add(new LiteralControl(" "));
                    l_div.Controls.Add(l_cancel);
                    l_div.Attributes.Add("align", "center");

                    l_panel.Controls.Add(l_label);
                    l_panel.Controls.Add(new LiteralControl("<br>"));
                    l_panel.Controls.Add(new LiteralControl("<br>"));
                    l_panel.Controls.Add(l_div);

                    ModalPopupExtender l_mpe = new ModalPopupExtender();
                    l_mpe.ID = "l_mpe";
                    l_mpe.TargetControlID    = l_btnCancel.ID;
                    l_mpe.PopupControlID     = l_panel.ID;
                    l_mpe.BackgroundCssClass = "modalBackground";
                    l_mpe.DropShadow         = true;
                    l_mpe.OkControlID        = l_ok.ID;
                    l_mpe.CancelControlID    = l_cancel.ID;


                    ConfirmButtonExtender l_cbe = new ConfirmButtonExtender();
                    l_cbe.TargetControlID     = l_btnCancel.ID;
                    l_cbe.ConfirmText         = "";
                    l_cbe.DisplayModalPopupID = l_mpe.ID;

                    e.Item.Cells[5].Controls.Add(l_panel);
                    e.Item.Cells[5].Controls.Add(l_mpe);
                    e.Item.Cells[5].Controls.Add(l_cbe);
                }

                //delete btn col
                Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button;

                if (l_spon.Checked)
                {
                    ((Label)e.Item.Cells[4].Controls[1]).Text = "Active";
                    l_able.Text = "Inactivate";
                    Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel;
                    ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_spon.SponsorCode) + "]?";
                }
                else
                {
                    ((Label)e.Item.Cells[4].Controls[1]).Text = "Inactive";
                    l_able.Text = "Activate";
                    Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel;
                    ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_spon.SponsorCode) + "]?";
                }
            }
        }