Exemple #1
0
        // GET: Consults/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Consult consult = db.Consults.Find(id);

            if (consult == null)
            {
                return(HttpNotFound());
            }
            return(View(consult));
        }
        public IHttpActionResult DeleteConsult(int id)
        {
            Consult consult = db.Consult.Find(id);

            if (consult == null)
            {
                return(NotFound());
            }

            db.Consult.Remove(consult);
            db.SaveChanges();

            return(Ok(consult));
        }
Exemple #3
0
        public static void GuidecEdit(int id)
        {
            int guidecnum = Common.Util.GetPageParamsAndToInt("guidecnum");

            if (guidecnum == -100)
            {
                MsgBox.Alert("WebSiteAdd", "<p>商务通错误</p>");
                return;
            }
            string title = Common.Util.GetPageParams("guidechead");
            string link = Common.Util.GetPageParams("guideclink");
            string article = "", articlelink = "";

            for (int i = 1; i <= guidecnum; i++)
            {
                if (Common.Util.GetPageParams("article" + i.ToString()) == "")
                {
                    article += " |||";
                }
                else
                {
                    article += Common.Util.GetPageParams("article" + i.ToString()) + "|||";
                }
                if (Common.Util.GetPageParams("articlelink" + i.ToString()) == "")
                {
                    articlelink += " |||";
                }
                else
                {
                    articlelink += Common.Util.GetPageParams("articlelink" + i.ToString()) + "|||";
                }
            }
            if (article.Length > 0)
            {
                article = article.Substring(0, article.Length - 3);
            }
            if (articlelink.Length > 0)
            {
                articlelink = articlelink.Substring(0, articlelink.Length - 3);
            }
            string guideccontent = Common.Util.GetPageParams("guideccontent");
            Guidec guidec        = new Guidec();

            guidec.Id    = id;
            guidec.Title = title;
            guidec.Link  = link;

            Consult.GuidecEdit(guidec);
        }
Exemple #4
0
        public void ErrorIfStartAfterFinish()
        {
            var consult = new Consult
            {
                id              = 9999999,
                consultStartAt  = new DateTime(2019, 6, 18, 13, 0, 0),
                consultFinishAt = new DateTime(2019, 6, 18, 12, 0, 0)
            };

            var consultValidation = new ConsultValidation();

            var ex = Assert.Throws <Exception>(() => consultValidation.validStartBeforeFinish(consult));

            Assert.Equal(ex.Message, "The consult can not end before you start");
        }
Exemple #5
0
        public void SucessIfStartBeforeFinish()
        {
            var consult = new Consult
            {
                id              = 9999999,
                consultStartAt  = new DateTime(2019, 6, 18, 12, 0, 0),
                consultFinishAt = new DateTime(2019, 6, 18, 13, 0, 0)
            };

            var consultValidation = new ConsultValidation();

            var idReturned = consultValidation.validStartBeforeFinish(consult);

            Assert.Equal(consult.id, idReturned);
        }
Exemple #6
0
        public async Task <ActionResult> Consult(ConsultModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_Consult", model));
            }
            var consult = new Consult();

            Mapper.Map(model, consult);
            consult.CommonStatus = CommonStatus.Enabled;
            await ConsultRepository.SaveAsync(consult);

            model.IsSucceed = true;
            return(PartialView("_Consult", model));
        }
Exemple #7
0
        private Consult GetConsult(OrqqcnConsult orqqcnConsult)
        {
            Consult returnVal = new Consult()
            {
                Ien         = orqqcnConsult.Ien,
                Category    = orqqcnConsult.Category,
                Description = orqqcnConsult.Description,
                Service     = orqqcnConsult.Service,
                Status      = orqqcnConsult.Status
            };

            returnVal.ConsultDate = Util.GetDateTime(orqqcnConsult.ConsultDate);

            return(returnVal);
        }
