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

            PubEntAdmin.BLL.Owner l_owner = dt[e.Item.DataSetIndex];
            int    Ownerid  = l_owner.OwnerID;
            string Fname    = l_owner.FirstName;
            string Lname    = l_owner.LastName;
            string Minitial = l_owner.MiddleInitial;

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

            if (Activestatus == "Inactive")
            {
                Boolean ownerExist = LU_DAL.OwnerExist(Ownerid);

                if (ownerExist == false)
                {
                    LU_DAL.DeleteOwnerLU(Ownerid);
                    this.BindData();
                }
                else if (ownerExist == true)
                {
                    string confirm = "Unable to Inactivate, value associated with Publication.";
                    ((Label)e.Item.Cells[8].Controls[1]).Text = confirm;
                }
            }
            if (Activestatus == "Active")
            {
                LU_DAL.UpdateOwnerLU(Ownerid, Fname, Lname, Minitial);
                this.BindData();
            }
        }
예제 #2
0
        protected void gvResult_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            OwnerCollection dt = ((OwnerCollection)this.gvResult.DataSource);

            PubEntAdmin.BLL.Owner l_owner = dt[e.Item.DataSetIndex];
            int OwnerID = l_owner.OwnerID;

            string lname    = ((TextBox)e.Item.Cells[1].Controls[1]).Text.Trim();
            string fname    = ((TextBox)e.Item.Cells[2].Controls[1]).Text.Trim();
            string minitial = ((TextBox)e.Item.Cells[3].Controls[1]).Text;


            bool valid    = false;
            bool validlen = false;

            if (lname.Length != 0)
            {
                valid    = PubEntAdminManager.OtherVal(lname);
                validlen = PubEntAdminManager.LenVal(lname, 20);
            }


            if (fname.Length != 0)
            {
                valid    = PubEntAdminManager.OtherVal(fname);
                validlen = PubEntAdminManager.LenVal(fname, 20);
            }

            if (minitial.Length != 0)
            {
                valid    = PubEntAdminManager.OtherVal(minitial);
                validlen = PubEntAdminManager.LenVal(minitial, 1);
                minitial = minitial.Trim();
            }

            if ((valid == false) && (validlen == true))
            {
                OwnerCollection coll = LU_DAL.GetOwnerByFullname(fname, lname, minitial);
                if (coll.Count > 0)
                {
                    string confirm = "The Owner already existed.";
                    ((Label)e.Item.Cells[8].Controls[1]).Text = confirm;
                }
                else
                {
                    LU_DAL.UpdateOwnerLU(OwnerID, fname, lname, minitial);
                    this.gvResult.EditItemIndex = -1;
                    //this.BindDataAferUpdate();
                    this.BindData();
                }
            }
            else
            {
                Response.Redirect("InvalidInput.aspx");
            }
        }
예제 #3
0
        protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            OwnerCollection dt = ((OwnerCollection)this.gvResult.DataSource);

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

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

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

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

                if (e.Item.Cells[6].Controls[2] is Button)
                {
                    Button l_btnCancel = ((Button)e.Item.Cells[6].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[6].Controls.Add(l_panel);
                    e.Item.Cells[6].Controls.Add(l_mpe);
                    e.Item.Cells[6].Controls.Add(l_cbe);
                }

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

                if (l_owner.Checked)
                {
                    ((Label)e.Item.Cells[5].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_owner.LastName + ',' + l_owner.FirstName) + "]?";
                }
                else
                {
                    ((Label)e.Item.Cells[5].Controls[1]).Text = "Inactive";
                    l_able.Text = "Activate";
                    Panel l_pnl = e.Item.Cells[7].FindControl("pnlConfirmDel") as Panel;
                    ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_owner.LastName + ',' + l_owner.FirstName) + "]?";
                }
            }
        }
예제 #4
0
 public bool Contains(Owner value)
 {
     return(List.Contains(value));
 }
예제 #5
0
 public void Remove(Owner value)
 {
     List.Remove(value);
 }
예제 #6
0
 public void Insert(int index, Owner value)
 {
     List.Insert(index, value);
 }
예제 #7
0
 public int Add(Owner value)
 {
     return(List.Add(value));
 }