Ejemplo n.º 1
0
 /// <summary>Page Load.</summary>
 public void Page_Load
 (
  object     sender, 
  EventArgs  e
 ) 
 {
  if ( !Page.IsPostBack )
  {
   TextBoxPrime.Focus();
   Page.SetFocus( TextBoxPrime );
  }//if ( !Page.IsPostBack )
 }//Page_Load
Ejemplo n.º 2
0
        /// <summary>Page Load.</summary>
        public void Page_Load
        (
            object sender,
            EventArgs e
        )
        {
            string exceptionMessage = null;

            ServerMapPath            = this.MapPath("");
            FilenameConfigurationXml = Path.Combine(ServerMapPath, FilenameConfigurationXml);
            UtilityImpersonate.GetUsernamePasswordDomainName
            (
                ref FilenameConfigurationXml,
                ref ImpersonateDomainName,
                ref ImpersonatePassword,
                ref ImpersonateUserName,
                ref exceptionMessage
            );
            if (exceptionMessage != null)
            {
                Feedback = exceptionMessage; return;
            }
            if (!Page.IsPostBack)
            {
                TextBoxText.Focus();
                Page.SetFocus(TextBoxText);
            } //if ( !Page.IsPostBack )
        }     //Page_Load
Ejemplo n.º 3
0
 public void AddInfo(TextBox txtBox, ListBox listBox, AddDelegate addMethod, GetDelegate getMethod)
 {
     string txt = txtBox.Text;
     int addCount = 0;
     DataSet ds;
     if (txt != "")
     {
         addCount = addMethod(txt);
         if (addCount <= 0)
         {
             MsgBox("该值已存在!");
         }
     }
     else
     {
         MsgBox("不能添加空值!");
     }
     listBox.Items.Clear();
     txtBox.Text = "";
     ds = getMethod();
     for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
     {
         listBox.Items.Add(ds.Tables[0].Rows[i][0].ToString());
     }
     txtBox.Focus();
 }
Ejemplo n.º 4
0
 public static void EmptyTextBoxes(System.Web.UI.Control parent, TextBox tb)
 {
     //Loop through all controls
     foreach (System.Web.UI.Control ctrControl in parent.Controls)
     {
         //Check to see if it's a textbox
         if (ctrControl.GetType() == typeof(TextBox))
         {
             //If it is then set the text to String.Empty (empty textbox)
             ((TextBox) ctrControl).Text = string.Empty;
             //Set the focus to the textbox you set in the call of the sub
             tb.Focus();
         }
         else if (ctrControl.GetType() == typeof(DropDownList)) //Next check if it's a dropdown list
         {
             //If it is then set its SelectedIndex to 0
             ((DropDownList) ctrControl).SelectedIndex = 0;
         }
         if (ctrControl.HasControls())
         {
             //Call itself to get all other controls in other containers
             //Note: Remove the argument tb if you have removed the ByVal tb As TextBox argument in the signature.
             EmptyTextBoxes(ctrControl, tb);
         }
     }
 }
Ejemplo n.º 5
0
        protected void CaptchaValidator_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            args.IsValid = Captcha.IsValid;

            System.Web.UI.WebControls.TextBox textBox = (System.Web.UI.WebControls.TextBox)Captcha.FindControl("CaptchaTextBox");
            Captcha.CaptchaTextBoxCssClass = Captcha.CaptchaTextBoxCssClass.Replace(" Invalid", string.Empty);

            if (args.IsValid)
            {
                textBox.Attributes.Remove("validatorId");
            }
            else
            {
                CaptchaValidator.ErrorMessage = Resources.SignupOrganizationControl_CaptchaValidator_ErrorMessage;
                CaptchaValidator.ForeColor    = System.Drawing.Color.Empty;

                Captcha.CaptchaTextBoxCssClass   += " Invalid";
                textBox.Attributes["validatorId"] = CaptchaValidator.ClientID;
                textBox.Focus();
            }
        }
Ejemplo n.º 6
0
  }//public String Feedback

  /// <summary>ButtonReset_Click()</summary>
  public void ButtonReset_Click
  (
   Object sender, 
   EventArgs e
  )
  {
   CheckBoxXml.Checked  =  false;
   Feedback             =  null;
   TextBoxText          =  null;
   TextBoxText.Focus();   
  }//public void ButtonReset_Click()
Ejemplo n.º 7
0
 /// <summary>
 /// Sets focus to a control.
 /// </summary>
 public override void Focus()
 {
     if (this.Masked)
     {
         m_RadMaskedTextBox.Focus();
     }
     else
     {
         m_TextBox.Focus();
     }
 }
Ejemplo n.º 8
0
            public static bool ValidarTextBoxVacio(TextBox TextoValidar, string MensajedeError)
        {
            bool valido = true;

            if (TextoValidar.Text.Trim().Length == 0)
            {
                TextoValidar.Focus();
                valido = false;
            }

            return valido;

        }
Ejemplo n.º 9
0
 /// <summary>
 /// 验证是否为null或string.Empty
 /// </summary>
 /// <param name="value"></param>
 /// <param name="title"></param>
 /// <returns></returns>
 public static void IsNullOrEmpty(TextBox textBox, string title, ref bool isContinue, ref string errorMsg)
 {
     string value = textBox.Text.Trim();
     if (isContinue)
     {
         if (value == null || value.Trim() == string.Empty)
         {
             errorMsg = string.Format("{0}不可为空!", title);
             isContinue = false;
             textBox.Focus();
         }
     }
     errorMsg = isContinue ? string.Empty : errorMsg;
 }
