C# (CSharp) EventArgs Code Examples

C# (CSharp) EventArgs - 30 examples found. These are the top rated real world C# (CSharp) examples of EventArgs extracted from open source projects. You can rate examples to help us improve the quality of examples
Frequently Used Methods
Example #1
0
 protected void lbtnBindToUser_Click(object sender, EventArgs e)
 {
     if (txtBindedId != null && txtBankName != null && txtBankCardId != null)
     {
         WMUsers user = WMUsers.Get(Helper.User.Id);
         if (user != null)
         {
             //user.OpenId = txtBankCardId.Text;
             user.BankName = txtBankName.Text;
             user.BankCard = txtBankCardId.Text;
             user.RoleId = 102;
             if (user.Update())
             {
                 //BindWeixin = null;
                 IsBinded = null;
                 BindMessage = null;
                 JsResponse = Success();
             }
             else
             {
                 JsResponse = Fail();
             }
         }
         UserBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         btnImport.Attributes["onclick"] = "return IfExp();";
     }        
 }
 //protected void Button1_Click(object sender, EventArgs e)
 //{
 //    MembershipUser user = Membership.GetUser(HttpContext.Current.User.Identity.Name);
 //    String user_id = user.ProviderUserKey.ToString();
 //    new Controller().Test(user_id);
 //}
 protected void LinkButton_Download_Click(object sender, EventArgs e)
 {
     Response.ContentType = "Application/pdf";
     Response.AppendHeader("Content-Disposition", "attachment; filename=User_Manual.pdf");
     Response.TransmitFile(Server.MapPath("~/Admin/PDFs/20100622_User_Manual_2.0_ForWEBSITE.pdf"));
     Response.End();
 }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Label1.Text = "初始录入结束时间为" + WebConfigurationManager.AppSettings.Get(theKeyName);
     }
 }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ExamDbModel.ExamDbEntities x = new ExamDbModel.ExamDbEntities();

        var chaps = x.Questions.Select(p => new
        {
            ChapterID = p.ChapterID,
            QuestionID = p.QuestionID,
            QuestionType = p.QuestionBlank != null ? "Blank" : p.QuestionBool != null ? "Bool" : "MCQ",
            Question = p
        }).GroupBy(p => new { p.ChapterID, p.QuestionType });

        List<Object > list = new List<Object>();

        foreach (var t in chaps)
        {
           /* list.Add(new
            {
                ChapterID=t.Key.ChapterID,
                QuestionType=t.Key.QuestionType,
                Count = t.Count()
            });*/

            foreach (var k in t.OrderBy(p=>p.QuestionID*rnd.Next()).Take(3))
            {
                list.Add(k);
            }
        }

         GridView1.DataSource = list; //chaps.ToList();
         GridView1.DataBind();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (User.Identity.Name == "")
     {
         Response.Redirect("createUser.aspx");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                IncludeCss("StoreTaxes", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css", "/Templates/" + TemplateName + "/css/PopUp/style.css");
                IncludeJs("StoreTaxes", "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js",
                     "/js/GridView/jquery.dateFormat.js", "/js/DateTime/date.js", "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/js/PopUp/custom.js", "/js/ExportToCSV/table2CSV.js", "/Modules/AspxCommerce/AspxTaxManagement/js/StoreTax.js", "/js/CurrencyFormat/jquery.formatCurrency-1.4.0.js",
                          "/js/CurrencyFormat/jquery.formatCurrency.all.js");

                StoreID = GetStoreID;
                PortalID = GetPortalID;
                Username = GetUsername;
                CultureName = GetCurrentCultureName;
                UserModuleID = SageUserModuleID;
            }
            IncludeLanguageJS();

        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Example #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            int id;
            if (!int.TryParse(Request.QueryString["id"], out id))
            {
                Response.Redirect("~/MediaCenter.aspx");
            }
            Database db = new Database();
            Lang lang = new Lang();
            db.AddParameter("@lang", lang.getCurrentLang());
            db.AddParameter("@id", id);
            DataTable dt = db.ExecuteDataTable("select top(3) * from Report where lang=@lang and (not id=@id) Order by id desc");
            Repeater1.DataSource = dt;
            Repeater1.DataBind();

            db.AddParameter("@lang", lang.getCurrentLang());
            dt = db.ExecuteDataTable("select top(3) * from SocialEvent where lang=@lang Order by id desc");
            Repeater2.DataSource = dt;
            Repeater2.DataBind();

            db.AddParameter("@lang", lang.getCurrentLang());
            db.AddParameter("@id", id);
            dt = db.ExecuteDataTable("select * from Report where lang=@lang and id=@id");
            Repeater3.DataSource = dt;
            Repeater3.DataBind();

            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/MediaCenter.aspx");
            }
        }
    }
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Check security
        CheckSecurity();

        // Set cultures
        SetCulture();
        IFormatProvider culture = DateTimeHelper.DefaultIFormatProvider;
        IFormatProvider currentCulture = new CultureInfo(Thread.CurrentThread.CurrentUICulture.IetfLanguageTag);

        // Get report info
        string reportName = ValidationHelper.GetString(Request.QueryString["reportname"], "");
        ReportInfo report = ReportInfoProvider.GetReportInfo(reportName);

        if (report != null)
        {
            // Get report parameters
            string parameters = QueryHelper.GetString("parameters", "");
            DataRow drParameters = ReportHelper.GetReportParameters(report, parameters, AnalyticsHelper.PARAM_SEMICOLON, culture, currentCulture);

            // Init report
            if (drParameters != null)
            {
                DisplayReport1.LoadFormParameters = false;
                DisplayReport1.ReportParameters = drParameters;
            }

            DisplayReport1.ReportName = report.ReportName;
            DisplayReport1.DisplayFilter = false;

            Page.Title = GetString("Report_Print.lblPrintReport") + " " + HTMLHelper.HTMLEncode(report.ReportDisplayName);
        }
    }
 protected void btnUserSearch_Click(object sender, EventArgs e)
 {
     bool searchByEmail = ddlUserSearchTypes.SelectedValue == "E-mail";
     gvUsers.Attributes.Add("SearchText","%" + txtUserSearch.Text + "%");
     gvUsers.Attributes.Add("SearchByEmail", searchByEmail.ToString());
     BindAllUsers(false);
 }
