private void Gv_CellEndEdit(object sender, DataGridViewCellEventArgs e) { //do your checks to see RowIndex is not -1 and other good stuffs //var row = gv.Rows[e.RowIndex]; try { int rowIdx = e.RowIndex; int colIdx = e.ColumnIndex - 1; DataGridView senderGrid = (DataGridView)sender; decimal packingSize = 0; decimal.TryParse(dtOrderItem.Rows[rowIdx][ConstColumns.PACKING_SIZE].ToString(), out packingSize); switch (senderGrid.Columns[e.ColumnIndex].Name) { case "qty": dtOrderItem.Rows[rowIdx][ConstColumns.WGH] = MyExtension.ToInt32(dtOrderItem.Rows[rowIdx][ConstColumns.QTY].ToString()) * packingSize; break; case "wgh": if (packingSize == 0) { break; } dtOrderItem.Rows[rowIdx][ConstColumns.QTY] = RoundQty(MyExtension.ToDecimal(dtOrderItem.Rows[rowIdx][ConstColumns.WGH].ToString()) / packingSize); break; } dtOrderItem.AcceptChanges(); gv.Refresh(); //row.Cells[e.ColumnIndex].OwningColumn.Name ##getName } catch (Exception) { throw; } }
public HttpResponseMessage schedulebydoctorid(HttpRequestMessage request, int docid = 0, int hospitalid = 0, DateTime?appDate = null, string Type = null) { List <tbScheduleData> result = null; if (Type == null) { var today = MyExtension.getLocalTime(DateTime.UtcNow).Date; var nextsevenday = today.AddDays(7); result = scheduleRepo.GetWithoutTracking().Where(a => a.DoctorID == docid && a.HospitalID == hospitalid && a.IsDeleted != true && a.AppointmentDatetime >= today && a.AppointmentDatetime <= nextsevenday).ToList(); } else if (Type == "next") { DateTime nextDate = appDate.Value.AddDays(7); DateTime nextSevenDate = nextDate.AddDays(7); nextDate = nextDate.Date; nextSevenDate = nextSevenDate.Date; result = scheduleRepo.GetWithoutTracking().Where(a => a.DoctorID == docid && a.HospitalID == hospitalid && a.IsDeleted != true && a.AppointmentDatetime >= nextDate && a.AppointmentDatetime <= nextSevenDate).ToList(); } else if (Type == "prev") { DateTime prevDate = appDate.Value.Date; DateTime prevSevenDate = prevDate.AddDays(-7); prevSevenDate = prevSevenDate.Date; result = scheduleRepo.GetWithoutTracking().Where(a => a.DoctorID == docid && a.HospitalID == hospitalid && a.IsDeleted != true && a.AppointmentDatetime >= prevSevenDate && a.AppointmentDatetime <= prevDate).ToList(); } return(request.CreateResponse <List <tbScheduleData> >(HttpStatusCode.OK, result)); }
static void Main(string[] args) { MyExtension ext = new MyExtension(); ext.MyEvent += ext_MyEvent; ext.Dosomething(); Console.ReadLine(); }
public async Task <ActionResult> _hospitalList(int doctorID, int hospitalID = 0, DateTime?AppointmentDate = null) { AppointmentDate = MyExtension.getLocalTime(DateTime.UtcNow); IEnumerable <HospitalSchedules> hospitalList = await HospitalApiRequestHelper.scheduledHospitalList(doctorID, hospitalID, AppointmentDate); return(PartialView("_hospitalList", hospitalList)); }
private static WorkflowApplication GetApp() { // Create a new workflow Activity workflow1 = new Workflow1(); // Create a new host WorkflowApplication app = new WorkflowApplication(workflow1); SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["Demos"].ConnectionString); // Delete all when workflow instance is terminated // store.InstanceCompletionAction = InstanceCompletionAction.DeleteAll; // Pomote extensions properties (InstancePromotedPropertiesTable) store.Promote("MyExtension", MyExtension.GetValuesToPromote(), null); app.InstanceStore = store; // Add extension MyExtension extension = new MyExtension(); app.Extensions.Add(extension); app.PersistableIdle = PersistableIdle; app.Unloaded = Unloaded; return(app); }
public void ExplicitTaskReturn() { var ext = new MyExtension(); var prog = TestHelpers.NewJobHost <TestProg>(ext); prog.Call("ExplicitTaskReturn"); ext.AssertFromAlpha("alpha"); }
public void ExplicitReturnWins() { var ext = new MyExtension(); var prog = TestHelpers.NewJobHost <TestProg>(ext); prog.Call("ExplicitReturnWins", new { trigger = "trigger" }); ext.AssertFromAlpha("triggeralpha"); }
protected override void Initialize() { DTE dte = (DTE)base.GetService(typeof(DTE)); var txtMgr = (IVsTextManager)base.GetService(typeof(SVsTextManager)); plugin = new MyExtension(dte, txtMgr); base.Initialize(); }
public void ImplicitTaskReturn() { var ext = new MyExtension(); var prog = TestHelpers.NewJobHost <TestProg>(ext); prog.Call("ImplicitTaskReturn", new { trigger = "trigger" }); ext.AssertFromBeta("triggerbeta"); }
public void TestIndexError() { var ext = new MyExtension(); var prog = TestHelpers.NewJobHost <TestProgErrors>(ext); TestHelpers.AssertIndexingError(() => prog.Call("Error"), "TestProgErrors.Error", "Functions must return Task or void, have a binding attribute for the return value, or be triggered by a binding that natively supports return values."); }
public void DeleteCookie() { if (Request.Cookies["mc"] != null) { HttpCookie myCookie = new HttpCookie("mc"); myCookie.Expires = MyExtension.getLocalTime(DateTime.UtcNow).AddDays(-1); Response.Cookies.Add(myCookie); } }
public ActionResult LogOut() { FormsAuthentication.SignOut(); RemoveCookie("accCookie"); Response.Cookies["accCookie"].Expires = MyExtension.getLocalTime(DateTime.UtcNow).AddYears(-30); Session.Clear(); return(RedirectToAction("Login", "Account")); }
private void UpdateOnlineData(string _key, object _data, Player _player) { if (_player != null) { Debug.Log("Photon " + _player.NickName + " update " + _key); _player.SetCustomProperties(MyExtension.WrapToHash(new object[] { _key, _data })); } }
public void SetCookie(string CookieName, int AccountId, string UserName, string Role) { HttpCookie myCookie = HttpContext.Request.Cookies[CookieName] ?? new HttpCookie(CookieName); myCookie.Values["AccountID"] = AccountId.ToString(); myCookie.Values["UserName"] = UserName; myCookie.Values["Role"] = Role; myCookie.Expires = MyExtension.getLocalTime(DateTime.UtcNow).AddDays(30); HttpContext.Response.Cookies.Add(myCookie); }
public HttpResponseMessage UpSertDOctor(HttpRequestMessage request, tbDoctor doc) { tbDoctor UpdatedEntity = new tbDoctor(); IPhoto iPhoto = new AzurePhotoUpload(); if (doc.ID > 0) { tbSpecialty specialty = specialityRepo.GetWithoutTracking().Where(s => s.ID == doc.SpecialityID).FirstOrDefault(); if (specialty != null) { doc.SpecialityID = doc.SpecialityID; doc.Specialty = specialty.Specialty; } tbDoctor doctor = doctorRepo.GetWithoutTracking().Where(d => d.ID == doc.ID).FirstOrDefault(); if (doc.Image == null) { doc.Photo = doctor.Photo; } else { doc.Photo = iPhoto.uploadPhoto(doc.Image); doc.Image = null; } UpdatedEntity = doctorRepo.UpdatewithObj(doc); } else { var result = (from t in dbContext.tbDoctors where t.Phone == doc.Phone select t).Any(); if (result == false) { tbSpecialty specialty = specialityRepo.Get().Where(s => s.ID == doc.SpecialityID).FirstOrDefault(); if (specialty != null) { doc.SpecialityID = doc.SpecialityID; doc.Specialty = specialty.Specialty; } doc.IsDeleted = false; doc.Accesstime = MyExtension.getLocalTime(DateTime.UtcNow); if (doc.Image != null) { doc.Photo = iPhoto.uploadPhoto(doc.Image); doc.Image = null; } UpdatedEntity = doctorRepo.AddWithGetObj(doc); } else { UpdatedEntity.SystemStatus = "E002"; // } } return(request.CreateResponse <tbDoctor>(HttpStatusCode.OK, UpdatedEntity)); }
public bool RemoveCookie(String CookieName) { if (HttpContext.Request.Cookies[CookieName] != null) { HttpCookie myCookie = HttpContext.Request.Cookies[CookieName]; myCookie.Expires = MyExtension.getLocalTime(DateTime.UtcNow).AddDays(-1); HttpContext.Response.Cookies.Add(myCookie); return(true); } return(false); }
public HttpResponseMessage bookinglist(HttpRequestMessage request, string name = null, string status = null, int pagesize = 10, int page = 1, DateTime?datetime = null, DateTime?time = null, int hospitalid = 2, int doctorid = 0) { DateTime?newdate = null; Expression <Func <tbAppointment, bool> > namefilter, statusfilter, hospitalidfilter, doctoridfilter = null; if (name != null) { namefilter = l => l.PatientName.Contains(name); } else { namefilter = l => l.IsDeleted != true; } if (status != null) { statusfilter = l => l.Status == status; } else { statusfilter = l => l.IsDeleted != true; } if (hospitalid > 0) { hospitalidfilter = l => l.HospitalId == hospitalid; } else { hospitalidfilter = l => l.IsDeleted != true; } if (doctorid > 0) { doctoridfilter = l => l.DoctorId == doctorid; } else { doctoridfilter = l => l.IsDeleted != true; } IQueryable <tbAppointment> result = null; if (time != null) { result = appointmentRepo.GetWithoutTracking().Where(a => a.IsDeleted != true && a.Status != "CHECKOUT" && a.Status != "CANCEL" /*&& a.AppointmentDateTime.Value.Day == time.Value.Day*/ && a.AppointmentDateTime == time).Where(hospitalidfilter).Where(doctoridfilter); } else { newdate = MyExtension.getLocalTime(DateTime.UtcNow).Date; result = appointmentRepo.GetWithoutTracking().Where(a => a.IsDeleted != true && a.AppointmentDateTime >= newdate && a.Status != "CHECKOUT" && a.Status != "CANCEL").Where(namefilter).Where(statusfilter).Where(hospitalidfilter); } PagedListServer <tbAppointment> model = new PagedListServer <tbAppointment>(result.OrderBy(a => a.IsEmergency).OrderBy(a => a.Accesstime).OrderBy(a => a.Position), pagesize, page); dbContext.Dispose(); return(request.CreateResponse <PagedListServer <tbAppointment> >(HttpStatusCode.OK, model)); }
public void ExplicitReturnWins() { var ext = new MyExtension(); IHost host = new HostBuilder() .ConfigureDefaultTestHost <TestProg>(b => { b.AddExtension(ext); }) .Build(); host.GetJobHost <TestProg>().Call("ExplicitReturnWins", new { trigger = "trigger" }); ext.AssertFromAlpha("triggeralpha"); }
public void ExplicitTaskReturn() { var ext = new MyExtension(); IHost host = new HostBuilder() .ConfigureDefaultTestHost <TestProg>(b => { b.AddExtension(ext); }) .Build(); host.GetJobHost <TestProg>().Call("ExplicitTaskReturn"); ext.AssertFromAlpha("alpha"); }
public void ImplicitTaskReturn() { var ext = new MyExtension(); IHost host = new HostBuilder() .ConfigureDefaultTestHost <TestProg>(b => { b.AddExtension(ext); }) .Build(); host.GetJobHost <TestProg>().Call("ImplicitTaskReturn", new { trigger = "trigger" }); ext.AssertFromBeta("triggerbeta"); }
public void TestIndexError() { var ext = new MyExtension(); IHost host = new HostBuilder() .ConfigureDefaultTestHost <TestProgErrors>(b => { b.AddExtension(ext); }) .Build(); TestHelpers.AssertIndexingError(() => host.GetJobHost <TestProgErrors>().Call("Error"), "TestProgErrors.Error", "Functions must return Task or void, have a binding attribute for the return value, or be triggered by a binding that natively supports return values."); }
public HttpResponseMessage scheduleListbyDoctorID(HttpRequestMessage request, int doctorid = 0, string docname = null, int hospitalid = 0, DateTime?date = null) { if (date != null) { date = date.Value.Date; } else { date = MyExtension.getLocalTime(DateTime.UtcNow).Date; } var result = dbContext.tbScheduleDatas.Where(a => a.IsDeleted != true && a.DoctorID == doctorid && a.HospitalID == hospitalid && a.AppointmentDatetime >= date).ToList(); return(request.CreateResponse <List <tbScheduleData> >(HttpStatusCode.OK, result)); }
public void SetCookie(int ID, string Name, string Username, string Role, int HospitalID, string HospitalName) { HttpCookie myCookie = HttpContext.Request.Cookies["mc"] ?? new HttpCookie("mc"); myCookie.Values["ID"] = ID.ToString(); myCookie.Values["Name"] = HttpUtility.UrlEncode(Name.ToString()); myCookie.Values["Username"] = HttpUtility.UrlEncode(Username.ToString()); // myCookie.Values["ServiceName"] = ServiceName.ToString(); myCookie.Values["Role"] = Role.ToString(); myCookie.Values["HospitalID"] = HospitalID.ToString(); myCookie.Values["HospitalName"] = Server.UrlEncode(HospitalName.ToString()); myCookie.Expires = MyExtension.getLocalTime(DateTime.UtcNow).AddDays(1); HttpContext.Response.Cookies.Add(myCookie); }
protected override void Execute(CodeActivityContext context) { // Get extension MyExtension extension = context.GetExtension <MyExtension>(); // Test if (extension == null) { return; } //Use extension.Name = "Set in workflow"; extension.Id = Guid.NewGuid(); extension.Date = DateTime.Now; }
public HttpResponseMessage Upsert(HttpRequestMessage request, tbSchedule schedule) { tbSchedule UpdatedEntity = null; if (schedule.ID > 0) { UpdatedEntity = scheduleRepo.UpdatewithObj(schedule); } else { schedule.Accesstime = MyExtension.getLocalTime(DateTime.UtcNow); schedule.IsDeleted = false; UpdatedEntity = scheduleRepo.AddWithGetObj(schedule); } return(request.CreateResponse <tbSchedule>(HttpStatusCode.OK, UpdatedEntity)); }
public async Task <ActionResult> _scheduleListbyDoctorID(int doctorid = 0, string docname = null, DateTime?date = null) { int hospitalid = Helper.CookieHelper.getstaffHospitalID(); List <tbScheduleData> result = await BookingApiRequestHelper.scheduleListbyDoctorID(doctorid, docname, hospitalid, date); ViewBag.docid = doctorid; ViewBag.docname = docname; if (date != null) { ViewBag.Date = date.Value.Date; } else { ViewBag.Date = MyExtension.getLocalTime(DateTime.UtcNow); } return(PartialView("_scheduleListbyDoctorID", result)); }
public async Task <ActionResult> _list(int id = 0, string docname = null, DateTime?fromdate = null, DateTime?todate = null, int pagesize = 10, int page = 1) { int hospitalid = CareMeClient.Helper.CookieHelper.getstaffHospitalID(); if (fromdate != null && todate != null) { ViewBag.appDate = MyExtension.getLocalTime(DateTime.UtcNow); PagedListClient <ScheduleDoctorViewModel> result = await ScheduleApiRequestHelper.list(id, docname, fromdate, todate, pagesize, page, hospitalid); return(PartialView("_searchList", result)); } else { ViewBag.appDate = MyExtension.getLocalTime(DateTime.UtcNow); PagedListClient <ScheduleDoctorViewModel> result = await ScheduleApiRequestHelper.list(id, docname, fromdate, todate, pagesize, page, hospitalid); return(PartialView("_DoctorScheduleList", result)); } }
public HttpResponseMessage scheduledHospitalList(HttpRequestMessage request, int doctorID, int hospitalID = 0, DateTime?AppointmentDate = null) { Expression <Func <tbHospital, bool> > hospitalfilter; Expression <Func <tbScheduleData, bool> > hospitalSDfilter; Expression <Func <tbScheduleData, bool> > appointmentDateFilter; if (hospitalID > 0) { hospitalfilter = h => h.ID == hospitalID; hospitalSDfilter = h => h.HospitalID == hospitalID; } else { hospitalfilter = h => h.IsDeleted != true; hospitalSDfilter = h => h.IsDeleted != true; } if (AppointmentDate != null) { DateTime stdate = AppointmentDate.Value.Date; DateTime eddate = AppointmentDate.Value.Date.AddDays(1); appointmentDateFilter = a => a.AppointmentDatetime >= stdate && a.AppointmentDatetime <= eddate; } else { appointmentDateFilter = a => a.IsDeleted != true; } var now = MyExtension.getLocalTime(DateTime.UtcNow); List <HospitalSchedules> result = (from h in dbContext.tbHospitals.Where(a => a.IsDeleted != true).Where(hospitalfilter) join hsd in dbContext.tbScheduleDatas.Where(a => a.IsDeleted != true && a.DoctorID == doctorID && a.AppointmentDatetime >= now) .Where(hospitalSDfilter) on h.ID equals hsd.HospitalID //.Where(appointmentDateFilter) select new HospitalSchedules { tbHospital = h, scheduleDataList = dbContext.tbScheduleDatas.Where(a => a.IsDeleted != true && a.DoctorID == doctorID && a.HospitalID == h.ID && a.AppointmentDatetime > now) .Where(hospitalSDfilter).OrderBy(a => a.AppointmentDatetime).ToList(), //.Where(appointmentDateFilter) }).DistinctBy(h => h.tbHospital.ID).ToList(); return(request.CreateResponse <List <HospitalSchedules> >(HttpStatusCode.OK, result)); }
public HttpResponseMessage UpsertDoctor(HttpRequestMessage request, tbHospital hospital) { string result = null; tbHospital UpdateEntity = null; if (hospital.Image != null) { result = iPhoto.uploadPhoto(hospital.Image); } else { result = null; } if (hospital.ID > 0) { if (hospital.Image == null) { tbHospital hos = dbContext.tbHospitals.Where(a => a.IsDeleted != true && a.ID == hospital.ID).FirstOrDefault(); hospital.Photo = hos.Photo; } else { hospital.Photo = result; } hospital.Image = null; UpdateEntity = hospitalRepo.UpdatewithObj(hospital); } else { hospital.Photo = result; hospital.Image = null; hospital.IsDeleted = false; hospital.Accesstime = MyExtension.getLocalTime(DateTime.UtcNow); UpdateEntity = hospitalRepo.AddWithGetObj(hospital); } return(request.CreateResponse <tbHospital>(HttpStatusCode.OK, UpdateEntity)); }
public bool checkBookingAvailable(int ScheduleDataID) { var result = false; var Now = MyExtension.getLocalTime(DateTime.UtcNow); using (var ctx = new CaremeDBContext()) { var scheduledata = ctx.tbScheduleDatas.Where(a => a.IsDeleted != true && a.ID == ScheduleDataID && a.IsStopped != true && a.IsCancelled != true).FirstOrDefault(); if (scheduledata != null) { if (scheduledata.AppointmentDatetime > Now) { int reachedPTCount = scheduledata.ReachedPatientCount ?? 0; int maxPTCount = scheduledata.MaxPatientCount ?? 0; int count = maxPTCount - reachedPTCount; if (count > 0) { result = true; } else { result = false; } } else { result = false; } } else { result = false; } } return(result); }