Ejemplo n.º 10
0
 protected void GetAutomaticDropDownList(TextBox textCode, DropDownList dropDownSource)
 {
     ListItem item = dropDownSource.Items.FindByValue(textCode.Text);
     if (item != null)
     {
         dropDownSource.SelectedValue = textCode.Text;
     }
     else
     {
         dropDownSource.SelectedIndex = 0;
         textCode.Text = dropDownSource.SelectedValue;
         textCode.Focus();
     }
 }
Ejemplo n.º 11
0
        protected override void AttachChildControls()
        {
            if (Context.Request.IsAuthenticated)
            {
                FormsAuthentication.SignOut();
                HttpCookie authCookie = FormsAuthentication.GetAuthCookie(HiContext.Current.User.Username, true);
                IUserCookie userCookie = HiContext.Current.User.GetUserCookie();
                if (userCookie != null)
                {
                    userCookie.DeleteCookie(authCookie);
                }
                RoleHelper.SignOut(HiContext.Current.User.Username);
            }
            if (!string.IsNullOrEmpty(Page.Request["action"]) && (Page.Request["action"] == "Common_UserLogin"))
            {
                string str = UserLogin(Page.Request["username"], Page.Request["password"]);
                string str2 = string.IsNullOrEmpty(str) ? "Succes" : "Fail";
                Page.Response.Clear();
                Page.Response.ContentType = "application/json";
                Page.Response.Write("{\"Status\":\"" + str2 + "\",\"Msg\":\"" + str + "\"}");
                Page.Response.End();
            }
            txtUserName = (TextBox) FindControl("txtUserName");
            txtPassword = (TextBox) FindControl("txtPassword");
            btnLogin = ButtonManager.Create(FindControl("btnLogin"));
            ddlPlugins = (DropDownList) FindControl("ddlPlugins");
            if (ddlPlugins != null)
            {
                ddlPlugins.Items.Add(new ListItem("请选择登录方式", ""));
                IList<OpenIdSettingsInfo> configedItems = MemberProcessor.GetConfigedItems();
                if ((configedItems != null) && (configedItems.Count > 0))
                {
                    foreach (OpenIdSettingsInfo info in configedItems)
                    {
                        ddlPlugins.Items.Add(new ListItem(info.Name, info.OpenIdType));
                    }
                }
                ddlPlugins.SelectedIndexChanged += new EventHandler(ddlPlugins_SelectedIndexChanged);
            }

            if ( Page.Request.UrlReferrer != null &&!string.IsNullOrEmpty(Page.Request.UrlReferrer.OriginalString))
            {
                ReturnURL = Page.Request.UrlReferrer.OriginalString;
            }

            txtUserName.Focus();
            PageTitle.AddSiteNameTitle("用户登录", HiContext.Current.Context);
            btnLogin.Click += new EventHandler(btnLogin_Click);
        }
        /// <summary>Page Load.</summary>
        public void Page_Load
        (
            object sender,
            EventArgs e
        )
        {
            ServerMapPath = this.MapPath("");

            if (!Page.IsPostBack)
            {
                if (ServerMapPath != null)
                {
                }//if ( ServerMapPath != null)
                TextBoxDomainName.Focus();
                Page.SetFocus(TextBoxDomainName);
            } //if ( !Page.IsPostBack )
        }     //Page_Load
        public override System.Web.UI.Control CreateUIControl(HtmlGenericControl parent, object dataContext,
                                                              AddressResx addressResx)
        {
            this.dataContext = dataContext;
            var tb = new System.Web.UI.WebControls.TextBox();

            tb.ID       = Name;
            tb.CssClass = Style;
            if (!string.IsNullOrEmpty(MaximumLength))
            {
                tb.MaxLength = int.Parse(MaximumLength);
            }
            tb.TabIndex = short.Parse(IndexForTab);
            //tb.Text = ResolveBinding(dataContext);
            tb.EnableViewState = true;
            parent.Controls.Add(tb);
            if (!string.IsNullOrEmpty(ChangeHandler))
            {
                tb.Attributes.Add("onChange", ChangeHandler);
            }

            if (!string.IsNullOrEmpty(KeyPressHandler))
            {
                tb.Attributes.Add("onkeypress", KeyPressHandler);
            }

            if (!string.IsNullOrEmpty(KeyPressAndBlurHandler))
            {
                tb.Attributes.Add("onkeypress", KeyPressAndBlurHandler);
                tb.Attributes.Add("onblur", KeyPressAndBlurHandler);
            }

            if (!string.IsNullOrEmpty(ReadOnly))
            {
                tb.ReadOnly = ReadOnly.ToLower().Equals("true");
            }

            if (!string.IsNullOrEmpty(HasFocus) && HasFocus.ToLower().Equals("true"))
            {
                tb.Focus();
            }
            return(uiControl = tb);
        }