Exemple #8
0
        public static string GetMenus()
        {
            builder = new StringBuilder();
            Menus mainmenus = Consult.GetMenus(0);

            foreach (Menu menu in mainmenus)
            {
                User user = Consult.GetUser(HtmlUser.GetLoggedMemberId());
                if (Util.JudgeRights(menu.Rights, user.Admins) || menu.Sub > 0)
                {
                    Menus submenus = Consult.GetMenus(menu.Id);
                    if (submenus.Count > 0)
                    {
                        if (menu.Sub == 1 && user.GroupId == 1)
                        {
                            builder.Append(string.Format("<div class=\"sub\"><a href=\"javascript:void(0);\">{1}</a></div>\r\n", menu.Url, menu.MenuName));
                        }
                        //else if (menu.Url == "http://www.andad.net/cjwt/")
                        //    builder.Append(string.Format("<div class=\"sub\"><a href=\"{0}\" target=\"_blank\">{1}</a></div>\r\n", menu.Url, menu.MenuName));
                        else
                        {
                            builder.Append(string.Format("<div class=\"sub1\"><img src=\"../images/dir_2.gif\" onclick=\"hide(this)\" /><a href=\"{0}\" target=\"mainFrame\">{1}</a></div>\r\n", menu.Url, menu.MenuName));
                        }
                        builder.Append("    <ul style=\"display:block;\">\r\n");
                        foreach (Menu submenu in submenus)
                        {
                            if (Util.JudgeRights(submenu.Rights, user.Admins))
                            {
                                builder.Append(string.Format("        <li><a href=\"{0}\" target=\"mainFrame\" title=\"{1}\">{1}</a></li>\r\n", submenu.Url, submenu.MenuName));
                            }
                        }
                        builder.Append("    </ul>\r\n");
                    }
                    else
                    {
                        if (menu.Url.ToLower().IndexOf("logout.aspx") != -1)
                        {
                            builder.Append(string.Format("<div class=\"sub\"><a href=\"{0}\" target=\"_top\">{1}</a></div>\r\n", menu.Url, menu.MenuName));
                        }
                        else
                        {
                            builder.Append(string.Format("<div class=\"sub\"><a href=\"{0}\" target=\"mainFrame\">{1}</a></div>\r\n", menu.Url, menu.MenuName));
                        }
                    }
                }
            }
            return(builder.ToString());
        }
Exemple #9
0
        public static void ImageEdit(int id)
        {
            int                width      = Common.Util.GetPageParamsAndToInt("picwidth");
            int                height     = Common.Util.GetPageParamsAndToInt("picheight");
            string             imagename  = Common.Util.GetPageParams("picname");
            string             imageurl   = Common.Util.GetPageParams("pice");
            string             imagelink  = Common.Util.GetPageParams("piclnk");
            HttpFileCollection hfc        = HttpContext.Current.Request.Files;
            HttpPostedFile     postedFile = hfc["picurl"];

            if (postedFile != null)
            {
                if (postedFile.ContentLength > 0)
                {
                    string   extFileName = postedFile.FileName.Substring(postedFile.FileName.LastIndexOf("."));
                    string[] extName     = AdvAli.Config.Global.config.AllowUpload.Split(new char[] { '|' });
                    bool     hasType     = false;
                    for (int j = 0; j < extName.Length; j++)
                    {
                        if (extName[j].ToLower() == extFileName.Substring(1).ToLower())
                        {
                            hasType = true;
                        }
                    }
                    if (!hasType)
                    {
                        MsgBox.Alert("Login", string.Format("<p>上传的文件类型出错,只允许 {0} !</p>", AdvAli.Config.Global.config.AllowUpload));
                        return;
                    }
                    int fileLength = int.Parse((postedFile.ContentLength / 1024).ToString());
                    if (fileLength > AdvAli.Config.Global.config.MaxUpload)
                    {
                        MsgBox.Alert("Login", string.Format("<p>上传的文件长度出错,只最大只允许 {0} Kbyte!</p>", AdvAli.Config.Global.config.MaxUpload));
                        return;
                    }
                    imageurl = Util.FileUpDb("picurl");
                }
            }
            Images image = new Images();

            image.Id        = id;
            image.Width     = width;
            image.Height    = height;
            image.ImageName = imagename;
            image.ImageUrl  = imageurl;
            image.ImageLink = imagelink;
            Consult.ImageEdit(image);
        }
