Ejemplo n.º 1
0
        private void LoopRepeater()
        {
            DataSet  ds = oCustom.GetIDCAssetTypes(0);
            DataView dv = ds.Tables[0].DefaultView;

            if (Request.QueryString["sort"] != null)
            {
                dv.Sort = Request.QueryString["sort"].ToString();
            }
            rptView.DataSource = dv;
            rptView.DataBind();
            foreach (RepeaterItem ri in rptView.Items)
            {
                ImageButton oDelete = (ImageButton)ri.FindControl("btnDelete");
                oDelete.Attributes.Add("onClick", "return confirm('Are you sure you want to delete this item?');");
                ImageButton oEnable = (ImageButton)ri.FindControl("btnEnable");
                if (oEnable.ImageUrl == "/admin/images/enabled.gif")
                {
                    oEnable.ToolTip = "Click to disable";
                    oEnable.Attributes.Add("onClick", "return confirm('Are you sure you want to disable this item?');");
                }
                else
                {
                    oEnable.ToolTip = "Click to enable";
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            oCustom    = new Customized(intProfile, dsn);
            oUser      = new Users(intProfile, dsn);
            oPage      = new Pages(intProfile, dsn);

            lblModified.Text = oUser.GetFullNameAD(intProfile, intEnvironment);
            lblUpdated.Text  = DateTime.Now.ToString();

            if (Request.QueryString["save"] != null)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">window.top.refreshIE();<" + "/" + "script>");
            }
            if (Request.QueryString["rid"] != "" && Request.QueryString["rid"] != null)
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
            }
            if (Request.QueryString["iid"] != "" && Request.QueryString["iid"] != null)
            {
                intItem = Int32.Parse(Request.QueryString["iid"]);
            }
            if (Request.QueryString["num"] != "" && Request.QueryString["num"] != null)
            {
                intNumber = Int32.Parse(Request.QueryString["num"]);
            }
            if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
            {
                intId = Int32.Parse(Request.QueryString["id"]);
            }

            if (!IsPostBack)
            {
                drpAssetType.DataSource     = oCustom.GetIDCAssetTypes(1);
                drpAssetType.DataTextField  = "name";
                drpAssetType.DataValueField = "id";
                drpAssetType.DataBind();
                drpAssetType.Items.Insert(0, "-- SELECT --");
                if (intId > 0)
                {
                    btnUpdate.Visible           = true;
                    btnAdd.Visible              = false;
                    dsAsset                     = oCustom.GetTechAsset(intId);
                    drpAssetType.SelectedValue  = dsAsset.Tables[0].Rows[0]["asset_typeid"].ToString();
                    drpSaleStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["salestatus"].ToString();
                    lblModified.Text            = dsAsset.Tables[0].Rows[0]["lastmodified"].ToString();
                    lblUpdated.Text             = dsAsset.Tables[0].Rows[0]["modified"].ToString();
                }
            }
            btnAdd.Attributes.Add("onclick", "return ValidateDropDown('" + drpAssetType.ClientID + "','Please make a selection for Asset Type')" +
                                  "&& ValidateDropDown('" + drpSaleStatus.ClientID + "','Please make a selection for Sale Status')" +
                                  ";");
            btnUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + drpAssetType.ClientID + "','Please make a selection for Asset Type')" +
                                     "&& ValidateDropDown('" + drpSaleStatus.ClientID + "','Please make a selection for Sale Status')" +
                                     ";");
        }