Example #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblTitleofUSS.Text = System.Configuration.ConfigurationManager.AppSettings["ussName"];
        // Get User Name
        if (Session["UserName"] != null)
        {
            lblUserNameBanner.Visible = true;
            lblUserNameBanner.Text = "User: " + Session["userName"].ToString();
        }
        else
        {
            lblUserNameBanner.Visible = false;
        }

        // Get Group Name
        if (Session["GroupName"] != null)
        {
            lblGroupNameBanner.Text = "Group: " + Session["groupName"].ToString();
            lblGroupNameBanner.Visible = true;
        }
        else
        {
            lblGroupNameBanner.Visible = false;
        }
    }
Example #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindRoles();
     }
 }
    /// <summary>
    /// OnPreInit
    /// </summary>
    protected override void OnPreInit(EventArgs e)
    {
        PortalContext.ViewMode = ViewModeEnum.Preview;
        DocumentManager.RedirectForNonExistingDocument = false;

        base.OnPreInit(e);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     HakAkses();
     isiPeriode();
     bool normal = true;
     if (normal && (Request.Params["sm"] is object)) normal = ServiceSelect(Request.Params["sm"].ToString());
 }
    private void EditForm_OnAfterValidate(object sender, EventArgs e)
    {
        // Validate ToDate > FromDate
        FormEngineUserControl fromField = EditForm.FieldControls["CampaignOpenFrom"] as FormEngineUserControl;
        FormEngineUserControl toField = EditForm.FieldControls["CampaignOpenTo"] as FormEngineUserControl;

        DateTime from = DateTimeHelper.ZERO_TIME;
        DateTime to = DateTimeHelper.ZERO_TIME;

        if (fromField != null)
        {
            from = ValidationHelper.GetDateTime(fromField.Value, DateTimeHelper.ZERO_TIME);
        }

        if (toField != null)
        {
            to = ValidationHelper.GetDateTime(toField.Value, DateTimeHelper.ZERO_TIME);
        }

        if ((from != DateTimeHelper.ZERO_TIME) && (to != DateTimeHelper.ZERO_TIME) && (from > to))
        {
            EditForm.StopProcessing = true;
            EditForm.DisplayErrorLabel("CampaignOpenFrom", GetString("campaign.wronginterval"));
        }
    }