Exemple #10
0
 public static void EditPassword(int userid, string oldpassword, string newpassword)
 {
     if (oldpassword.Length < 6 || oldpassword.Length > 20 || newpassword.Length < 6 || newpassword.Length > 20)
     {
         MsgBox.Alert("RegisterUser", string.Format("<p>密码长度不符合规则,长度应该为 6-20的字符!</p>"));
         return;
     }
     if (Consult.EditUserPassword(userid, Common.Util.Md532(oldpassword), Common.Util.Md532(newpassword)))
     {
         MsgBox.ScriptAlert("Password", string.Format("密码修改成功!"), "../user/password.aspx");
     }
     else
     {
         MsgBox.ScriptAlert("Password", string.Format("密码修改失败!"), "../user/password.aspx");
     }
 }
Exemple #11
0
        public static int GuidecAdd()
        {
            int guidecnum = Common.Util.GetPageParamsAndToInt("guidecnum");

            if (guidecnum == -100)
            {
                return(0);
            }
            string title = Common.Util.GetPageParams("guidechead");
            string link = Common.Util.GetPageParams("guideclink");
            string article = "", articlelink = "";
            string guideccontent = Common.Util.GetPageParams("guideccontent");

            for (int i = 1; i <= guidecnum; i++)
            {
                if (Common.Util.GetPageParams("article" + i.ToString()) == "")
                {
                    article += " |||";
                }
                else
                {
                    article += Common.Util.GetPageParams("article" + i.ToString()) + "|||";
                }
                if (Common.Util.GetPageParams("articlelink" + i.ToString()) == "")
                {
                    articlelink += " |||";
                }
                else
                {
                    articlelink += Common.Util.GetPageParams("articlelink" + i.ToString()) + "|||";
                }
            }
            if (article.Length > 0)
            {
                article = article.Substring(0, article.Length - 3);
            }
            if (articlelink.Length > 0)
            {
                articlelink = articlelink.Substring(0, articlelink.Length - 3);
            }
            Guidec guidec = new Guidec();

            guidec.Title = title;
            guidec.Link  = link;
            return(Consult.GuidecAdd(guidec));
        }
Exemple #12
0
        public MainForm()
        {
            InitializeComponent();
            model = new Consult();

            uC_G221.Visible = false;
            uC_G31.Visible  = false;
            uC_G41.Visible  = false;
            uC_G51.Visible  = false;
            uC_P111.Visible = false;

            uC_G221.LoadModel(model);
            uC_G31.LoadModel(model);
            uC_G41.LoadModel(model);
            uC_G51.LoadModel(model);
            uC_P111.loadModel(model);
        }
        //------------------------------------------------------------------------------

        internal static Consult ToCons(this ConsultViewModel consVM)
        {
            // Map only fields 1:1 from ViewModel to Model
            var result = new Consult
            {
                Id               = consVM.Consult.Id,
                ActionCode       = consVM.Consult.ActionCode,
                ClientId         = consVM.Consult.ClientId,
                DoctorId         = consVM.Consult.DoctorId,
                ConsultDate      = consVM.Consult.ConsultDate,
                ConsultDescr     = consVM.Consult.ConsultDescr,
                Price            = consVM.Consult.Price,
                CommentForDoctor = consVM.Consult.CommentForDoctor
            };

            return(result);
        }
