Example #1
0
        public void BindReTemplete()
        {
            this.Pub1.AddTable("class='Table' cellpadding='0' cellspacing='0' border='0' style='width:100%'");
            this.Pub1.AddCaptionLeft("使用事件模版,能够帮助您快速的定义表单字段事件" + BP.WF.Glo.GenerHelpCCForm("选择模版", "http://ccform.mydoc.io/?v=5769&t=36729", ""));

            //this.Pub1.AddTR();
            //this.Pub1.AddTDGroupTitle("colspan=2", "事件模版-点击名称选用它");
            //this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            ListBox lb = new ListBox();

            lb.Style["width"] = "100%";
            lb.AutoPostBack   = false;
            lb.ID             = "LBReTemplete";
            lb.Height         = 250;

            RegularExpressions res = new RegularExpressions();

            res.RetrieveAll();
            foreach (RegularExpression item in res)
            {
                ListItem li = new ListItem(item.Name + "->" + item.Note, item.No);
                lb.Items.Add(li);
            }
            this.Pub1.AddTD("colspan=2", lb);
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");

            btn.Click += new EventHandler(btn_SaveReTemplete_Click);


            this.Pub1.AddTDBegin("colspan=2");
            //this.Pub1.AddTD("colspan=1 width='80'", btn);
            this.Pub1.Add(btn);
            this.Pub1.AddSpace(2);

            if (this.RefNo != null && this.RefNo.Contains(","))
            {
            }
            else
            {
                this.Pub1.Add("<a class='easyui-linkbutton' data-options=\"iconCls:'icon-back'\" href='RegularExpression.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&OperAttrKey=" + this.OperAttrKey + "&DoType=New'>返回</a>");
            }

            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
Example #2
0
        public static string uNumPwdPost(string uNum, string uNumPwd)
        {
            string UNum    = RegularExpressions.MyEncodeInputString(uNum.Trim());
            string UNumPwd = RegularExpressions.MyEncodeInputString(uNumPwd.Trim());

            if (CheckNum.CheckUserNum(UNum, uNumPwd))
            {
                return("2");
            }
            else
            {
                return("3");//学号验证失败
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Request.QueryString["REID"] != null)
            {
                RegularExpressionDtls reDtls = new RegularExpressionDtls();
                reDtls.RetrieveAll();

                //删除现有的逻辑.
                BP.Sys.MapExts exts = new BP.Sys.MapExts();
                exts.Delete(MapExtAttr.AttrOfOper, this.KeyOfEn,
                            MapExtAttr.ExtType, BP.Sys.MapExtXmlList.RegularExpression);

                // 开始装载.
                foreach (RegularExpressionDtl dtl in reDtls)
                {
                    if (dtl.ItemNo != this.Request.QueryString["REID"])
                    {
                        continue;
                    }

                    BP.Sys.MapExt ext = new BP.Sys.MapExt();
                    ext.MyPK       = this.FK_MapData + "_" + this.KeyOfEn + "_" + MapExtXmlList.RegularExpression + "_" + dtl.ForEvent;
                    ext.FK_MapData = this.FK_MapData;
                    ext.AttrOfOper = this.KeyOfEn;
                    ext.Doc        = dtl.Exp;                         //表达公式.
                    ext.Tag        = dtl.ForEvent;                    //时间.
                    ext.Tag1       = dtl.Msg;                         //消息
                    ext.ExtType    = MapExtXmlList.RegularExpression; // 表达公式 .
                    ext.Insert();
                }
                //this.WinClose("1"); //关闭并返回一个值。
                return;
            }

            RegularExpressions res = new RegularExpressions();

            res.RetrieveAll();

            this.Pub1.AddH3("事件模版-点击名称选用它.");
            this.Pub1.AddHR();

            this.Pub1.AddUL();
            foreach (RegularExpression item in res)
            {
                this.Pub1.AddLi("<a href=\"javascript:DoIt('" + this.FK_MapData + "','" + this.KeyOfEn
                                + "','" + this.ForCtrl + "','" + item.No + "','" + item.Name
                                + "');\" >" + item.Name + "</a> - " + item.Note);
            }
            this.Pub1.AddULEnd();
        }
Example #4
0
        public List <DateTime> Dates()
        {
            var          regex   = RegularExpressions.ClinicLetterDate();
            List <Match> matches = new List <Match>();
            var          result  = regex.Match(_inputText);

            while (result.Success)
            {
                matches.Add(result);
                result = result.NextMatch();
            }
            var stringDates = matches.Select(m => m.ToString()
                                             .Trim()
                                             .Split(":")
                                             .Last()
                                             .TrimStart()
                                             .ToString()
                                             .Replace("Clinic date", "")
                                             .Replace("clinic date", "")
                                             .Replace("Date of Clinic", "")
                                             .Replace("Date of clinic", "")
                                             .Replace("---", "")
                                             .Replace("tth", "")
                                             .Replace("nd", "")
                                             .Replace("st", "")
                                             .Replace("rd", "")
                                             .Replace("Augu", "Aug")
                                             .Replace("th", "")
                                             .Trim())
                              .Where(e => !string.IsNullOrEmpty(e));
            var dates = stringDates.Where(date =>
            {
                try
                {
                    DateTime dt;
                    DateTime.TryParse(date, out dt);
                    return(dt.Year != 1);
                }
                catch (Exception e)
                {
                    return(false);
                }
            })
                        .ToList();

            return(dates.Select(m => DateTime.Parse(m)).ToList());
        }
Example #5
0
 private void FindAndSetYearInSurgeryColumns(PatientSurgery patientSurgery, MatchCollection surgeryFieldYearMatches)
 {
     if (FoundMatchInSurgeryColumn(surgeryFieldYearMatches))
     {
         int intYear = Int32.Parse(surgeryFieldYearMatches[0].ToString());
         patientSurgery.SurgeryDate = intYear;
     }
     else if (YearCellValueIsNotBlank())
     {
         var yearFieldYearMatches = RegularExpressions.ValidYear().Matches(yearCellValue());
         if (yearFieldYearMatches.Count > 0)
         {
             int intYear = Int32.Parse(yearFieldYearMatches[0].ToString());
             patientSurgery.SurgeryDate = intYear;
         }
     }
 }
        private ScoreMsg GetScore()
        {
            ScoreMsg score = new ScoreMsg();

            Debug.WriteLine(RegularExpressions.IsNumeric(tbScore.Text));
            if (tbStuName.Text.Equals("") || tbCourseName.Text.Equals("") || tbScore.Text.Equals(""))
            {
                MessageBox.Show("请确保输入数据正确", "错误", MessageBoxButtons.OK);
                return(null);
            }
            else
            {
                score.CourseId  = Convert.ToInt32(tbCourseNo.Text);
                score.StudentNo = Convert.ToInt32(tbStuNo.Text);
                score.Score     = Convert.ToInt32(tbScore.Text);
            }
            return(score);
        }
Example #7
0
        private void RegExDropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (RegExDropDownList.SelectedValue == "0")
            {
                ResetUIState();
            }
            else
            {
                RegExOptionTitleLabel.Text = GetPageResource("EditRegExOptionTitleLabel");
                DeleteRegExButton.Attributes.Add("onClick",
                                                 "javascript:if(confirm('" + ((PageBase)Page).GetPageResource("DeleteRegExConfirmationMessage") + "')== false) return false;");

                RegularExpressionData regularExpressionData =
                    new RegularExpressions().GetRegularExpressionById(int.Parse(RegExDropDownList.SelectedValue));

                ErrorMessageTextbox.Text      = regularExpressionData.RegularExpressions[0].RegExMessage;
                RegularExpressionTextbox.Text = regularExpressionData.RegularExpressions[0].RegExpression;
                RegExDescriptionTextbox.Text  = regularExpressionData.RegularExpressions[0].Description;

                ApplyChangesButton.Visible     = true;
                DeleteRegExButton.Visible      = true;
                MakeBuiltInRegExButton.Visible =
                    NSurveyUser.Identity.IsAdmin && !regularExpressionData.RegularExpressions[0].BuiltIn;
                CreateNewRegExButton.Visible    = false;
                RegExOptionsPlaceHolder.Visible = true;


                if (regularExpressionData.RegularExpressions[0].BuiltIn)
                {
                    DeleteRegExButton.Attributes.Add("onClick",
                                                     "javascript:if(confirm('" + ((PageBase)Page).GetPageResource("DeleteBuiltInRegExConfirmationMessage") + "')== false) return false;");
                    ApplyChangesButton.Attributes.Add("onClick",
                                                      "javascript:if(confirm('" + ((PageBase)Page).GetPageResource("ApplyBuiltInRegExChangesConfirmationMessage") + "')== false) return false;");
                }
                else
                {
                    DeleteRegExButton.Attributes.Remove("onClick");
                    ApplyChangesButton.Attributes.Remove("onClick");
                    MakeBuiltInRegExButton.Attributes.Add("onClick",
                                                          "javascript:if(confirm('" + ((PageBase)Page).GetPageResource("MakeBuiltInRegExConfirmationMessage") + "')== false) return false;");
                }
            }
        }