Ejemplo n.º 14
0
        //private string c_strPermissionError="An illegal action was performed or your role has been changed. You have been logged out of [APPNAME].";
        //private string c_strLoginDetailsError="The login details you have entered are not correct.";
        //private string c_strInactiveError="Your login was not successful.  Please see your Organisation Administrator.";

        /// <summary>
        /// Page load event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            litLogin.Text = ResourceManager.GetString("pagTitle");
            txtUserName.Focus();
            Organisation getorgdetails = new Organisation();
            string       strlnk        = Request.Url.Authority.ToString();
            DataTable    dtorgdetails  = getorgdetails.GetOrganisationwithDomainName(Request.Url.Authority.ToString());

            //DataTable dtorgdetails = getorgdetails.GetOrganisationwithDomainName("demo.saltcompliance.com");
            if (dtorgdetails.Rows.Count > 0)
            {
                if (dtorgdetails.Rows[0]["EnableUniqueURL"].ToString() == "True")
                {
                    urlRequest.Visible = true;
                }
                else
                {
                    urlRequest.Visible = false;
                }
            }

            if (!Page.IsPostBack)
            {
                string strRedirectUrl;
                strRedirectUrl = Request.QueryString["ReturnUrl"];
                if (strRedirectUrl != null && strRedirectUrl.ToLower() != "/default.aspx")
                {
                    //this.lblErrorMessage.Text =String.Format(ResourceManager.GetString("Message.Permission"), ApplicationSettings.AppName);//c_strPermissionError.Replace("[APPNAME]",ApplicationSettings.AppName);
                    //this.lblErrorMessage.CssClass = "WarningMessageLoginPage";49182643
                }
                string AutoLoginUserID, AutoLoginEncPass;
                AutoLoginUserID  = Request.QueryString["AutoLgnUSID"];
                AutoLoginEncPass = Request.QueryString["AutoLgnPass"];
                if (AutoLoginUserID != null && AutoLoginEncPass != null)
                {
                    User      objUser = new User();
                    DataTable dtbAuthentication1;
                    DataTable dtbAuthentication;
                    int       intUserID = 0;
                    if (Request.QueryString["AutoLgnUSID"] != null)
                    {
                        intUserID = int.Parse(Request.QueryString["AutoLgnUSID"].ToString());
                    }
                    string strPassword = Request.QueryString["AutoLgnPass"];


                    dtbAuthentication  = objUser.GetUser(intUserID);
                    dtbAuthentication1 = objUser.Login(dtbAuthentication.Rows[0]["UserName"].ToString(), Request.Url.Host);
                    if (dtbAuthentication.Rows.Count > 0)
                    {
                        txtUserName.Text     = dtbAuthentication.Rows[0]["UserName"].ToString();
                        txtUserName.ReadOnly = true;

                        if (dtbAuthentication.Rows[0]["EncryptPassword"].ToString() == strPassword && bool.Parse(dtbAuthentication.Rows[0]["AccessStatus"].ToString()) == false)
                        {
                            objUser.UpdatePassword(intUserID, dtbAuthentication.Rows[0]["Password"].ToString(), strPassword);

                            bool   blnAdvancedReporting;
                            string strOrgLog;
                            string strUserName = dtbAuthentication.Rows[0]["UserName"].ToString();
                            int    intUserTypeID, intOrganisationID, intLoginFailCount;
                            intUserID     = (int)dtbAuthentication.Rows[0]["UserID"];
                            intUserTypeID = (int)dtbAuthentication.Rows[0]["UserTypeID"];

                            // Password login successful - reset the login attempts for the
                            // UserID back to 0
                            intLoginFailCount = 0;
                            objUser.UpdateLoginAttempts(intUserID, intLoginFailCount);

                            if (dtbAuthentication.Rows[0]["OrganisationID"] == DBNull.Value)
                            {
                                // The person must be a salt admin so just select the first organisation by default
                                Organisation objOrganisation = new Organisation();
                                // Data table to hold the organisation details.
                                DataTable dtbOrganisationDetails;
                                // Get a list of all organisations
                                dtbOrganisationDetails = objOrganisation.GetOrganisationList();
                                if (dtbOrganisationDetails.Rows.Count > 0)
                                {
                                    intOrganisationID = (int)dtbOrganisationDetails.Rows[0]["OrganisationID"];
                                }
                                else
                                {
                                    intOrganisationID = 0;
                                }
                            }
                            else
                            {
                                intOrganisationID = (int)dtbAuthentication.Rows[0]["OrganisationID"];
                            }

                            objUser.LogLogin(intUserID);
                            strOrgLog = dtbAuthentication1.Rows[0]["Logo"].ToString();

                            if ((UserType)intUserTypeID == UserType.SaltAdmin)
                            {
                                blnAdvancedReporting = true;
                            }
                            else
                            {
                                blnAdvancedReporting = (bool)dtbAuthentication1.Rows[0]["AdvancedReporting"];
                            }

                            UserData objUserData = new UserData((UserType)intUserTypeID, intOrganisationID, strOrgLog, blnAdvancedReporting);

                            WebSecurity.SetAuthData(intUserID.ToString(), objUserData.ToString());
                            if (Request.Url.Host.ToLower().Equals("127.0.0.2"))
                            {
                                Response.Redirect("https://127.0.0.2/Default.aspx");
                            }

                            else
                            {
                                //Response.Redirect("http://"+Request.Url.Host+"/Default.aspx");
                                Response.Redirect("http://" + Request.Url.Authority + "/Default.aspx");//Modified by Joseph for local testing
                                //Response.Redirect("http://localhost:51864/Default.aspx");//Modified by Joseph for local testing
                            }
                        }
                        else
                        {
                            lblErrorMessage.Text      = "Url already used!!";
                            lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                        }
                    }
                }
            }
        }