Example #16
0
 protected void dllAmount_Init(object sender, EventArgs e)
 {
     //create list of integers for values to select on ticket amounts
     DropDownList ddlSender = (DropDownList)sender;
     List<Int16> amounts = new List<Int16>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     ddlSender.DataSource = amounts;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        title = valObj._ZhName + "����";
        Page.Title = title;
        if (!string.IsNullOrEmpty(Request["STEP_ID"]))
        {
            stepid = int.Parse(Request["STEP_ID"]);
        }
        if (!string.IsNullOrEmpty(Request["WFID"]))
        {
            wfid = int.Parse(Request["WFID"]);
        }
        if (!IsPostBack)
        {
            #region//Ĭ�����Գ�ʼ��

            #endregion
            #region//���ݳ�ʼ��

            #endregion
            condObj.STEP_ID = stepid;
            BindList(condObj);

        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CarregarTela();
     }
 }
Example #19
0
 protected void Back_Render(object sender, EventArgs e)
 {
     if (BackEvent != null)
     {
         BackEvent(this, e);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     // resolved URL
     string folderUrl = ResolveUrl(relativeUrl);
     // path to the folder with images
     string folderPath = Page.MapPath(folderUrl);
     if (Directory.Exists(folderPath)) // such folder exists
     {
         // get all entires
         string[] entires = Directory.GetFileSystemEntries(folderPath);
         foreach (string entire in entires)
         {
             FileAttributes attr = File.GetAttributes(entire);
             string name = Path.GetFileName(entire);
             // get files only
             if (!((attr & FileAttributes.Directory) == FileAttributes.Directory))
             {
                 string ext = Path.GetExtension(entire).ToLower();
                 // images only
                 if (ext == ".gif" || ext == ".jpg" || ext == ".jpeg" || ext == ".bmp" || ext == ".png")
                 {
                     string width = "", height = "";
                     GetWidthHeight(entire, out width, out height);
                     string title = GetTitle(entire);
                     string url = Path.Combine(folderUrl, name).Replace("\\", "/");
                     // put the 'preview' image into the page
                     string str = "<img align=\"top\" title=\""+(ext.Substring(1)+" "+width+"x"+height)+"\" alt=\"\" style=\"cursor: pointer; border-style: solid; border-color: white; border-width:3px\" onmouseout=\"if(!this.selected) this.style.borderColor = 'white';\" onmouseover=\"if(!this.selected) this.style.borderColor = 'gray';\" onclick=\"_setResult(this);\" ondblclick=\"_returnResult(this);\" width=\"100\" src=\"" + url + "\" source-url=\"" + url + "\" source-height=\"" + height + "\" source-width=\"" + width + "\" source-title=\"" + title + "\" />";
                     Literal1.Text += str+"\n";
                 }
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["username"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         if (int.Parse(Session["role"].ToString()) == 1)
         {
             if (!IsPostBack)
             {
                 Binding_Datagrid();
                 Binding_Station();
                 btnAdd.Attributes["Onclick"] = "return confirm('Do you really want to add?')";
                 btnUpdate.Attributes["Onclick"] = "return confirm('Do you really want to update?')";
                 btnDelete.Attributes["Onclick"] = "return confirm('Do you really want to delete?')";  
             }
         }
         else
         {
             Response.Redirect("Admin_manager.aspx");
         }
     }
 }
Example #22
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataClassesDataContext da = new DataClassesDataContext();

        var result1 = from n in da.user
                     where n.user_name == TextBox3.Text
                     select n.major;
        var result2 = from m in da.project
                      where m.project_num == DropDownList1.Text
                      select m.major;
        foreach (var n in result1)
        {
            foreach (var m in result2)
            {
                if (n != m)
                {
                    ClientScriptManager client = this.ClientScript;
                    client.RegisterStartupScript(this.GetType(), "55", "<script>alert('专业不符!');history.back()</script>");
                    return;
                }
            }
        }
        proposal p = new proposal();
        p.proposal1 = TextBox1.Text;
        p.project_num = DropDownList1.Text;
        p.teacher_name = DropDownList2.Text;
        p.user_name = TextBox3.Text;
        p.proposal_num = TextBox2.Text;
        da.proposal.InsertOnSubmit(p);
        da.SubmitChanges();
        GridView1.DataBind();
    }
Example #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["status"] != null)
        {
            switch (Request.QueryString["status"].ToString())
            {
                case "success":
                    //if success
                    LblStatus.ForeColor = System.Drawing.Color.Green;
                    LblStatus.Text = "تمت الاضافه";
                    break;
                case "failed":
                    //if failed
                    LblStatus.Text = "خطاء!!  لم تتم الاضافه";
                    LblStatus.ForeColor = System.Drawing.Color.Red;
                    break;
                case "missing":
                    //if missing
                    LblStatus.Text = "خطأ!! البيانات ليست كامله";
                    LblStatus.ForeColor = System.Drawing.Color.Blue;
                    break;
                default:
                    break;
            }

        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string empUsername = TextBox1.Text;
        string empPassword = TextBox2.Text;

        Common_LoginBL objLoginBL = new Common_LoginBL();
        int empId = objLoginBL.Common_Login(empUsername, empPassword);
        if (empId == 0)
        {
            Label1.Text = "Invalid Username/Password";
            Label1.Visible = true;
            Label1.ForeColor = System.Drawing.Color.Red;
            TextBox1.BackColor = System.Drawing.Color.Pink;
            TextBox2.BackColor = System.Drawing.Color.Pink;
        }
        else
        {
            Session["empType"] = "Doctor";
            Session["doctorId"] = empId;
            Session["doctorUsername"] = empUsername;
            Session["doctorPassword"] = empPassword;
            Common_GetLastLoginBL objCommon_GetLastLoginBL = new Common_GetLastLoginBL();
            Session["doctortLastLogin"] = objCommon_GetLastLoginBL.Common_GetLastLogin(empId);
            Common_AddLastLoginBL objAddLastLoginBL = new Common_AddLastLoginBL();
            objAddLastLoginBL.Common_AddLastLogin(empId);
            Session.Timeout = 24 * 60;
            Response.Redirect("DoctorHome.aspx");
        }
    }
Example #25
0
	protected void Page_Load(object sender, EventArgs e)
	{
		var tree = sp1.FindControl("tree") as PXTreeView;
		var grid = sp1.FindControl("grid") as PXGrid;
		this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "varreg", "var treeId='" + tree.ClientID + "';", true);
		this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "gridID", "var gridID=\"" + grid.ClientID + "\";", true);
	}
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!QueryHelper.ValidateHash("hash"))
        {
            URLHelper.Redirect(ResolveUrl("~/CMSMessages/Error.aspx?title=" + ResHelper.GetString("imageeditor.badhashtitle") + "&text=" + ResHelper.GetString("imageeditor.badhashtext")));
        }
        else
        {
            ScriptHelper.RegisterJQueryCrop(Page);
            ScriptHelper.RegisterScriptFile(Page, "~/CMSAdminControls/ImageEditor/ImageEditorInnerPage.js");

            string imgUrl = QueryHelper.GetString("imgurl", null);
            if (String.IsNullOrEmpty(imgUrl))
            {
                string url = URLHelper.ResolveUrl("~/CMSAdminControls/ImageEditor/GetImageVersion.aspx" + URLHelper.Url.Query);
                url = URLHelper.RemoveParameterFromUrl(url, "hash");
                url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));

                imgContent.ImageUrl = url;

                int imgwidth = QueryHelper.GetInteger("imgwidth", 0);
                int imgheight = QueryHelper.GetInteger("imgheight", 0);
                if ((imgwidth > 0) && (imgheight > 0))
                {
                    imgContent.Width = imgwidth;
                    imgContent.Height = imgheight;
                }
            }
            else
            {
                imgContent.ImageUrl = imgUrl;
            }
        }
    }
    protected void btnAddNewTeam_Click(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection("Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\SoccerClubDatabase.mdf;Integrated Security=True");

        String countTeamQuery = "select count(*) from Teams where TeamName LIKE @teamName";
        SqlCommand com = new SqlCommand(countTeamQuery, conn);
        com.Parameters.AddWithValue("@teamName", txtAddNewTeam.Text);

        conn.Open();
        int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
        conn.Close();

        if (temp == 0)
        {
            string insertTeamQuery = "INSERT INTO Teams (TeamName) values @teamName";
            SqlCommand addTeamCom = new SqlCommand(insertTeamQuery, conn);
            addTeamCom.Parameters.AddWithValue("@teamName", txtAddNewTeam.Text);

            conn.Open();
            addTeamCom.ExecuteNonQuery();
            conn.Close();

            Response.Write("Team Entered");
        }
        else
        {
            Response.Write("Team Already Entered");
        }
    }