Exemple #14
0
 protected void rptConsults_OnItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         Consult consult = (Consult)e.Item.DataItem;
         Literal litId   = (Literal)e.Item.FindControl("litId");
         litId.Text = consult.id.ToString();
         Literal litHour = (Literal)e.Item.FindControl("litHour");
         litHour.Text = consult.startDate.ToString("dd/MM/yyyy HH:mm");
         Literal litName = (Literal)e.Item.FindControl("litName");
         litName.Text = consult.patient.fullName;
         Literal litPhone = (Literal)e.Item.FindControl("litPhone");
         litPhone.Text = consult.patient.phone;
         Literal litAction = (Literal)e.Item.FindControl("litAction");
         litAction.Text = "<a href='ConsultDetail.aspx?consultId=" + consult.patient.id.ToString() + "'>Ver más</a>";
     }
 }
Exemple #15
0
    protected void btnSubmitConsult_Click(object sender, EventArgs e)
    {
        Consult c = new Consult();

        c.startDate = this.getDateFromStrings(this.hidSelectedDate.Value.Trim(), this.timepickerFrom.Value);
        c.endDate   = this.getDateFromStrings(this.hidSelectedDate.Value.Trim(), this.timepickerTo.Value);
        if (c.endDate < c.startDate)
        {
            c.endDate.AddDays(1);
        }
        c.patient    = new Patient();
        c.patient.id = int.Parse(this.hidSelectedUserId.Value);
        c.price      = double.Parse(this.txtPrice.Text);
        c.diagnostic = this.txtDiagnostic.Text;
        c.assignedTo = this.loggedUser;
        c.scheduler  = this.loggedUser;
        BusinessLogic.insertConsult(c);
    }
Exemple #16
0
 private Consult makeConsult(Consult c)
 {
     c.startDate = this.getDateFromStrings(this.txtDate.Text.Trim(), this.txtStartTime.Text);
     c.endDate   = this.getDateFromStrings(this.txtDate.Text.Trim(), this.txtEndTime.Text);
     if (c.endDate < c.startDate)
     {
         c.endDate.AddDays(1);
     }
     c.price            = double.Parse(this.txtPrice.Text);
     c.diagnostic       = this.txtDiagnostic.Text;
     c.assignedTo       = this.loggedUser;
     c.scheduler        = this.loggedUser;
     c.propousal        = txtPropusal.Text;
     c.rating           = int.Parse(txtRating.Text);
     c.treatment        = txtTreatment.Text;
     c.clinicalAnalysis = txtClinicAnalysis.Text;
     c.state            = (Consult.ConsultState)ddlState.SelectedIndex + 1;
     return(c);
 }
Exemple #17
0
        public static void EditUser(User u)
        {
            if (!Util.CheckEmail(u.Username))
            {
                MsgBox.Alert(string.Format("邮箱账户 {0} 不是合法的邮箱名称!", u.Username));
                return;
            }
            if (u.Password.Length < 6 || u.Password.Length > 20 && u.Password.Length != 32)
            {
                MsgBox.Alert(string.Format("密码长度不符合规则,长度应该为6-20个字符!", u.Password));
                return;
            }
            if (u.Inc.Length <= 0)
            {
                MsgBox.Alert("企业名称不能为空!");
                return;
            }
            if (u.Contact.Length <= 0)
            {
                MsgBox.Alert("联系人不能为空!");
                return;
            }
            if (u.TelPhone.Length == 0 && u.Mobile.Length == 0)
            {
                MsgBox.Alert("固定电话和手机必需填写一项!");
                return;
            }
            if (u.Address.Length <= 0)
            {
                MsgBox.Alert("联系地址不能为空!");
                return;
            }
            int result = Consult.EditUser(u);

            if (result > 0)
            {
                MsgBox.ScriptAlert("UpdateUser", string.Format("用户 {0} 修改成功.", u.Username), "../user/index.aspx");
            }
            else
            {
                MsgBox.Alert("UpdateUser", string.Format("用户 {0} 修改失败.", u.Username));
            }
        }