Example #8
0
        protected void Log(object sender, EventArgs e)
        {
            En_User user = BADL_User.Login(RegularExpressions.MyEncodeInputString(uInfo.Value.Trim()), Md5.MD5_encrypt(RegularExpressions.MyEncodeInputString(uPwd.Value.Trim())));

            if (user != null)
            {
                Session["User"] = user;                                 //将user写入session

                if (!BADL_User.ChangeLogInfor(user.UNum, DateTime.Now)) //更新登录时间异常
                {
                    Response.Write("<script>alert('更新登录时间异常,登录失败')</script>");
                }
                else
                {
                    HttpCookie cookieUserName = new HttpCookie("UserName");//将用户名写入cookie
                    cookieUserName.Value   = user.UName;
                    cookieUserName.Expires = System.DateTime.Now.AddDays(1);
                    Response.Cookies.Add(cookieUserName);

                    string userRole = BADL_User.GetUserRole(user.UNum);     //得到用户的角色
                    Session["UserRole"] = userRole;                         //将userRole写入session,一般用户的role为"0"
                    HttpCookie cookieUserRole = new HttpCookie("UserRole"); //将userRole写入cookie
                    cookieUserRole.Value   = userRole;
                    cookieUserRole.Expires = System.DateTime.Now.AddDays(1);
                    Response.Cookies.Add(cookieUserRole);


                    if (savePwd.Checked)//如果用户记住密码,将学号和登录密码写入cookie
                    {
                        HttpCookie cookieUser = new HttpCookie("UserLog");
                        cookieUser.Value   = user.UNum + "+" + Md5.MD5_encrypt(uPwd.Value);
                        cookieUser.Expires = System.DateTime.Now.AddDays(1);
                        Response.Cookies.Add(cookieUser);
                    }
                    Response.Redirect("index.aspx");
                }
            }
            else
            {
                Response.Write("<script>alert('登录失败,用户名或密码不正确')</script>");
            }
        }
