Exemplo n.º 1
0
        /// <summary>
        /// 网站访问统计
        /// </summary>
        /// <returns></returns>
        public ActionResult WebVisit()
        {
            VisitRecord visitModel = new VisitRecord();

            visitModel.VisitReffer        = Request.QueryString["oldlink"].ToString();
            visitModel.VisitRefferType    = int.Parse(GetVisitReferrerType(Request.QueryString["oldlink"].ToString()));
            visitModel.VisitResolution    = Request.QueryString["s"].ToString();
            visitModel.VisitURL           = Request.QueryString["id"].ToString();
            visitModel.VisitTimeIn        = System.DateTime.Now;
            visitModel.VisitIP            = _services.WebHelper.GetCurrentIpAddress();
            visitModel.VisitOS            = Request.QueryString["sys"].ToString();
            visitModel.VisitTitle         = Request.QueryString["title"].ToString();
            visitModel.VisitBrowerType    = Request.QueryString["b"].ToString();
            visitModel.VisitRefferKeyWork = "";
            visitModel.VisitProvince      = Request.QueryString["p"].ToString();
            visitModel.VisitCity          = Request.QueryString["c"].ToString();


            // 获取source后面的内容]
            string url = Request.QueryString["id"].ToString();

            if (url.IndexOf("fromsource=") > 0)
            {
                int    startindex = url.IndexOf("fromsource=");
                int    endindex   = url.Length - startindex - 11;
                string id         = url.Substring(startindex + 11, endindex);
                visitModel.FromSource = id;
            }
            // 这里执行添加到数据库的操作并返回添加以后ID信息
            this._visitRecordService.Value.InsertVisitRecord(visitModel);
            int newID = visitModel.Id;

            return(Json(newID.ToString(), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
 private void RenderMyViewData(VisitRecord model)
 {
     ViewData.Add("CognitiveChannel", new SelectList(EnumHelper.GetItemValueList <EnumCognitiveChannel>(), "Key", "Value", model.CognitiveChannel));
     ViewData.Add("PriceResponse", new SelectList(EnumHelper.GetItemValueList <EnumPriceResponse>(), "Key", "Value", model.PriceResponse));
     ViewData.Add("VisitWay", new SelectList(EnumHelper.GetItemValueList <EnumVisitWay>(), "Key", "Value", model.VisitWay));
     ViewData.Add("FollowStep", new SelectList(EnumHelper.GetItemValueList <EnumFollowStep>(), "Key", "Value", model.FollowStep));
     ViewData.Add("FollowLevel", new SelectList(EnumHelper.GetItemValueList <EnumFollowLevel>(), "Key", "Value", model.FollowLevel));
 }
Exemplo n.º 3
0
        //
        // GET: /Crm/VisitRecord/Create

        public ActionResult Create()
        {
            var model = new VisitRecord();

            this.RenderMyViewData(model);

            return(View("Edit", model));
        }
Exemplo n.º 4
0
        public VisitRecord GetRecord()
        {
            VisitRecord ret = new VisitRecord();

            ret.title      = DropDownList_type.SelectedItem.Text;
            ret.visit_date = FindPicker(PickerAndCalendar_visitDate).SelectedDate;
            ret.remark     = TextBox_remark.Text;
            return(ret);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="visitRecord"></param>
        /// <returns>添加是否成功</returns>
        public bool Insert(VisitRecord visitRecord)
        {
            //不插入访问时间,数据库自动填充默认值
            var visit = new { visit_record_id = visitRecord.visit_record_id, desk_id = visitRecord.desk_id,
                              consumer_num    = visitRecord.consumer_num };
            string SQL    = SQLBuilder.BuildInsertSQL(visit, TableName);
            int    result = Connection.ExecuteSql(SQL, (Object)visit);

            return(result == 1 ? true : false);
        }
Exemplo n.º 6
0
        protected void Grid_visitRecord_ItemDataBound(object sender, ComponentArt.Web.UI.GridItemDataBoundEventArgs e)
        {
            VisitRecord  r   = (VisitRecord)e.DataItem;
            TdUserResult res = userService.GetUserById(r.user_id);

            if (res.result)
            {
                e.Item.ToArray()[2] = res.user.real_name;
            }
        }
Exemplo n.º 7
0
        public ActionResult Select(int id)
        {
            VisitRecord visitRecord = db.VisitRecords.Find(id);

            if (visitRecord == null)
            {
                return(HttpNotFound());
            }

            return(View(visitRecord));
        }
Exemplo n.º 8
0
        public ActionResult Create()
        {
            var model = new VisitRecord();

            this.RenderMyViewData(model);
            var users = this.IDKLManagerService.GetCustomerList().Select(c => new { CustomerName = c.CustomerName });

            ViewData.Add("CustomerName", new SelectList(users, "CustomerName", "CustomerName"));

            return(View("Edit", model));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Deletes an visitRecord
        /// </summary>
        /// <param name="visitRecord">VisitRecord</param>
        public virtual void DeleteVisitRecord(VisitRecord visitRecord)
        {
            if (visitRecord == null)
            {
                throw new ArgumentNullException("visitRecord");
            }

            _visitRecordRepository.Delete(visitRecord);

            //event notification
            _eventPublisher.EntityDeleted(visitRecord);
        }
Exemplo n.º 10
0
 public void SaveVisitRecord(VisitRecord visitRecord)
 {
     using (var dbContext = new CrmDbContext())
     {
         if (visitRecord.ID > 0)
         {
             dbContext.Update <VisitRecord>(visitRecord);
         }
         else
         {
             dbContext.Insert <VisitRecord>(visitRecord);
         }
     }
 }
        public async Task <IActionResult> Edit(string id, [Bind("VisitReason,Prescription,Visitid,VisitDate,Visited,PatientId,DoctorId")] VisitRecord visitRecord)
        {
            if (id != visitRecord.Visitid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(visitRecord);
                    await _context.SaveChangesAsync();

                    if (visitRecord.Visited == true)
                    {
                        //Clear appointment once patient visits the doctor
                        int patient_id          = visitRecord.PatientId;
                        var appointment_context = _context.Appointment.Where(a => a.PatientId == patient_id).FirstOrDefault();
                        _context.Appointment.Remove(appointment_context);
                        await _context.SaveChangesAsync();

                        var record = new Billing {
                            BillingAmount = 50, BillingDate = DateTime.UtcNow, PatientId = visitRecord.PatientId, Paid = false
                        };
                        _context.Add(record);
                        await _context.SaveChangesAsync();

                        //return RedirectToAction("Create", "Billings");
                        return(RedirectToAction("Index", "VisitRecords"));
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VisitRecordExists(visitRecord.Visitid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorId"]  = new SelectList(_context.Doctor, "DoctorId", "DoctorEmail", visitRecord.DoctorId);
            ViewData["PatientId"] = new SelectList(_context.Patient, "PatientId", "PatientEmail", visitRecord.PatientId);
            return(View(visitRecord));
        }
Exemplo n.º 12
0
        public ActionResult Create(FormCollection collection)
        {
            var model = new VisitRecord();

            this.TryUpdateModel <VisitRecord>(model);

            try
            {
                this.IDKLManagerService.AddVisitRecord(model);
            }
            catch (HYZK.FrameWork.Common.BusinessException e)
            {
                this.ModelState.AddModelError(e.Name, e.Message);
                return(View("Edit", model));
            }

            return(this.RefreshParent());
        }
Exemplo n.º 13
0
        /// <summary>
        /// 新增一条拜访记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_addRecord_Click(object sender, EventArgs e)
        {
            //DataSet ds = new DataSet();
            //dataCommon.GetAllData("select * from _Customers where id=" + CustomerInfo_edit.CustomerId, ds, CustomersData._CUSTOMERS_TABLE);
            //dataCommon.GetAllData("select top 1 * from _VisitRecord", ds, VisitRecordData._VISITRECORD_TABLE);
            //dataCommon.GetAllData(string.Format("select * from _VisitPlan where CustomerId={0} and PlanType=1 and PlanStatus='{1}'", CustomerInfo_edit.CustomerId, CustomerService.PLANSTATUS_PENDING), ds, VisitPlanData._VISITPLAN_TABLE);

            //// 修改客户的最近访问信息 [3/10/2009]
            //DataRow dr_customer = ds.Tables[CustomersData._CUSTOMERS_TABLE].Rows[0];
            //dr_customer[CustomersData.LASTVISITDATE_FIELDS] = DateTime.Now;
            //dr_customer[CustomersData.LASTVISITINFO_FIELDS] = VisitRecordInfo_addVisit.Remark;

            //DataRow dr = ds.Tables[VisitRecordData._VISITRECORD_TABLE].NewRow();
            //dr[VisitRecordData.CUSTOMERID_FIELDS] = CustomerInfo_edit.CustomerId;
            //dr[VisitRecordData.PERSONID_FIELDS] = LoginSession.GetCurrentUser(this).PersonId;
            //dr[VisitRecordData.REMARK_FIELDS] = VisitRecordInfo_addVisit.Remark;
            //dr[VisitRecordData.TITLE_FIELDS] = VisitRecordInfo_addVisit.RecordTitle;
            //dr[VisitRecordData.VISITDATE_FIELDS] = VisitRecordInfo_addVisit.VisitDate;
            //ds.Tables[VisitRecordData._VISITRECORD_TABLE].Rows.Add(dr);
            VisitRecord record = VisitRecordInfo_addVisit.GetRecord();

            record = customerService.AddVisitRecord(the_customer.id, record.title, record.remark, record.visit_date, me.id);
            //foreach (DataRow dr_status in ds.Tables[VisitPlanData._VISITPLAN_TABLE].Rows)
            //{
            //    dr_status[VisitPlanData.PLANSTATUS_FIELDS] = CustomerService.PLANSTATUS_VISITED;
            //}
            //DataRow dr_plan = ds.Tables[VisitPlanData._VISITPLAN_TABLE].NewRow();
            //dr_plan[VisitPlanData.CUSTOMERID_FIELDS] = CustomerInfo_edit.CustomerId;
            //dr_plan[VisitPlanData.PERSONID_FIELDS] = LoginSession.GetCurrentUser(this).PersonId;
            //dr_plan[VisitPlanData.PLANSTATUS_FIELDS] = CustomerService.PLANSTATUS_PENDING;
            //dr_plan[VisitPlanData.PLANTYPE_FIELDS] = CustomerService.PLANTYPE_VISITPLAN;
            //dr_plan[VisitPlanData.REMARK_FIELDS] = TextBox_addVisit_nextVisit.Text;
            //dr_plan[VisitPlanData.VISITPLANDATE_FIELDS] = FindPicker(PickerAndCalendar_addVisitRecord_nextVisit).SelectedDate;
            //ds.Tables[VisitPlanData._VISITPLAN_TABLE].Rows.Add(dr_plan);

            //dataCommon.UpdateData(ds);
            //AddLoadMessage("您成功添加了拜访记录");

            VisitRecordInfo_addVisit.Cleanup();
            CustomerDataBind();
        }
        public async Task <IActionResult> Edit(int id, [Bind("ApptId,ApptDate,AppointmentReason,PatientEmail,PatientId,VisitRecord,DoctorId")] Appointment appointment)
        {
            if (id != appointment.ApptId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (appointment.VisitRecord == true)
                    {
                        var addtovisit = new VisitRecord {
                            DoctorId = appointment.DoctorId, PatientId = (int)appointment.PatientId, Prescription = "N/A", VisitDate = appointment.ApptDate, VisitReason = appointment.AppointmentReason, Visited = false, Visitid = Guid.NewGuid().ToString()
                        };
                        _context.Add(addtovisit);
                        await _context.SaveChangesAsync();
                    }
                    _context.Update(appointment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppointmentExists(appointment.ApptId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorId"]  = new SelectList(_context.Doctor, "DoctorId", "DoctorEmail", appointment.DoctorId);
            ViewData["PatientId"] = new SelectList(_context.Patient, "PatientId", "PatientEmail", appointment.PatientId);
            return(View(appointment));
        }
Exemplo n.º 15
0
        //public string RecordId
        //{
        //    set
        //    {
        //        ViewState["RecordId"] = value;
        //        VisitInfoBind();
        //    }
        //    get
        //    {
        //        if (null == ViewState["RecordId"])
        //            return null;
        //        return ViewState["RecordId"].ToString();
        //    }
        //}
        public void VisitInfoBind(VisitRecord record)
        {
            //if (null == RecordId)
            //    return;

            BaseInfoBind();

            //DataSet ds = new DataSet();
            //dataCommon.GetAllData(string.Format("select * from _VisitRecord where Id={0}", RecordId), ds, VisitRecordData._VISITRECORD_TABLE);

            //if (ds.Tables[VisitRecordData._VISITRECORD_TABLE].Rows.Count == 0)
            //    throw new Exception(string.Format("没有找到ID是{0}的拜访记录", RecordId));

            //DataRow dr = ds.Tables[VisitRecordData._VISITRECORD_TABLE].Rows[0];

            FocusItemByText(DropDownList_type, record.title);
            TextBox_remark.Text = record.remark;
            FindPicker(PickerAndCalendar_visitDate).SelectedDate = record.visit_date;
            //cal_visit = (ComponentArt.Web.UI.Calendar)PickerAndCalendar_visitDate.FindControl("Picker1");
            //cal_visit.SelectedDate = Convert.ToDateTime(dr[VisitRecordData.VISITDATE_FIELDS]);
            //PersonId = dr[VisitRecordData.PERSONID_FIELDS].ToString();
        }
Exemplo n.º 16
0
        private void RenderMyViewData(VisitRecord model, bool isBasic = false)
        {
            ViewData.Add("VisitWay", new SelectList(EnumHelper.GetItemValueList <EnumVisitWay>(), "Key", "Value", model.VisitWay));
            ViewData.Add("FollowLevel", new SelectList(EnumHelper.GetItemValueList <EnumFollowLevel>(), "Key", "Value", model.FollowLevel));
            ViewData.Add("FollowStep", new SelectList(EnumHelper.GetItemValueList <EnumFollowStep>(), "Key", "Value", model.FollowStep));
            ViewData.Add("ProductType", new SelectList(EnumHelper.GetItemValueList <EnumProductType>(), "Key", "Value", model.ProductType));

            ViewData.Add("Focus", new SelectList(EnumHelper.GetItemList <EnumFocus>(), "Key", "Value", (EnumFocus)model.Focus));
            ViewData.Add("CognitiveChannel", new SelectList(EnumHelper.GetItemList <EnumCognitiveChannel>(), "Key", "Value", (EnumCognitiveChannel)model.CognitiveChannel));
            ViewData.Add("PriceResponse", new SelectList(EnumHelper.GetItemValueList <EnumPriceResponse>(), "Key", "Value", model.PriceResponse));
            ViewData.Add("AreaDemand", new SelectList(EnumHelper.GetItemValueList <EnumAreaDemand>(), "Key", "Value", model.AreaDemand));
            ViewData.Add("Motivation", new SelectList(EnumHelper.GetItemValueList <EnumMotivation>(), "Key", "Value", model.Motivation));

            ViewData.Add("ProjectId", new SelectList(this.CrmService.GetProjectList(), "Id", "Name", model.ProjectId));

            if (isBasic)
            {
                return;
            }

            ViewData.Add("CityId", new SelectList(this.CityDic.Values, "Id", "Name", model.CityId));

            if (model.CityId == 0)
            {
                model.CityId = this.CityDic.First().Key;
            }

            var areas = this.AreaDic.Values.Where(a => a.CityId == model.CityId);

            ViewData.Add("AreaId", new SelectList(areas, "Id", "Name", model.AreaId));

            var request = new CustomerRequest();

            request.Customer.UserId = this.UserContext.LoginInfo.UserID;
            var customerList = this.CrmService.GetCustomerList(request).ToList();

            customerList.ForEach(c => c.Name = string.Format("{0}({1})", c.Name, c.Tel));
            ViewData.Add("CustomerId", new SelectList(customerList, "Id", "Name", model.CustomerId));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Session["HostID"] = Request["HostID"].ToString();
            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                VisitRecord vs = new VisitRecord();
                vs.UserID = Session["UserID"].ToString();
                vs.HostID = Session["HostID"].ToString();
                vs.Date   = DateTime.Now.Date;

                db.VisitRecord.InsertOnSubmit(vs);
                db.SubmitChanges();
            }
        }
        Init1();
        Init2();
        Init3();
        Init4();
        Init5();
        Init6();
    }
Exemplo n.º 18
0
        /// <summary>
        /// 插入访问记录,更新桌子状态
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Regex.IsMatch(NumTextBox.Text, @"^\d+\.\d+\z|^\d+\z"))
            {
                //插入访问记录
                VisitRecord visitRecord = new VisitRecord();
                visitRecord.desk_id      = this.desk_id;
                visitRecord.consumer_num = Convert.ToInt32(NumTextBox.Text);
                visitRecordDao.Insert(visitRecord);

                //更新桌子状态
                Desk desk = new Desk();
                desk.desk_id        = this.desk_id;
                desk.current_record = visitRecord.visit_record_id;
                deskDao.SetVisitRecord(desk);

                this.Close();
            }
            else
            {
                MessageBox.Show("请输入数字");
            }
        }
Exemplo n.º 19
0
        public ActionResult Create(FormCollection collection)
        {
            var model = new VisitRecord();

            this.TryUpdateModel <VisitRecord>(model);

            model.CreateTime = model.VisitTime = DateTime.Now;
            model.Username   = this.UserContext.LoginInfo.LoginName;
            model.UserId     = this.UserContext.LoginInfo.UserID;

            try
            {
                this.CrmService.SaveVisitRecord(model);
            }
            catch (BusinessException e)
            {
                this.ModelState.AddModelError(e.Name, e.Message);
                this.RenderMyViewData(model);
                return(View("Edit", model));
            }


            return(this.RefreshParent());
        }
 public ViewModelTreatRegiment(VisitRecord vis)
 {
     visit = vis;
     CurPatient = vis.Patient;
 }