Exemple #18
0
 protected void rptConsults_OnItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         Consult consult = (Consult)e.Item.DataItem;
         Literal litId   = (Literal)e.Item.FindControl("litId");
         litId.Text = consult.id.ToString();
         Literal litHour = (Literal)e.Item.FindControl("litHour");
         litHour.Text = consult.startDate.ToString("HH:mm");
         Literal litName = (Literal)e.Item.FindControl("litName");
         litName.Text = consult.patient.fullName;
         Literal litPhone = (Literal)e.Item.FindControl("litPhone");
         litPhone.Text = consult.patient.phone;
         Literal litAction = (Literal)e.Item.FindControl("litAction");
         litAction.Text = "<a class=\"btn btn-sm blue options\" data-toggle=\"modal\" href=\"#opciones\" consultId=" + consult.id + " >Opciones</a>";//"<a href='ConsultDetail.aspx?consultId=" + consult.patient.id.ToString() + "'>Ver más</a>";
         Literal litEstado = (Literal)e.Item.FindControl("litEstado");
         litEstado.Text = consult.getStateString();
     }
 }
Exemple #19
0
        public static void EditUser(int userid, string username, string password, string entname, string entnote, string address, string tel)
        {
            User u = Consult.GetUser(userid);

            if (!string.IsNullOrEmpty(password))
            {
                u.Password = Util.Md532(password);
            }
            u.Address = address;
            if (!string.IsNullOrEmpty(password))
            {
                if (password.Length > 0)
                {
                    if (password.Length < 6 || password.Length > 20)
                    {
                        MsgBox.Alert("RegisterUser", string.Format("<p>密码长度不符合规则,长度应该为 6-20的字符!</p>", u.Username));
                        return;
                    }
                }
            }
            if (string.IsNullOrEmpty(address))
            {
                MsgBox.Alert("RegisterUser", string.Format("<p>联系地址不能为空!</p>"));
                return;
            }
            if (string.IsNullOrEmpty(tel))
            {
                MsgBox.Alert("RegisterUser", string.Format("<p>联系电话不能为空!</p>"));
                return;
            }
            int result = Consult.EditUser(u);

            ((Page)HttpContext.Current.Handler).ClientScript.RegisterStartupScript(((Page)HttpContext.Current.Handler).GetType(), "forgetscript", "start=0;objid='inputid';", true);
            if (result > 0)
            {
                MsgBox.ScriptAlert("UpdateUser", string.Format("用户 {0} 修改成功.", username), "../user/index.aspx");
            }
            else
            {
                MsgBox.Alert("UpdateUser", string.Format("用户 {0} 修改失败.", username));
            }
        }
Exemple #20
0
        public static void QQMsnEdit(int id, bool flag)
        {
            int qqn = Common.Util.GetPageParamsAndToInt("qqn");

            if (qqn == -100)
            {
                MsgBox.Alert("WebSiteAdd", "<p>QQ/Msn错误</p>");
                return;
            }
            string header = Common.Util.GetPageParams("qqhead");
            string bottom = Common.Util.GetPageParams("qqbottom");
            string account = "", namer = "", notes = "";

            for (int i = 1; i <= qqn; i++)
            {
                account += Common.Util.GetPageParams("qqnum" + i.ToString()) + "|||";
                namer   += Common.Util.GetPageParams("qqs" + i.ToString()) + "|||";
                notes   += Common.Util.GetPageParams("qqtitle" + i.ToString()) + "|||";
            }
            if (account.Length > 0)
            {
                account = account.Substring(0, account.Length - 3);
            }
            if (namer.Length > 0)
            {
                namer = namer.Substring(0, namer.Length - 3);
            }
            if (notes.Length > 0)
            {
                notes = notes.Substring(0, notes.Length - 3);
            }
            QQMsn qqmsn = new QQMsn();

            qqmsn.Header  = header;
            qqmsn.Bottom  = bottom;
            qqmsn.IsQQ    = flag;
            qqmsn.Account = account;
            qqmsn.Namer   = namer;
            qqmsn.Notes   = notes;
            Consult.QQMsnEdit(qqmsn);
        }