Example #9
0
        private string FindMatchingDiagnosisInDatabase()
        {
            var matched = new List <string>();

            foreach (var dbDiagnosis in AlphabeticalDiagnosisList())
            {
                Regex regExpression = RegularExpressions.FindWordInList(dbDiagnosis.Split(" ").ToList());
                try
                {
                    if (regExpression.IsMatch(_potentialDiagnosis))
                    {
                        matched.Add(dbDiagnosis);
                    }
                } catch (InvalidOperationException ex)
                {
                    continue;
                }
            }
            return(matched.FirstOrDefault(el => _potentialDiagnosis.ToLower().Contains(el.ToLower())));
        }
        protected void rePwd(object sender, EventArgs e)
        {
            string rePwd  = RegularExpressions.MyEncodeInputString(pwd.Value.Trim());
            string rePwd1 = RegularExpressions.MyEncodeInputString(pwd1.Value.Trim());

            if (rePwd.Equals(rePwd1))
            {
                if (BADL_User.ChangePwd(Md5.MD5_encrypt(rePwd), Session["stuNum"].ToString()))
                {
                    Response.Redirect("login.aspx");
                }
                else
                {
                    Response.Write("<script>alert('更新密码异常');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('密码不一致');</script>");
            }
        }
Example #11
0
        private string FindMatchingSurgeriesInDatabase()
        {
            var matched = new List <string>();

            foreach (var dbSurgery in GetListOfSurgeriesFromDatabase())
            {
                Regex regExpression = RegularExpressions.FindWordInList(dbSurgery.Split(" ").ToList());
                try
                {
                    if (regExpression.IsMatch(_potentialSurgery))
                    {
                        matched.Add(dbSurgery);
                    }
                }
                catch (InvalidOperationException ex)
                {
                    continue;
                }
            }
            return(matched.FirstOrDefault(el => _potentialSurgery.ToLower().Contains(el.ToLower())));
        }
Example #12
0
        public static string uCheckPost(string uCheck)
        {
            string ucheck = RegularExpressions.MyEncodeInputString(uCheck.Trim());

            if (HttpContext.Current.Session["check"] != null)
            {
                string check = HttpContext.Current.Session["check"].ToString();
                if (check.ToUpper().Equals(ucheck.ToUpper()))
                {
                    return("8");
                }
                else
                {
                    return("9");//验证码输入错误
                }
            }
            else
            {
                return("10");//验证码生成错误
            }
        }
    private string CheckNeeded()
    {
        string rtn         = "";
        string dealDate    = DealDate.Text.Trim();
        string num         = Num.Text.Trim();
        string storge      = Storage.Text.Trim();
        string useType     = UseType.SelectedValue.ToString();
        string updateReson = UpdateReson.SelectedValue.ToString();

        if (dealDate.Length == 0)
        {
            rtn += "領用日期:必填!\\n";
        }
        else if (RegularExpressions.IsDate((Convert.ToInt32(DealDate.Text.Substring(0, 3)) + 1911).ToString() + "-" + DealDate.Text.Substring(3, 2) + "-" + DealDate.Text.Substring(5, 2)) == false)
        {
            rtn += "領用日期:日期有誤!\\n";
        }

        if (num.Length == 0)
        {
            rtn += "領用數量:必填!\\n";
        }
        else if (RegularExpressions.IsPlusInt(num) == false)
        {
            rtn += "領用數量:請輸入正整數!\\n";
        }

        if (useType == "0")
        {
            rtn += "領用用途:必填!\\n";
        }

        if (updateReson == "0")
        {
            rtn += "修改原因:必填!\\n";
        }

        return(rtn);
    }
Example #14
0
        private DiagnosisCategory ResolveDiagnosisCategory()
        {
            var primaryDiagnosisRegex    = RegularExpressions.FindWordInList(PrimaryDiagnosisClassifyingWords());
            var pastDiagnosisRegex       = RegularExpressions.FindWordInList(PastDiagnosisClassifyingWords());
            var underlyingDiagnosisRegex = RegularExpressions.FindWordInList(UnderlyingDiagnosisClassifyingWords());

            if (primaryDiagnosisRegex.IsMatch(_potentialDiagnosis))
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Primary"));
            }
            else if (pastDiagnosisRegex.IsMatch(_potentialDiagnosis))
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Past Diagnosis"));
            }
            else if (underlyingDiagnosisRegex.IsMatch(_potentialDiagnosis))
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Underlying Diagnosis"));
            }
            else
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Other"));
            }
        }
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtRFC.Text) || RegularExpressions.CheckIsRFC(txtRFC.Text))
            {
                if (RegularExpressions.CheckIsNormalText(txtCompany.Text, 1, 100))
                {
                    if (RegularExpressions.CheckIsNormalText(txtAddress.Text, 0, 255))
                    {
                        if (RegularExpressions.CheckIsNumber(txtPhone.Text, 10, 10))
                        {
                            if (string.IsNullOrEmpty(txtEmail.Text) || RegularExpressions.CheckIskEmail(txtEmail.Text))
                            {
                                if (RegularExpressions.CheckIsUrl(txtFacebook.Text))
                                {
                                    if (cboState.SelectedIndex < 1 || cboCity.SelectedIndex > -1)
                                    {
                                        byte[] logo = null;
                                        if (pcbLogo.Image != null)
                                        {
                                            logo = Tools.ConvertirImagenAByte(pcbLogo.Image);
                                        }

                                        if (BPrincipalCompany.Edit(
                                                objPrincipalCompany,
                                                !string.IsNullOrEmpty(txtRFC.Text) ? txtRFC.Text : null,
                                                txtCompany.Text,
                                                !string.IsNullOrEmpty(txtAddress.Text) ? txtAddress.Text : null,
                                                !string.IsNullOrEmpty(txtPhone.Text) ? txtPhone.Text : null,
                                                !string.IsNullOrEmpty(txtEmail.Text) ? txtEmail.Text : null,
                                                !string.IsNullOrEmpty(txtFacebook.Text) ? txtFacebook.Text : null,
                                                cboMode.SelectedIndex == 0 ? true : false,
                                                Convert.ToInt32(nudHoursToBackup.Value),
                                                Convert.ToInt32(nudDaysToDelete.Value),
                                                stPathPicture,
                                                logo,
                                                cboState.SelectedIndex > 0 ? cboState.Text : null,
                                                cboCity.SelectedIndex > -1 ? cboCity.Text : null,
                                                ObjForm_004.ObjSession
                                                ))
                                        {
                                            txtRFC.Enabled           = false;
                                            txtCompany.Enabled       = false;
                                            txtAddress.Enabled       = false;
                                            txtPhone.Enabled         = false;
                                            txtEmail.Enabled         = false;
                                            txtFacebook.Enabled      = false;
                                            cboState.Enabled         = false;
                                            cboCity.Enabled          = false;
                                            pcbLogo.Enabled          = false;
                                            cboMode.Enabled          = false;
                                            nudHoursToBackup.Enabled = false;
                                            nudDaysToDelete.Enabled  = false;
                                            pcbLogo.Enabled          = false;

                                            btnAccept.Visible = btnCancel.Visible = false;
                                            btnEdit.Visible   = true;

                                            btnClose.Enabled = true;

                                            byAction = 0;

                                            MessageBox.Show(Preferences.GlobalSuccessOperation, Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        }
                                        else
                                        {
                                            MessageBox.Show(Preferences.GlobalErrorOperation, Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("The city must be selected if you selected some city.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        cboCity.Focus();
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("The facebook isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    txtFacebook.Focus();
                                }
                            }
                            else
                            {
                                MessageBox.Show("The email isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                txtEmail.Focus();
                            }
                        }
                        else
                        {
                            MessageBox.Show("The phone isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txtPhone.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("The address isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtAddress.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("The company isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtCompany.Focus();
                }
            }
            else
            {
                MessageBox.Show("The RFC isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtRFC.Focus();
            }
        }
 public static string Get(RegularExpressions regularExpression)
 {
     return(Get(regularExpression, 0, 0));
 }
        public static string Get(RegularExpressions regularExpression, int minLength, int maxLength)
        {
            string strResult = string.Empty;

            switch (regularExpression)
            {
            case RegularExpressions.Url:
            {
                strResult = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
                break;
            }

            case RegularExpressions.Guid:
            {
                strResult = @"[\d-a-zA-Z0-9]{36,36}";
                break;
            }

            case RegularExpressions.GuidWithoutDash:
            {
                strResult = @"[\d-a-zA-Z0-9]{32,32}";
                break;
            }

            case RegularExpressions.Email:
            {
                strResult = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
                break;
            }

            case RegularExpressions.Numeric:
            {
                if (minLength > maxLength)
                {
                    strResult = "";
                }
                else
                {
                    strResult = @"[0-9۰-۹]{" + minLength + "," + maxLength + "}";
                }

                //strResult = @"[\d_0-9۰۱۲۳۴۵۶۷۸۹]{" + minLength + "," + maxLength + "}";
                //strResult = @"[0-9۰-۹]{" + minLength + "," + maxLength + "}";
                //strResult = @"[\d۰\d۱\d۲\d۳\d۴\d۵\d۶\d۷\d۸\d۹0-9]{" + minLength + "," + maxLength + "}";
                //strResult = @"[۰۱۲۳۴۵۶۷۸۹0-9]{" + minLength + "," + maxLength + "}";

                //strResult = @"[۰۱۲۳۴۵۶۷۸۹0-9]{1,5}";
                //strResult = @"[0-9۰-۹]{1,5}";
                break;
            }

            case RegularExpressions.UserName:
            {
                strResult = @"[\d_a-zA-Z0-9]{8,20}";
                break;
            }

            case RegularExpressions.Password:
            {
                strResult = @"[\d_a-zA-Z0-9]{8,20}";
                break;
            }

            case RegularExpressions.CaptchaImage:
            {
                strResult = @"[a-zA-Z0-9]{6,6}";
                break;
            }
            }

            return(strResult);
        }
Example #18
0
        protected void uRegister(object sender, EventArgs e)
        {
            string unum    = RegularExpressions.MyEncodeInputString(uNum.Value.Trim());
            string unumpwd = RegularExpressions.MyEncodeInputString(uNumPwd.Value.Trim());
            string uname   = RegularExpressions.MyEncodeInputString(uName.Value.Trim());
            string upwd    = RegularExpressions.MyEncodeInputString(pwd.Value.Trim());
            string upwd1   = RegularExpressions.MyEncodeInputString(pwd1.Value.Trim());
            string umail   = RegularExpressions.MyEncodeInputString(uMail.Value.Trim());
            string ucheck  = RegularExpressions.MyEncodeInputString(uCheck.Value.Trim());
            string check   = HttpContext.Current.Session["check"].ToString();

            if (HttpContext.Current.Session["check"] == null)//判断验证码
            {
                Response.Write("<script>alert('验证码生成错误')</script>");
            }
            else if (!CheckNum.CheckUserNum(unum, unumpwd))
            {
                Response.Write("<script>alert('学号或上网密码错误')</script>");
            }
            else if (!upwd.Equals(upwd1))
            {
                Response.Write("<script>alert('密码不一致')</script>");
            }
            else if (!check.ToUpper().Equals(ucheck.ToUpper()))
            {
                Response.Write("<script>alert('验证码输入错误')</script>");
            }
            else
            {
                En_User eu = new En_User();
                eu.UNum         = unum;
                eu.UName        = uname;
                eu.UPwd         = Md5.MD5_encrypt(upwd1);
                eu.UMail        = umail;
                eu.RegisterTime = DateTime.Now;
                eu.LastLogin    = DateTime.Now;
                eu.State        = 0;

                int blank = BADL_User.IsBlankReg(eu);//判断字段长度
                if (blank != 5)
                {
                    Response.Write("<script>alert('字段长度不符')</script>");
                }
                else if (BADL_User.IsStunumExsit(unum))
                {
                    Response.Write("<script>alert('学号存在')</script>");
                }
                else if (BADL_User.IsNameExsit(uname))
                {
                    Response.Write("<script>alert('昵称存在')</script>");
                }
                else if (BADL_User.InsertUser(eu))
                {
                    Response.Redirect("login.aspx");//注册成功,跳转到登录界面
                }
                else
                {
                    Response.Write("<script>alert('注册异常')</script>");
                }
            }
        }
Example #19
0
        public static Task <int> DoBackup()
        {
            return(Task.Run(() =>
            {
                try
                {
                    if (Directory.Exists(Preferences.PathBackups))
                    {
                        Directory.CreateDirectory(Preferences.PathBackups);
                    }

                    List <string> objList = Directory.GetFiles(Preferences.PathBackups, "*.bak").ToList();

                    if (objList != null)
                    {
                        objList.OrderBy(l => l);

                        for (int inCont = 0; inCont < objList.Count; inCont++)
                        {
                            if (objList[inCont].Split('\\').Length != 4 || objList[inCont].Split('\\')[3].Length != 63 || !objList[inCont].Contains(Preferences.DatabaseName) && !RegularExpressions.CheckIsNumeric(objList[inCont].Split('\\')[3].Substring(47, 12), 12, 12))//if (objList[inCont].Split('\\').Length != 4 || objList[inCont].Split('\\')[3].Length != 63 || !objList[inCont].Contains(Preferences.DatabaseName) && !RegularExpressions.CheckIsNumeric(objList.Last().Split('\\')[3].Substring(47, 12), 12, 12))
                            {
                                objList.RemoveAt(inCont);
                            }
                        }
                    }

                    DateTime objDateNow = DateTime.Now;

                    string stQuery = "USE master; BACKUP DATABASE " + Preferences.DatabaseName + " TO DISK = N'" + Preferences.PathBackups + "\\" + Preferences.DatabaseName + "_auto_" + DateTime.Now.Year.ToString().Substring(2, 2) + (objDateNow.Month < 10 ? "0" + objDateNow.Month : objDateNow.Month.ToString()) + (objDateNow.Day < 10 ? "0" + objDateNow.Day : objDateNow.Day.ToString()) + "" + (objDateNow.Hour < 10 ? "0" + objDateNow.Hour : objDateNow.Hour.ToString()) + "" + (objDateNow.Minute < 10 ? "0" + objDateNow.Minute : objDateNow.Minute.ToString()) + "" + (objDateNow.Second < 10 ? "0" + objDateNow.Second : objDateNow.Second.ToString()) + ".bak' WITH NOFORMAT, NOINIT, NAME = N'test-Completa Base de datos Copia de seguridad', SKIP, NOREWIND, NOUNLOAD, STATS = 10;";

                    if (objList == null || objList.Count == 0)
                    {
                        if (Business.Execute(stQuery))
                        {
                            return BPrincipalCompany.Get().prco_hoursbetweenbackups__int;
                        }
                    }
                    else
                    {
                        int inHoursConfigirated = BPrincipalCompany.Get().prco_hoursbetweenbackups__int;

                        string stDateTime = objList.Last().Split('\\')[3].Substring(47, 12);

                        int inYear = Convert.ToInt32("20" + stDateTime.Substring(0, 2));
                        int inMonth = Convert.ToInt32(stDateTime.Substring(2, 2));
                        int inDay = Convert.ToInt32(stDateTime.Substring(4, 2));
                        int inHour = Convert.ToInt32(stDateTime.Substring(6, 2));
                        int inMinute = Convert.ToInt32(stDateTime.Substring(8, 2));
                        int inSecond = Convert.ToInt32(stDateTime.Substring(10, 2));

                        TimeSpan objTimeSpan = objDateNow - new DateTime(inYear, inMonth, inDay, inHour, inMinute, inSecond);

                        if (objTimeSpan.TotalMinutes > (inHoursConfigirated * 60))
                        {
                            if (Business.Execute(stQuery))
                            {
                                return inHoursConfigirated;
                            }
                        }
                        else
                        {
                            return Convert.ToInt32((inHoursConfigirated * 60) - objTimeSpan.TotalMinutes);
                        }
                    }
                }

                catch { }

                return 0;
            }));
        }
Example #20
0
        public static Task <bool> DeleteBackups()
        {
            return(Task.Run(() =>
            {
                if (Directory.Exists(Preferences.PathBackups))
                {
                    List <string> objList = Directory.GetFiles(Preferences.PathBackups, "*.bak").ToList();

                    if (objList != null)
                    {
                        objList.OrderBy(l => l);

                        int inDaysConfigirated = BPrincipalCompany.Get().prco_daysdeletbackups__int;

                        DateTime objDateNow = DateTime.Now;

                        for (int inCont = 0; inCont < objList.Count; inCont++)
                        {
                            if (objList[inCont].Split('\\').Length == 4 || objList[inCont].Split('\\')[3].Length == 63 || objList[inCont].Contains(Preferences.DatabaseName) && RegularExpressions.CheckIsNumeric(objList[inCont].Split('\\')[3].Substring(47, 12), 12, 12))
                            {
                                string stDateTime = objList.Last().Split('\\')[3].Substring(47, 12);

                                int inYear = Convert.ToInt32("20" + stDateTime.Substring(0, 2));
                                int inMonth = Convert.ToInt32(stDateTime.Substring(2, 2));
                                int inDay = Convert.ToInt32(stDateTime.Substring(4, 2));
                                int inHour = Convert.ToInt32(stDateTime.Substring(6, 2));
                                int inMinute = Convert.ToInt32(stDateTime.Substring(8, 2));
                                int inSecond = Convert.ToInt32(stDateTime.Substring(10, 2));

                                TimeSpan objTimeSpan = objDateNow - new DateTime(inYear, inMonth, inDay, inHour, inMinute, inSecond);

                                if (objTimeSpan.TotalHours > (inDaysConfigirated * 24))
                                {
                                    try
                                    {
                                        File.Delete(objList[inCont]);
                                    }
                                    catch { }
                                }
                            }
                        }

                        return true;
                    }
                }
                return false;
            }));
        }
Example #21
0
    private string CheckNeeded()
    {
        string rtn              = "";
        string dealDate         = DealDate.Text.Trim();
        string dealHospitalName = DealHospitalName.Text.Trim();
        string dealHospitalID   = DealHospitalID.Value.Trim();
        string num              = Num.Text.Trim();
        string tempHigh         = TempHigh.Text.Trim();
        string tempLow          = TempLow.Text.Trim();
        string dealType         = DealType.SelectedValue.ToString();

        if (dealDate.Length == 0)
        {
            rtn += "撥入日期:必填!\\n";
        }
        else if (RegularExpressions.IsDate((Convert.ToInt32(DealDate.Text.Substring(0, 3)) + 1911).ToString() + "-" + DealDate.Text.Substring(3, 2) + "-" + DealDate.Text.Substring(5, 2)) == false)
        {
            rtn += "撥入日期:日期有誤!\\n";
        }

        if (dealType == "4")
        {
            if (dealHospitalName.Length == 0 && dealHospitalID.Length == 0)
            {
                rtn += "撥入類別:合約醫院:必填!\\n";
            }
        }

        if (num.Length == 0)
        {
            rtn += "撥入數量:必填!\\n";
        }
        else if (RegularExpressions.IsPlusInt(num) == false)
        {
            rtn += "撥入數量:請輸入正整數!\\n";
        }

        if (tempHigh.Length == 0)
        {
            rtn += "運送期間溫度:最高:必填!\\n";
        }
        else if (RegularExpressions.IsFloatTo1(tempHigh) == false)
        {
            rtn += "運送期間溫度:最高:正整數或至小數點後一位!\\n";
        }

        if (tempLow.Length == 0)
        {
            rtn += "運送期間溫度:最低:必填!\\n";
        }
        else if (RegularExpressions.IsFloatTo1(tempLow) == false)
        {
            rtn += "運送期間溫度:最低:正整數或至小數點後一位!\\n";
        }

        if (tempHigh.Length != 0 && tempLow.Length != 0 && RegularExpressions.IsFloatTo1(tempHigh) == true && RegularExpressions.IsFloatTo1(tempLow) == true)
        {
            if (float.Parse(tempHigh) < float.Parse(tempLow) || float.Parse(tempHigh) > 8.0)
            {
                rtn += "運送期間溫度:最高:低於最低溫度或大於8°C!\\n";
            }

            if (float.Parse(tempLow) > float.Parse(tempHigh) || float.Parse(tempLow) < 2.0)
            {
                rtn += "運送期間溫度:最低:高於最高溫度或小於2°C!\\n";
            }
        }

        if (TempFile.HasFile == true)
        {
            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                byte[]         fileData     = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }
                if (fileData.Length > 3145728)
                {
                    rtn += "上傳溫度資料檔案:此檔案" + uploadedFile.FileName + "超過3M!\\n";
                }
            }
        }

        return(rtn);
    }
Example #22
0
    private string CheckNeeded()
    {
        string rtn      = "";
        string num      = Num.Text.Trim();
        string storge   = Storage.Text.Trim();
        string tempHigh = TempHigh.Text.Trim();
        string tempLow  = TempLow.Text.Trim();

        if (num.Length == 0)
        {
            rtn += "撥出數量:必填!\\n";
        }
        else if (RegularExpressions.IsPlusInt(num) == false)
        {
            rtn += "撥出數量:請輸入正整數!\\n";
        }
        else if (int.Parse(storge) - int.Parse(num) < 0)
        {
            rtn += "撥出數量:請小於或等於庫目前庫存量!\\n";
        }

        if (tempHigh.Length == 0)
        {
            rtn += "運送期間溫度:最高:必填!\\n";
        }
        else if (RegularExpressions.IsFloatTo1(tempHigh) == false)
        {
            rtn += "運送期間溫度:最高:正整數或至小數點後一位!\\n";
        }

        if (tempLow.Length == 0)
        {
            rtn += "運送期間溫度:最低:必填!\\n";
        }
        else if (RegularExpressions.IsFloatTo1(tempLow) == false)
        {
            rtn += "運送期間溫度:最低:正整數或至小數點後一位!\\n";
        }

        if (tempHigh.Length != 0 && tempLow.Length != 0 && RegularExpressions.IsFloatTo1(tempHigh) == true && RegularExpressions.IsFloatTo1(tempLow) == true)
        {
            if (float.Parse(tempHigh) < float.Parse(tempLow) || float.Parse(tempHigh) > 8.0)
            {
                rtn += "運送期間溫度:最高:低於最低溫度或大於8°C!\\n";
            }

            if (float.Parse(tempLow) > float.Parse(tempHigh) || float.Parse(tempLow) < 2.0)
            {
                rtn += "運送期間溫度:最低:高於最高溫度或小於2°C!\\n";
            }
        }

        if (TempFile.HasFile == true)
        {
            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                byte[]         fileData     = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }
                if (fileData.Length > 3145728)
                {
                    rtn += "上傳溫度資料檔案:此檔案" + uploadedFile.FileName + "超過3M!\\n";
                }
            }
        }

        return(rtn);
    }
        private string FindRM2InDocumentName()
        {
            var rm2 = RegularExpressions.JustDigits().Match(_file.Name);

            return(rm2.ToString());
        }
Example #24
0
 public EbnfLexerRuleFactorRegex(RegularExpressions.Regex regex)
 {
     Regex = regex;
     _hashCode = ComputeHashCode();
 }
Example #25
0
        // The parsing logic is based on http://www.w3.org/TR/CSS2/syndata.html.
        internal static string TransformCssFile(string sourceCssText)
        {
            sourceCssText = RegularExpressions.RemoveMultiLineCStyleComments(sourceCssText);

            var customElementsDetected = from Match match in Regex.Matches(sourceCssText, customElementPattern) select match.Value;

            customElementsDetected = customElementsDetected.Distinct();
            var knownCustomElements   = CssPreprocessingStatics.Elements.Select(ce => reservedCustomElementPrefix + ce.Name);
            var unknownCustomElements = customElementsDetected.Except(knownCustomElements).ToList();

            if (unknownCustomElements.Any())
            {
                throw new MultiMessageApplicationException(
                          unknownCustomElements.Select(e => "\"" + e + "\" begins with the reserved custom element prefix but is not a known custom element.").ToArray());
            }

            using (var writer = new StringWriter()) {
                var buffer = new StringBuilder();
                using (var reader = new StringReader(sourceCssText)) {
                    char?stringDelimiter = null;
                    while (reader.Peek() != -1)
                    {
                        var c = (char)reader.Read();

                        // escaped quote, brace, or other character
                        if (c == '\\')
                        {
                            buffer.Append(c);
                            if (reader.Peek() != -1)
                            {
                                buffer.Append((char)reader.Read());
                            }
                        }

                        // string delimiter
                        else if (!stringDelimiter.HasValue && (c == '\'' || c == '"'))
                        {
                            buffer.Append(c);
                            stringDelimiter = c;
                        }
                        else if (stringDelimiter.HasValue && c == stringDelimiter)
                        {
                            buffer.Append(c);
                            stringDelimiter = null;
                        }

                        // selector delimiter
                        else if (!stringDelimiter.HasValue && (c == ',' || c == '{'))
                        {
                            writer.Write(getTransformedSelector(buffer.ToString()));
                            writer.Write(c);
                            buffer = new StringBuilder();
                        }
                        else if (!stringDelimiter.HasValue && c == '}')
                        {
                            writer.Write(buffer.ToString());
                            writer.Write(c);
                            buffer = new StringBuilder();
                        }

                        // other character
                        else
                        {
                            buffer.Append(c);
                        }
                    }
                }
                writer.Write(buffer.ToString());
                return(writer.ToString());
            }
        }
Example #26
0
 public void TestFindLinksE()
 {
     Assert.IsTrue(RegularExpressions.FindLinksE(TestString).Contains("https://www.nearlyfreespeech.net/"));
 }