Example #28
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     var tempid = txtIdcard.Text.Trim();
     if (CheckIDCard(tempid))
     {
         if (Request.QueryString["cuid"] != null)
         {
             CommonUser cu = bllcommonuser.GetCommonUserByid(int.Parse(Request.QueryString["cuid"]));
             cu.Name = txtName.Text.Trim();
             cu.IdCard = txtIdcard.Text.Trim();
             bllcommonuser.updatecu(cu);
             Response.Redirect("CommonUserInfo.aspx");
         }
         else
         {
             CommonUser cu = new CommonUser();
             cu.Name = txtName.Text.Trim();
             cu.IdCard = txtIdcard.Text.Trim();
             cu.User = CurrentMember;
             string msg;
             bllcommonuser.SaveCommonUser(cu, out msg);
         }
         Response.Redirect("CommonUserInfo.aspx");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "alert('身份证号码不正确,请确认!')", true);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     // If the person was to get here using a direct link from the incident report page.
     // Clear the profile.
     Profile.IncidentReportID = "";
     Profile.DropZoneID = "";
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request[WebConstants.Request.USER_UID] != null && Request[WebConstants.Request.VERIFICATION_CODE] != null)
     {
         SimplicityCommLib.DataSets.Common.Users.UsersRow user = DatabaseUtility.Instance.GetUserByUID(Request[WebConstants.Request.USER_UID]);
         if (user != null)
         {
             string verificationCode = Utility.GetMd5Sum(user.VerificationCode);
             if (verificationCode.Equals(Request[WebConstants.Request.VERIFICATION_CODE]))
             {
                 SimplicityCommLib.DataSets.Common.UsersTableAdapters.UsersTableAdapter userTA = new SimplicityCommLib.DataSets.Common.UsersTableAdapters.UsersTableAdapter();
                 userTA.VerifyUser(user.UserId);
                 SetInfoMessage(WebConstants.Messages.Information.ACCOUNT_VERIFIED);
             }
             else
             {
                 SetErrorMessage(WebConstants.Messages.Error.CANNOT_VERIFY);
             }
         }
         else
         {
             SetErrorMessage(WebConstants.Messages.Error.CANNOT_VERIFY);
         }
     }
     else
     {
         SetErrorMessage(WebConstants.Messages.Error.CANNOT_VERIFY);
     }
 }