Exemple #21
0
    public static void insertConsult(Consult c)
    {
        SqlCommand myCommand = new SqlCommand("INSERT INTO Consults (startDate, endDate, price, diagnostic, scheduler, patientId, assignedTo) " +
                                              "Values (@startDate, @endDate, @price, @diagnostic, @scheduler, @patientId, @assignedTo)", myConnection);

        Consult.addDBParametersFromConsult(c, myCommand);

        try
        {
            myConnection.Open();
            myCommand.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            myConnection.Close();
        }
    }
Exemple #22
0
        public static void ForgetPassword(string email)
        {
            string pass = Consult.ForgetPassword(email);

            if (string.IsNullOrEmpty(pass))
            {
                MsgBox.Alert(string.Format("电子邮件 {0} 不存在!", email));
            }
            else
            {
                EmailConfig defaultMail = Consult.GetDefaultEmailConfig();
                if (Mail.SendMail(defaultMail.MailName, email, string.Format("您在{0}的密码已修改!", Global.__WebSiteName), string.Format("<p>您成功使用<span style='color:blue;font-size:14px;'>{0}</span>的密码找回功能。<br />新的密码:{1} (请尽快登陆修改密码)</p></body></html>", Global.__WebSiteName, pass), defaultMail.Email, defaultMail.Pass, defaultMail.SmtpServer))
                {
                    MsgBox.Alert(string.Format("您的新密码已成功发送到指定邮箱。\\n请尽快登陆,修改您的密码!"));
                }
                else
                {
                    MsgBox.Alert(string.Format("您的新密码在发送中出现错误,请检查服务商提供的邮件账号是否可用。\\n如果正常,请稍后重新使用密码找回功能。"));
                }
            }
        }
Exemple #23
0
        public static int QQMsnAdd(bool flag)
        {
            int qqn = Common.Util.GetPageParamsAndToInt("qqn");

            if (qqn == -100)
            {
                return(0);
            }
            string header = Common.Util.GetPageParams("qqhead");
            string bottom = Common.Util.GetPageParams("qqbottom");
            string account = "", namer = "", notes = "";

            for (int i = 1; i <= qqn; i++)
            {
                account += Common.Util.GetPageParams("qqnum" + i.ToString()) + "|||";
                namer   += Common.Util.GetPageParams("qqs" + i.ToString()) + "|||";
                notes   += Common.Util.GetPageParams("qqtitle" + i.ToString()) + "|||";
            }
            if (account.Length > 0)
            {
                account = account.Substring(0, account.Length - 3);
            }
            if (namer.Length > 0)
            {
                namer = namer.Substring(0, namer.Length - 3);
            }
            if (notes.Length > 0)
            {
                notes = notes.Substring(0, notes.Length - 3);
            }
            QQMsn qqmsn = new QQMsn();

            qqmsn.Header  = header;
            qqmsn.Bottom  = bottom;
            qqmsn.IsQQ    = flag;
            qqmsn.Account = account;
            qqmsn.Namer   = namer;
            qqmsn.Notes   = notes;
            return(Consult.QQMsnAdd(qqmsn));
        }
Exemple #24
0
    protected void SaveChanges(object sender, EventArgs e)
    {
        Consult c = BusinessLogic.getConsult(int.Parse(this.selectedConsultId.Value));

        if (c != null)
        {
            c.propousal = txtPropusal.Text;
            c.treatment = txtTreatment.Text;
            c.state     = (Consult.ConsultState)Enum.Parse(typeof(Consult.ConsultState), ddlState.SelectedValue);
            if (c.state == Consult.ConsultState.Confirmed)
            {
                c.rating = int.Parse(txtRating.Text);
            }
            else
            {
                c.rating = 1;
            }
            c.clinicalAnalysis = txtClinicAnalysis.Text;
            BusinessLogic.updateConsult(c);
            Response.Redirect(Request.RawUrl);
        }
    }
 internal Consult[] toConsults(string response)
 {
     if (String.IsNullOrEmpty(response) || response.StartsWith("< PATIENT DOES NOT HAVE ANY CONSULTS/REQUESTS"))
     {
         return(null);
     }
     string[] rex = StringUtils.split(response, StringUtils.CRLF);
     rex = StringUtils.trimArray(rex);
     Consult[] result = new Consult[rex.Length];
     for (int i = 0; i < rex.Length; i++)
     {
         string[] flds = StringUtils.split(rex[i], StringUtils.CARET);
         Consult  c    = new Consult();
         c.Id        = flds[0];
         c.Text      = getConsultNote(c.Id);
         c.Timestamp = VistaTimestamp.toDateTime(flds[1]);
         c.Status    = VistaOrdersDao.decodeOrderStatus(flds[2]);
         c.Title     = flds[6];
         //c.Service = new KeyValuePair<string, string>("", flds[2]);
         result[i] = c;
     }
     return(result);
 }