Ejemplo n.º 15
0
		public static void Focus_Load (Page p)
		{
			TextBox tbx = new TextBox ();
			tbx.ID = "TestBox";
			p.Controls.Add (tbx);
			tbx.Focus ();
		}
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // TextBox txtUserName = (TextBox)Login1.FindControl("UserName");
            // Form.DefaultFocus = txtUserName.UniqueID;

            if (!IsPostBack)
            {
                Session.Abandon();
                Session.RemoveAll();
                FormsAuthentication.SignOut();
                HttpContext.Current.Items["User"] = null;

                if (Request.Cookies["Remember"] != null)
                {
                    txtUserName = (TextBox)Login1.FindControl("UserName");
                    txtUserName.Text = Request.Cookies["Remember"]["UserName"].ToString();
                    CheckBox chkRemember = (CheckBox)Login1.FindControl("RememberMe");
                    Login1.RememberMeSet = Convert.ToBoolean(Request.Cookies["Remember"]["RememberMe"].ToString());
                }
                else
                {
                    txtUserName = (TextBox)Login1.FindControl("UserName");
                    txtUserName.Focus();
                    CheckBox chkRemember = (CheckBox)Login1.FindControl("RememberMe");
                    chkRemember.Checked = false;
                }
            }
        }
Ejemplo n.º 17
0
    protected void QtyChanged(object sender, EventArgs eventArgs)
    {
        decimal     numTotal = 0;
        decimal     unit1 = 0;
        string      fmdate = string.Empty, fmdate1 = string.Empty, fmdate2 = string.Empty;
        GridViewRow row = ((GridViewRow)((System.Web.UI.WebControls.TextBox)sender).NamingContainer);

        DropDownList kod_bor = (DropDownList)row.FindControl("Col1");

        System.Web.UI.WebControls.TextBox per  = (System.Web.UI.WebControls.TextBox)row.FindControl("Col2");
        System.Web.UI.WebControls.TextBox tot1 = (System.Web.UI.WebControls.TextBox)row.FindControl("Col3");
        if (tk_mula.Text != "")
        {
            string   fdate = tk_mula.Text;
            DateTime fd    = DateTime.ParseExact(fdate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            fmdate = fd.ToString("yyyy-MM-dd");

            int       qty1     = Convert.ToInt32(per.Text);
            DataTable sel_gst1 = new DataTable();
            sel_gst1 = DBCon.Ora_Execute_table("select top(1)* From KW_kemasukan_inventori where kod_barang='" + kod_bor.SelectedValue + "' and do_tarikh<='" + fmdate + "' and Status='A' order by do_tarikh desc");
            if (sel_gst1.Rows.Count != 0)
            {
                if (Int32.Parse(sel_gst1.Rows[0]["baki_kuantiti"].ToString()) >= qty1)
                {
                    string    chk_qty  = string.Empty;
                    double    chk_amt  = 0;
                    double    sv2      = 0;
                    double    sv1      = 0;
                    DataTable sel_gst2 = new DataTable();
                    sel_gst2 = DBCon.Ora_Execute_table("select *,FORMAT(do_tarikh,'dd/MM/yyyy', 'en-us') as do_tarikh1 From KW_kemasukan_inventori where kod_barang='" + kod_bor.SelectedValue + "' and do_tarikh<='" + fmdate + "' and Status='A' order by do_tarikh ASC");

                    for (int k = 0; k < sel_gst2.Rows.Count; k++)
                    {
                        string   fdate1 = sel_gst2.Rows[k]["do_tarikh1"].ToString();
                        DateTime fd1    = DateTime.ParseExact(fdate1, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        fmdate1 = fd1.ToString("yyyy-MM-dd");



                        DataTable sel_gst3 = new DataTable();
                        sel_gst3 = DBCon.Ora_Execute_table("select * From KW_kemasukan_inventori where kod_barang='" + kod_bor.SelectedValue + "' and do_tarikh ='" + fmdate1 + "' and Status='A' order by do_tarikh desc");
                        DataTable sel_gst_pre = new DataTable();
                        int       pre_qty     = 0;
                        if (k > 0)
                        {
                            string   fdate2 = sel_gst2.Rows[k - 1]["do_tarikh1"].ToString();
                            DateTime fd2    = DateTime.ParseExact(fdate2, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            fmdate2     = fd2.ToString("yyyy-MM-dd");
                            sel_gst_pre = DBCon.Ora_Execute_table("select * From KW_kemasukan_inventori where kod_barang='" + kod_bor.SelectedValue + "' and do_tarikh ='" + fmdate2 + "' and Status='A' order by do_tarikh ASC");
                            pre_qty     = Int32.Parse(sel_gst_pre.Rows[0]["baki_kuantiti"].ToString());
                            if (sel_gst3.Rows[0]["baki_kuantiti"].ToString() != "0")
                            {
                                if (Int32.Parse(sel_gst3.Rows[0]["baki_kuantiti"].ToString()) <= qty1)
                                {
                                    sv1 = ((double.Parse(sel_gst3.Rows[0]["baki_kuantiti"].ToString())) * double.Parse(sel_gst3.Rows[0]["unit"].ToString()));
                                    sv2 = qty1 - double.Parse(sel_gst3.Rows[0]["baki_kuantiti"].ToString());
                                }
                                else
                                {
                                    sv1 = (sv2 * double.Parse(sel_gst3.Rows[0]["unit"].ToString()));
                                    sv2 = 0;
                                }
                            }
                            else
                            {
                                if (Int32.Parse(sel_gst3.Rows[0]["baki_kuantiti"].ToString()) <= qty1)
                                {
                                    sv1 = 0;
                                    sv2 = 0;
                                }
                                else
                                {
                                    sv1 = 0;
                                    sv2 = 0;
                                }
                            }
                        }
                        else
                        {
                            if (sel_gst3.Rows.Count != 0)
                            {
                                if (Int32.Parse(sel_gst3.Rows[0]["baki_kuantiti"].ToString()) >= qty1)
                                {
                                    sv1 = ((qty1 - sv2) * double.Parse(sel_gst3.Rows[0]["unit"].ToString()));
                                    sv2 = 0;
                                }
                                else
                                {
                                    sv1 = ((double.Parse(sel_gst3.Rows[0]["baki_kuantiti"].ToString()) - sv2) * double.Parse(sel_gst3.Rows[0]["unit"].ToString()));
                                    sv2 = (qty1 - double.Parse(sel_gst3.Rows[0]["baki_kuantiti"].ToString()));
                                }
                            }
                        }
                        chk_amt += sv1;
                    }


                    if (qty1.ToString() != "")
                    {
                        if (chk_amt != 0)
                        {
                            tot1.Text = double.Parse(chk_amt.ToString()).ToString("C").Replace("RM", "").Replace("RM", "").Replace("$", "");
                        }
                        else
                        {
                            tot1.Text = "0.00";
                        }
                    }
                    //amt1.Focus();
                }
                else
                {
                    per.Focus();
                    per.Text  = "";
                    tot1.Text = "0.00";
                    ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Quantity Must be allowed in " + sel_gst1.Rows[0]["baki_kuantiti"].ToString() + ".',{'type': 'warning','title': 'warning','auto_close': 2000});", true);
                }
            }
        }
        else
        {
            //per.Text = "";
            ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Sila Masukan Tarikh DO.',{'type': 'warning','title': 'warning','auto_close': 2000});", true);
        }
    }
        private void DisplayNeueZutatenListeEingaben(Panel rezeptAbteilungPanel, int zutatenAnzahl)
        {
            using (var db = new rherzog_70515_rzvwContext())
            {
                //Name
                var textbox = new TextBox { ID = Helper.REZEPBEARBEITEN_IDENT_ZUTAT + Helper.REZEPBEARBEITEN_IDENT_NEU + rezeptAbteilungPanel.ID + zutatenAnzahl, Text = string.Empty, Width = RezeptNameFeldBreite };
                rezeptAbteilungPanel.Controls.Add(textbox);
                textbox.Focus();

                //Menge
                textbox = new TextBox { ID = Helper.REZEPBEARBEITEN_IDENT_MENGE + Helper.REZEPBEARBEITEN_IDENT_NEU + rezeptAbteilungPanel.ID + zutatenAnzahl, Text = string.Empty, Width = RezeptMengeFeldBreite };
                rezeptAbteilungPanel.Controls.Add(textbox);

                //Einheit
                var dropdownlist = new DropDownList { ID = Helper.REZEPBEARBEITEN_IDENT_EINHEIT + Helper.REZEPBEARBEITEN_IDENT_NEU + rezeptAbteilungPanel.ID + zutatenAnzahl, Width = RezeptEinheitFeldBreite };
                //leerer Eintrag
                var listItem = new ListItem(string.Empty, string.Empty);
                dropdownlist.Items.Add(listItem);
                foreach (var item in db.Einheits)
                {
                    listItem = new ListItem(item.Bezeichnung, item.ID.ToString(CultureInfo.InvariantCulture));
                    dropdownlist.Items.Add(listItem);
                }
                rezeptAbteilungPanel.Controls.Add(dropdownlist);

                //Zeilenumbruch
                var literalPageBreak = new Literal {Text = "<br/>"};
                rezeptAbteilungPanel.Controls.Add(literalPageBreak);
            }
        }
        public void SetEndTime(TextBox txtst_time, TextBox txtend_time)
        {
            bool b = CheckDate(txtst_time.Text);
            if (b == false)
            {
                return;
            }
            DateTime stime = Convert.ToDateTime(txtst_time.Text);
            TimeSpan t = new TimeSpan(3, 0, 0);
            DateTime etime = stime + t;

            txtend_time.Text = etime.ToString("t");
            txtend_time.Focus();
        }
Ejemplo n.º 20
0
        private void PopulateControls()
        {
            if (siteSettings == null) { return; }
            if (siteSettings.DisableDbAuth) { this.Visible = false; return; }

            LoginCtrl.SetRedirectUrl = setRedirectUrl;

            lblUserID = (SiteLabel)this.LoginCtrl.FindControl("lblUserID");
            lblEmail = (SiteLabel)this.LoginCtrl.FindControl("lblEmail");
            txtUserName = (TextBox)this.LoginCtrl.FindControl("UserName");
            txtPassword = (TextBox)this.LoginCtrl.FindControl("Password");
            chkRememberMe = (CheckBox)this.LoginCtrl.FindControl("RememberMe");
            btnLogin = (mojoButton)this.LoginCtrl.FindControl("Login");
            lnkRecovery = (HyperLink)this.LoginCtrl.FindControl("lnkPasswordRecovery");
            lnkExtraLink = (HyperLink)this.LoginCtrl.FindControl("lnkRegisterExtraLink");

            if (WebConfigSettings.DisableAutoCompleteOnLogin)
            {
                txtUserName.AutoCompleteType = AutoCompleteType.Disabled;
                txtPassword.AutoCompleteType = AutoCompleteType.Disabled;
            }

            divCaptcha = (Panel)LoginCtrl.FindControl("divCaptcha");
            captcha = (CaptchaControl)LoginCtrl.FindControl("captcha");
            if (!siteSettings.RequireCaptchaOnLogin)
            {
                if (divCaptcha != null) { divCaptcha.Visible = false; }
                if (captcha != null) { captcha.Captcha.Enabled = false; }
            }
            else
            {
                captcha.ProviderName = siteSettings.CaptchaProvider;
                captcha.RecaptchaPrivateKey = siteSettings.RecaptchaPrivateKey;
                captcha.RecaptchaPublicKey = siteSettings.RecaptchaPublicKey;

            }

            if ((siteSettings.UseEmailForLogin) && (!siteSettings.UseLdapAuth))
            {
                if (!WebConfigSettings.AllowLoginWithUsernameWhenSiteSettingIsUseEmailForLogin)
                {
                    EmailValidator regexEmail = new EmailValidator();
                    regexEmail.ControlToValidate = txtUserName.ID;
                    regexEmail.ErrorMessage = Resource.LoginFailedInvalidEmailFormatMessage;
                    this.LoginCtrl.Controls.Add(regexEmail);
                }

            }

            if (siteSettings.UseEmailForLogin && !siteSettings.UseLdapAuth)
            {
                this.lblUserID.Visible = false;
            }
            else
            {
                this.lblEmail.Visible = false;
            }

            if (setFocus) { txtUserName.Focus(); }

            lnkRecovery.Visible = ((siteSettings.AllowPasswordRetrieval ||siteSettings.AllowPasswordReset) && (!siteSettings.UseLdapAuth ||
                                                                           (siteSettings.UseLdapAuth && siteSettings.AllowDbFallbackWithLdap)));

            lnkRecovery.NavigateUrl = this.LoginCtrl.PasswordRecoveryUrl;
            lnkRecovery.Text = this.LoginCtrl.PasswordRecoveryText;

            lnkExtraLink.NavigateUrl = siteRoot + "/Secure/Register.aspx";
            lnkExtraLink.Text = Resource.RegisterLink;
            lnkExtraLink.Visible = siteSettings.AllowNewRegistration;

            string returnUrlParam = Page.Request.Params.Get("returnurl");
            if (!String.IsNullOrEmpty(returnUrlParam))
            {
                //string redirectUrl = returnUrlParam;
                lnkExtraLink.NavigateUrl += "?returnurl=" + SecurityHelper.RemoveMarkup(returnUrlParam);
            }

            chkRememberMe.Visible = siteSettings.AllowPersistentLogin;
            chkRememberMe.Text = this.LoginCtrl.RememberMeText;

            if (WebConfigSettings.ForcePersistentAuthCheckboxChecked)
            {
                chkRememberMe.Checked = true;
                chkRememberMe.Visible = false;
            }

            btnLogin.Text = this.LoginCtrl.LoginButtonText;
            //SiteUtils.SetButtonAccessKey(btnLogin, AccessKeys.LoginAccessKey);
        }
Ejemplo n.º 21
0
        private void PopulateControls()
        {
            LoginCtrl.SetRedirectUrl = setRedirectUrl;

            lblUserID = (Label)this.LoginCtrl.FindControl("lblUserID");
            //lblEmail = (SiteLabel)this.LoginCtrl.FindControl("lblEmail");
            txtUserName = (TextBox)this.LoginCtrl.FindControl("UserName");
            txtPassword = (TextBox)this.LoginCtrl.FindControl("Password");
            chkRememberMe = (CheckBox)this.LoginCtrl.FindControl("RememberMe");
            btnLogin = (LinkButton)this.LoginCtrl.FindControl("Login");
            lnkRecovery = (HyperLink)this.LoginCtrl.FindControl("lnkPasswordRecovery");
            lnkExtraLink = (HyperLink)this.LoginCtrl.FindControl("lnkRegisterExtraLink");

            divCaptcha = (Panel)LoginCtrl.FindControl("divCaptcha");
            //captcha = (CaptchaControl)LoginCtrl.FindControl("captcha");
            //if (!siteSettings.RequireCaptchaOnLogin)
            //{
            //    if (divCaptcha != null) { divCaptcha.Visible = false; }
            //    if (captcha != null) { captcha.Captcha.Enabled = false; }
            //}
            //else
            //{
            //    captcha.ProviderName = siteSettings.CaptchaProvider;
            //    captcha.RecaptchaPrivateKey = siteSettings.RecaptchaPrivateKey;
            //    captcha.RecaptchaPublicKey = siteSettings.RecaptchaPublicKey;

            //}

            //if ((siteSettings.UseEmailForLogin) && (!siteSettings.UseLdapAuth))
            //{
            //    if (!WebConfigSettings.AllowLoginWithUsernameWhenSiteSettingIsUseEmailForLogin)
            //    {
            //        RegularExpressionValidator regexEmail = new RegularExpressionValidator();
            //        regexEmail.ControlToValidate = txtUserName.ID;
            //        //regexEmail.ValidationExpression = @"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$";
            //        regexEmail.ValidationExpression = SecurityHelper.RegexEmailValidationPattern;
            //        regexEmail.ErrorMessage = Resource.LoginFailedInvalidEmailFormatMessage;
            //        this.LoginCtrl.Controls.Add(regexEmail);
            //    }

            //}

            //if (siteSettings.UseEmailForLogin && !siteSettings.UseLdapAuth)
            //{
            //    this.lblUserID.Visible = false;
            //}
            //else
            //{
            //    this.lblEmail.Visible = false;
            //}

            if (setFocus)
            {
                txtUserName.Focus();
            }

            lnkRecovery.Visible = false;// ((siteSettings.AllowPasswordRetrieval || siteSettings.AllowPasswordReset) && (!siteSettings.UseLdapAuth ||
            //                                   (siteSettings.UseLdapAuth && WebConfigSettings.UseLDAPFallbackAuthentication)));

            lnkRecovery.NavigateUrl = this.LoginCtrl.PasswordRecoveryUrl;
            lnkRecovery.Text = this.LoginCtrl.PasswordRecoveryText;

            lnkExtraLink.NavigateUrl = siteRoot + "/Secure/Register.aspx";
            lnkExtraLink.Text = "Đăng ký";//Resource.RegisterLink;
            lnkExtraLink.Visible = false;// siteSettings.AllowNewRegistration;

            string returnUrlParam = Page.Request.Params.Get("returnurl");
            if (!String.IsNullOrEmpty(returnUrlParam))
            {
                //string redirectUrl = returnUrlParam;
                lnkExtraLink.NavigateUrl += "?returnurl=" + returnUrlParam;
            }

            chkRememberMe.Visible = true;// WebConfigSettings.AllowPersistentLoginCookie;
            chkRememberMe.Text = this.LoginCtrl.RememberMeText;

            btnLogin.Text = this.LoginCtrl.LoginButtonText;
            //SiteUtils.SetButtonAccessKey(btnLogin, AccessKeys.LoginAccessKey);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Event handler for the page load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            litLogin.Text = ResourceManager.GetString("pagTitle");
            txtUserName.Focus();
            try
            {
                if (!Page.IsPostBack)
                {
                    User      objUser = new User();
                    DataTable dtbAuthentication;
                    // DataTable dtbUserOrgPassLock;
                    int    intUserID   = int.Parse(Request.QueryString["UID"].ToString());
                    string strPassword = Request.QueryString["P"].ToString();
                    //dtbUserOrgPassLock = objUser.GetUserOrganisation(intUserID);
                    //if (dtbUserOrgPassLock.Rows.Count > 0)
                    //{
                    //    if (dtbUserOrgPassLock.Rows[0]["PasswordLockout"].ToString().Trim().ToLower() == "true")
                    //    {
                    dtbAuthentication = objUser.GetUser(intUserID);
                    if (dtbAuthentication.Rows.Count > 0)
                    {
                        txtUserName.Text     = dtbAuthentication.Rows[0]["UserName"].ToString();
                        txtUserName.ReadOnly = true;

                        if (dtbAuthentication.Rows[0]["EncryptPassword"].ToString() == strPassword && bool.Parse(dtbAuthentication.Rows[0]["AccessStatus"].ToString()) == false)
                        {
                            btnChangePassword.Visible = true;
                            divchangepassword.Visible = true;
                        }
                        else
                        {
                            btnChangePassword.Visible = false;
                            divchangepassword.Visible = false;
                            lblErrorMessage.Text      = "Url already used!!";
                            lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                        }
                    }
                    //    }
                    //    else
                    //    {
                    //        lblErrorMessage.Text = "You dont have permission to change the password. Please contact your administrator.";
                    //        lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                    //    }
                    //}
                }

                pagTitle.InnerText = ResourceManager.GetString("pagTitle");
                if (VerifyDatabaseConnection())
                {
                    // Put user code to initialize the page here
                    string strApplicationName = Utilities.ApplicationSettings.AppName;   // the name of the application
                    string strTradeMarkSymbol = Utilities.ApplicationSettings.TradeMark; // The trade mark symbol if there is one or an empty string
                    this.lblApplicationNameSmall.Text = strApplicationName;
                    this.lblApplicationName.Text      = strApplicationName;
                    this.lblTradeMark1.Text           = strTradeMarkSymbol;
                    this.lblTradeMark2.Text           = strTradeMarkSymbol;
                    this.lblCopyrightYear.Text        = Utilities.ApplicationSettings.CopyrightYear;
                    this.lnkCompany.Text              = Utilities.ApplicationSettings.BrandingCompanyName;
                    this.lnkCompany.NavigateUrl       = Utilities.ApplicationSettings.BrandingCompanyURL;
                    this.lnkTermsOfUse.NavigateUrl    = Utilities.ApplicationSettings.TermsOfUseURL;
                    this.lnkPrivacyPolicy.NavigateUrl = Utilities.ApplicationSettings.PrivacyPolicyURL;
                }
                else
                {
                    //Response.Write("Application Unavailable");

                    Response.Write(ResourceManager.GetString("lblSaltUnavailable"));
                    Response.End();
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 23
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _ctrlWrappers = new Panel {ID = "wrp", CssClass = "controlWrappers"};
            _ctrlWrappers.Style[Styles.opacity] = "0.3";
            Controls.Add(_ctrlWrappers);

            BehaviorUnveiler unveiler = new BehaviorUnveiler {ID = "unveiler"};
            _ctrlWrappers.Controls.Add(unveiler);

            _filterWrapper = new Panel {ID = "fltW", DefaultWidget = "fltB"};

            _filter = new TextBox {ID = "flt", CssClass = "filter"};

            _fltBtn = new Button {ID = "fltB"};
            _fltBtn.Style[Styles.marginLeft] = "-1000px";
            _fltBtn.Click += 
                delegate
                {
                    // Making sure we select all "filter text" to mak it easy to "re-filter"...
                    _filter.Focus();
                    _filter.Select();

                    // Checking for dead keys...
                    if (OldFilter != _filter.Text)
                    {
                        CurrentPage = 0;
                        DataBindGrid();
                        _lstWrappers.ReRender();
                        _lstWrappers.Style[Styles.display] = "none";
                        new EffectFadeIn(_lstWrappers, 200)
                            .Render();
                        OldFilter = _filter.Text;
                    }
                };
            _filterWrapper.Controls.Add(_filter);
            _filterWrapper.Controls.Add(_fltBtn);
            _ctrlWrappers.Controls.Add(_filterWrapper);

            _previous = new LinkButton {ID = "prev", Text = "&nbsp;", CssClass = "previous"};
            _previous.Text = "&lt;&lt;";
            _previous.Click +=
                delegate
                {
                    if (CurrentPage != 0)
                    {
                        CurrentPage -= 1;
                        DataBindGrid();
                        _lstWrappers.ReRender();
                        new EffectRollUp(_lstWrappers, 200)
                            .ChainThese(
                                new EffectFadeIn(_lstWrappers, 200))
                            .Render();
                    }
                };
            _ctrlWrappers.Controls.Add(_previous);

            _count = new Label {ID = "cnt", CssClass = "count"};
            _ctrlWrappers.Controls.Add(_count);

            _next = new LinkButton {ID = "next", Text = "&nbsp;", CssClass = "next"};
            _next.Text = "&gt;&gt;";
            _next.Click +=
                delegate
                {
                    if ((CurrentPage + 1) * PageSize < DataSource["Rows"].Count)
                    {
                        CurrentPage += 1;
                        DataBindGrid();
                        _lstWrappers.ReRender();
                        new EffectRollUp(_lstWrappers, 200)
                            .ChainThese(
                                new EffectFadeIn(_lstWrappers, 200))
                            .Render();
                    }
                };
            _ctrlWrappers.Controls.Add(_next);

            _lstWrappers = new Panel {ID = "lstWrp", CssClass = "gridWrapper"};
            Controls.Add(_lstWrappers);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// 正则验证(注意:第一句验证,isContinue需设置为true)
 /// </summary>
 /// <param name="value">要验证的值</param>
 /// <param name="title">错误消息标题</param>
 /// <param name="validateEmpty">数据为空字符时是否验证</param>
 /// <param name="regexMode">验证模式</param>
 /// <param name="isContinue">是否继续验证</param>
 /// <param name="errorMsg">验证失败显示的消息</param>
 /// <returns></returns>
 public static void RegexValidate(TextBox textBox, string title, bool validateEmpty, RegexMode regexMode, ref bool isContinue, ref string errorMsg)
 {
     if (isContinue && validateEmpty)
     {
         isContinue = Regex.IsMatch(textBox.Text.Trim(), RegexPrecept(regexMode, title, ref errorMsg));
         if (!isContinue) { textBox.Focus(); }
     }
     errorMsg = isContinue ? string.Empty : errorMsg;
 }
Ejemplo n.º 25
0
 protected void judge(TextBox tb)
 {
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('不能为空!')</script>");
     tb.Focus(); 
 }
Ejemplo n.º 26
0
 private void ShowMessage(String Message, Label Label, TextBox TextBox)
 {
     Label.Text = Message;
     TextBox.Focus();
 }
Ejemplo n.º 27
0
        protected bool CheckInputEmptyAndLength(TextBox txtName, string EmptyErrorCode, string ExceedErrorCode, bool DoubleChar)
        {
            if (String.IsNullOrEmpty(txtName.Text))
            {
                SetMessage(GetMessage(EmptyErrorCode, txtName.MaxLength.ToString()));
                txtName.Focus();
                return false;
            }

            //VarChar
            if (DoubleChar == true && StringHelper.GetLengthByByte(txtName.Text) > txtName.MaxLength)
            {
                SetMessage(GetMessage(ExceedErrorCode, txtName.MaxLength.ToString()));
                txtName.Focus();
                return false;
            }

            //NVarChar
            if (DoubleChar == false && StringHelper.GetLength(txtName.Text) > txtName.MaxLength)
            {
                SetMessage(GetMessage(ExceedErrorCode, txtName.MaxLength.ToString()));
                txtName.Focus();
                return false;
            }

            return true;
        }