Exemple #26
0
        public void GetTemperaturaAPITimeOut()
        {
            //Chando servico consulta dados
            var consultaService = new Consult();

            consultaService.IniciarServico();

            //Aguarda o serviço obter ao menos uma amostragem
            int segundosCarregando = 0;

            while (!Consult.Carregado)
            {
                Thread.Sleep(1000);
                segundosCarregando++;

                if (segundosCarregando > 15)
                {
                    Assert.Fail("Demora excessiva ao consultar api.openweathermap.org");
                }
            }

            Assert.IsTrue(segundosCarregando < 15);
        }
Exemple #27
0
    public static Consult getConsultByPatientId(int id)
    {
        Consult response = null;

        try
        {
            myConnection.Open();
            SqlDataReader r         = null;
            SqlCommand    myCommand = new SqlCommand("select top(1) consultId, startDate, endDate, price, rating, state from Consults c where c.patientId = @id order by 2 desc", myConnection);

            SqlParameter pid = new SqlParameter("@id", System.Data.SqlDbType.Int);
            pid.Value = id;
            myCommand.Parameters.Add(pid);

            r = myCommand.ExecuteReader();

            if (r.Read())
            {
                response           = new Consult();
                response.id        = (int)r["consultId"];
                response.startDate = (DateTime)r["startDate"];
                response.endDate   = (DateTime)r["endDate"];
                response.price     = double.Parse(r["price"].ToString());
                response.rating    = (int)r["rating"];
                response.loadStateFromInt((int)r["state"]);
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
        finally
        {
            myConnection.Close();
        }
        return(response);
    }
Exemple #28
0
        public TaggedConsultArrays getConsultsForPatient()
        {
            TaggedConsultArrays result = new TaggedConsultArrays();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                IndexedHashtable t = Consult.getConsultsForPatient(mySession.ConnectionSet);
                return(new TaggedConsultArrays(t));
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
                return(result);
            }
        }
Exemple #29
0
        public void GetTemperaturaAPITestErrorHTTP()
        {
            //Chando servico consulta dados
            var consultaService = new Consult();

            consultaService.IniciarServico();

            //Aguarda o serviço obter ao menos uma amostragem
            AguardaCarregamentoInicial();

            var controller = new TemperaturaController();

            controller.Request       = new HttpRequestMessage();
            controller.Configuration = new HttpConfiguration();

            var consulta = new CidadeDTO();

            //Cidades EMPTY
            consulta.Cidades     = "";
            consulta.DataInicial = DateTime.Now.AddDays(-1);
            consulta.DataFinal   = DateTime.Now.AddDays(20);


            //Consulta API
            var responseTask = controller.Get(consulta);

            var readTask = responseTask.Result.Content.ReadAsStringAsync();

            readTask.Wait();

            var result = responseTask.Result;

            //Valida Retorno HTTP
            Assert.IsTrue(result.StatusCode == HttpStatusCode.NotFound);
            Assert.IsTrue(((ObjectContent)result.Content).Value == "Nome cidade inválido");
        }
Exemple #30
0
        internal IList<Consult> toConsultsFromXmlNode(XmlNode node)
        {
            IList<Consult> consults = new List<Consult>();

            int total = verifyTopLevelNode(node);
            if (total == 0)
            {
                return consults;
            }

            XmlNodeList consultNodes = node.SelectNodes("/consult");
            if (consultNodes == null || consultNodes.Count == 0)
            {
                return consults;
            }

            foreach (XmlNode consultNode in consultNodes)
            {
                Consult consult = new Consult();
                consult.Id = XmlUtils.getXmlAttributeValue(consultNode, "id", "value");
                consult.Title = XmlUtils.getXmlAttributeValue(consultNode, "name", "value");
                consult.Status = XmlUtils.getXmlAttributeValue(consultNode, "status", "value");
                consult.Type = new OrderType() { Id = XmlUtils.getXmlAttributeValue(consultNode, "orderID", "value"), Name1 = XmlUtils.getXmlAttributeValue(consultNode, "type", "value") };

                consults.Add(consult);
            }

            return consults;
        }
Exemple #31
0
        public static void AddUser(string username, string password, string inc, string contact, string tel, string mobile, string fax, string qq, string msn, string address)
        {
            clsDES cd = new clsDES(Guid.NewGuid().ToString());
            User   u  = new User();

            u.Username     = username;
            u.Password     = Util.Md532(password);
            u.Inc          = inc;
            u.Contact      = contact;
            u.TelPhone     = tel;
            u.Mobile       = mobile;
            u.Fax          = fax;
            u.QQ           = qq;
            u.Msn          = msn;
            u.Address      = address;
            u.GroupId      = 1;
            u.RegDate      = DateTime.Now;
            u.LogDate      = u.RegDate;
            u.RegIp        = Util.GetUserIP();
            u.LogIp        = u.RegIp;
            u.Adminstrator = Consult.GetGroupAdmins(1);
            if (!Util.CheckEmail(u.Username))
            {
                MsgBox.Alert(string.Format("邮箱账户 {0} 不是合法的邮箱名称!", u.Username));
                return;
            }
            if (password.Length < 6 || password.Length > 20)
            {
                MsgBox.Alert(string.Format("密码长度不符合规则,长度应该为6-20个字符!", u.Password));
            }
            if (inc.Length <= 0)
            {
                MsgBox.Alert("企业名称不能为空!");
            }
            if (contact.Length <= 0)
            {
                MsgBox.Alert("联系人不能为空!");
            }
            if (tel.Length == 0 && mobile.Length == 0)
            {
                MsgBox.Alert("固定电话和手机必需填写一项!");
            }
            if (address.Length <= 0)
            {
                MsgBox.Alert("联系地址不能为空!");
            }
            int userid = 0;

            if (Logic.Consult.CheckUser(username))
            {
                userid = Consult.AddUser(u);
            }
            else
            {
                MsgBox.Alert(string.Format("用户 {0} 已经注册过,请更换注册账户!", username));
            }
            if (userid > 0)
            {
                EmailConfig defaultMail = Consult.GetDefaultEmailConfig();
                if (Mail.SendMail(defaultMail.MailName, u.Username, string.Format("用户 {0} 的注册成功!", u.Username), string.Format("<p>您在<span style='color:blue;font-size:14px;'>{0}</span>的注册成功。<br />账号:{1}<br />密码:{2}</p></body></html>", Global.__WebSiteName, u.Username, password), defaultMail.Email, defaultMail.Pass, defaultMail.SmtpServer))
                {
                    MsgBox.AlertA(string.Format("用户 {0} 注册成功! 密码已发送到您的邮箱.", username), "location.href=\"http://www.andad.net/\";");
                }
                else
                {
                    MsgBox.AlertA(string.Format("用户 {0} 注册成功! 但是注册信息无法发送到指定邮箱.", username), "location.href=\"http://www.andad.net/\";");
                }
            }
            else
            {
                MsgBox.Alert(string.Format("用户 {0} 注册失败!", u.Username));
            }
        }
Exemple #32
0
        private void Initialize()
        {
            _port = "COM11";
            _data = new ConsultData(new DataEngine());
            _target = new Consult(_data);

            Log.Instance.NewMessage += new EventHandler<NewMessageEventArgs>(Instance_NewMessage);
        }