public ActionResult GetUpcomingAppointment() { List<Appointment> appointments = new List<Appointment>(); BidEngine bidEngine = new BidEngine(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); string response = bidEngine.GetAppointmentsJSON(Request.Cookies["sessionkey"].Value, null); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); appointments = (List<Appointment>)Serializer.JSONStringToObject<List<Appointment>>(responseObject.ResultObjectJSON); return PartialView("_UpcomingAppointments", appointments); }
/// <summary> /// Get All appointment of user /// </summary> /// <param name="id">the parameter is just for mainting the menu with static data other wise it is not needed</param> /// <returns></returns> public ActionResult Index() { List<Appointment> appointments = new List<Appointment>(); BidEngine bidEngine = new BidEngine(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); string response = bidEngine.GetAppointmentsJSON(Request.Cookies["sessionkey"].Value, null); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); appointments = (List<Appointment>)Serializer.JSONStringToObject<List<Appointment>>(responseObject.ResultObjectJSON); //string jsonModel = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(responseObject.ResultObjectJSON); // ViewBag.JsonModelList = "[{\"Id\": 173,\"StartDate\": \"2015/09/21 17:45:00\",\"MeetingWith\": \"Charles Brown\"},{\"Id\": 175,\"StartDate\": \"2015/09/22 18:00:00\",\"MeetingWith\": \"Brendon Taylor\"}]"; ViewBag.JsonModelList = responseObject.ResultObjectJSON; return View(appointments); }
public JsonResult FilterAppointment(string pDate = "", string pFilterString = "") { ViewBag.ActiveMenu = "LiAppointments"; List<Appointment> appointments = new List<Appointment>(); BidEngine bidEngine = new BidEngine(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); string response = bidEngine.GetAppointmentsJSON(Request.Cookies["sessionkey"].Value, null); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); appointments = (List<Appointment>)Serializer.JSONStringToObject<List<Appointment>>(responseObject.ResultObjectJSON); appointments.ForEach(m => m.ProposedTimeOfDay = m.ProposedTime.ToString("HH-mm")); return Json(appointments, JsonRequestBehavior.AllowGet); }
/// <summary> /// Action for Get Reolution Detail By ResoluitionID /// </summary> /// <param name="pResolutionID">ID of a resolution of which a detail needs to be get</param> /// <returns></returns> public ActionResult Resolution(int pResolutionID) { //ViewBag.resolutionid = pResolutionID; ResolutionObject resolutionobj = new ResolutionObject(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); BidEngine bidEngine = new BidEngine(); string response = bidEngine.GetResolutionDetailsByIdJSON(Request.Cookies["sessionkey"].Value, pResolutionID.ToString()); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); resolutionobj = (ResolutionObject)Serializer.JSONStringToObject<ResolutionObject>(responseObject.ResultObjectJSON); return PartialView("_Resolution", resolutionobj); //ResoulutionDetailViewModel model = new ResoulutionDetailViewModel(); //model.ProblemBidViewModel.ID = pResolutionID; //model.ProblemBidViewModel.ProblemID = 1; //model.ProblemBidViewModel.UserID = 1; //model.ProblemBidViewModel.Description = "Having good experice of working with electronics"; //model.ProblemBidViewModel.ResolutionMethodID = 1; //model.ProblemBidViewModel.ResolutionMethodName = "Onsite Visit Required"; //model.ProblemBidViewModel.QuickBloxUserID = "5815727"; //model.ProblemBidViewModel.ResolutionLink1 = "http://www.facebook.com"; //model.ProblemBidViewModel.ResolutionLink2 = "http://www.google.com"; //model.ProblemBidViewModel.Amount = 1200M; //model.ProblemBidViewModel.FirstName = "Charles"; //model.ProblemBidViewModel.LastName = "Brown"; //model.ProblemBidViewModel.IsSelected = true; //ResolutionMediaViewModel resolutionMediaViewModel = null; //for (int i = 1; i < 5; i++) //{ // resolutionMediaViewModel = new ResolutionMediaViewModel(); // resolutionMediaViewModel.ID = i; // resolutionMediaViewModel.BidID = 1; // resolutionMediaViewModel.IsImage = true; // resolutionMediaViewModel.ResolutionMediaPath = ServerSettings.WebApplicationURL + "/assets/images/ProblemResolution/" + i.ToString() + ".JPG"; // model.ResolutionMediaViewModelList.Add(resolutionMediaViewModel); //} //for (int i = 5; i < 7; i++) //{ // resolutionMediaViewModel = new ResolutionMediaViewModel(); // resolutionMediaViewModel.ID = i; // resolutionMediaViewModel.BidID = 1; // resolutionMediaViewModel.IsImage = false; // resolutionMediaViewModel.ResolutionMediaPath = ServerSettings.WebApplicationURL + "/upload/video/robotic.mp4"; // model.ResolutionMediaViewModelList.Add(resolutionMediaViewModel); //} //ResolutionProposedTime resolutionProposedTime = null; //resolutionProposedTime = new ResolutionProposedTime(); //resolutionProposedTime.ID = 1; //resolutionProposedTime.BidID = 1; //resolutionProposedTime.ProposedTime = CommonLogic.CDate("10-09-2015 11:35 AM"); //resolutionProposedTime.MeetingType = MEETINGTYPE.FaceToFace.GetHashCode(); //resolutionProposedTime.CreatedByUserID = 1; //resolutionProposedTime.IsSelected = true; //resolutionProposedTime.CreatedBy = "Expert"; //model.ResolutionProposedTimeList.Add(resolutionProposedTime); //resolutionProposedTime = new ResolutionProposedTime(); //resolutionProposedTime.ID = 2; //resolutionProposedTime.BidID = 1; //resolutionProposedTime.ProposedTime = CommonLogic.CDate("10-15-2015 4:45 PM"); //resolutionProposedTime.MeetingType = MEETINGTYPE.Video.GetHashCode(); //resolutionProposedTime.CreatedByUserID = 1; //resolutionProposedTime.IsSelected = true; //resolutionProposedTime.CreatedBy = "Expert"; //model.ResolutionProposedTimeList.Add(resolutionProposedTime); //resolutionProposedTime = new ResolutionProposedTime(); //resolutionProposedTime.ID = 3; //resolutionProposedTime.BidID = 1; //resolutionProposedTime.ProposedTime = CommonLogic.CDate("10-15-2015 4:45 PM"); //resolutionProposedTime.MeetingType = MEETINGTYPE.Video.GetHashCode(); //resolutionProposedTime.CreatedByUserID = 2; //resolutionProposedTime.IsSelected = true; //resolutionProposedTime.CreatedBy = "User"; //model.ResolutionProposedTimeList.Add(resolutionProposedTime); //resolutionProposedTime = new ResolutionProposedTime(); //resolutionProposedTime.ID = 3; //resolutionProposedTime.BidID = 1; //resolutionProposedTime.ProposedTime = CommonLogic.CDate("10-09-2015 11:35 AM"); //resolutionProposedTime.MeetingType = MEETINGTYPE.Video.GetHashCode(); //resolutionProposedTime.CreatedByUserID = 2; //resolutionProposedTime.IsSelected = true; //resolutionProposedTime.CreatedBy = "User"; //model.ResolutionProposedTimeList.Add(resolutionProposedTime); //return PartialView("_Resolution", model); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (cmbService.SelectedValue == "CreateUser") { UserEngine user = new UserEngine(); txtResult.Text = user.CreateUserJSON(txtFirstName.Text, txtLastName.Text, txtDisplayName.Text, txtEmail.Text, txtArea.Text, txtCity.Text, txtPinCode.Text, Convert.ToString(chkUser.Checked), Convert.ToString(chkExpert.Checked), txtCatSubCat.Text, txtPassword.Text, txtDevice.Text); } if (cmbService.SelectedValue == "GetCountries") { string url = baseURL + "?fc=getcountries"; using (WebClient client = new WebClient()) { //client.QueryString.Add("ID", "1040"); //add parameters //client.Credentials = CredentialCache.DefaultCredentials; //I tried to add credentials like this //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#"); txtResult.Text = client.DownloadString(url); } //MasterlistEngine master = new MasterlistEngine(); } if (cmbService.SelectedValue == "GetStates") { string url = baseURL + "?fc=getstates&countryid=3"; using (WebClient client = new WebClient()) { //client.QueryString.Add("ID", "1040"); //add parameters //client.Credentials = CredentialCache.DefaultCredentials; //I tried to add credentials like this //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#"); txtResult.Text = client.DownloadString(url); } //MasterlistEngine master = new MasterlistEngine(); } if (cmbService.SelectedValue == "GetCompanies") { string url = baseURL + "?fc=getcompanies"; using (WebClient client = new WebClient()) { //client.QueryString.Add("ID", "1040"); //add parameters //client.Credentials = CredentialCache.DefaultCredentials; //I tried to add credentials like this //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#"); txtResult.Text = client.DownloadString(url); } //MasterlistEngine master = new MasterlistEngine(); } if (cmbService.SelectedValue == "GetProblems") { string url = baseURL + "?fc=getproblems&sessionkey="+txtSessionKey.Text+"&startindex="+txtStartIndex.Text+"&pagesize="+txtPageSize.Text+"&latitude="+txtLatitude.Text+ "&longitude=" + txtLongitude.Text + "&distance=" + txtDistance.Text + "&categoryid=" + txtCategory.Text + "&subcategoryid=" + txtSubCategory.Text + "&modelno=" +txtModel.Text+"&heading="+txtHeading.Text+"&startdate="+txtStartDate.Text +"&enddate="+txtEndDate.Text; using (WebClient client = new WebClient()) { //client.QueryString.Add("ID", "1040"); //add parameters //client.Credentials = CredentialCache.DefaultCredentials; //I tried to add credentials like this //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#"); txtResult.Text = client.DownloadString(url); } //MasterlistEngine master = new MasterlistEngine(); } if (cmbService.SelectedValue == "GetCategories") { string url = baseURL + "?fc=getcategories"; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "GetProblemStatus") { string url = baseURL + "?fc=getproblemstatus&sessionkey="+txtSessionKey.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "GetProductStatus") { string url = baseURL + "?fc=getproductstatus&sessionkey=" + txtSessionKey.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "GetResolutionMethods") { string url = baseURL + "?fc=getresolutionmethod&sessionkey=" + txtSessionKey.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "GetCurrencies") { string url = baseURL + "?fc=getcurrencies&sessionkey=" + txtSessionKey.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "GetSubCategories") { string url = baseURL + "?fc=getsubcategories&categoryid="+txtCategory.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "GetProducts") { string url = baseURL + "?fc=getproducts&sessionkey="+txtSessionKey.Text +"&categoryid=" + txtCategory.Text+"&subcategoryid="+txtSubCategory.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "CreateSession") { string url = baseURL + "?fc=createsession&emailid="+txtEmail.Text+"&password="******"&devicetoken="+txtDevice.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if(cmbService.SelectedValue =="Logout") { string url = baseURL + "?fc=logout&sessionkey=" + txtSessionKey.Text + "&devicetoken=" + txtDevice.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "GetUserFromSession") { string url = baseURL + "?fc=getuserfromsession&sessionkey=" + txtSessionKey.Text; using (WebClient client = new WebClient()) { txtResult.Text = client.DownloadString(url); } } if (cmbService.SelectedValue == "PostProblem") { ProblemEngine probEngine = new ProblemEngine(); txtResult.Text = probEngine.SaveProblem(txtSessionKey.Text, txtProblemId.Text, "true", txtCompanyId.Text, txtHeading.Text, txtCategory.Text, txtSubCategory.Text, txtProduct.Text, txtModel.Text, txtDescription.Text, txtPurchaseMonth.Text, txtPurchaseYear.Text, txtProductStatus.Text, txtResolutionNeeded.Text, txtHashTags.Text, "false", "true", "","","","","","",""); //string url = baseURL + "?fc=saveproblem&sessionkey=" + txtSessionKey.Text + "&problemid="+txtProblemId.Text+"&companyrelated=true&companyid="+txtCompanyId.Text+"&heading="+txtHeading.Text+ // "&categoryid="+txtCategory.Text+"&subcategoryid="+txtSubCategory.Text+"&productid="+txtProduct.Text+"&modelno="+txtModel.Text+"&description="+txtDescription.Text+ // "&purchasemonth="+txtPurchaseMonth.Text+"&purchaseyear="+txtPurchaseYear.Text+"&productstatus="+txtProductStatus.Text+"&resolutionneededby="+txtResolutionNeeded.Text+ // "&hashtags=" + txtHashTags.Text + "&isvirtual=false&isregisteredaddr=true&address1=&address2=&address3=&city=&countryid=&stateid=&pincode="; //string url = "probfox.azurewebsites.net/webservices/probfox.ashx?fc=saveproblem&sessionkey=A1C95E9E-1FE1-4315-B5DB-CE5983A9DF09&problemid=null&companyrelated=true&companyid=1&problemheading=test&categoryid=1&subcategoryid=1&productid=1&modelno=abc123&description=test%20desc&purchasemonth=01&purchaseyear=2015&productstatus=1&resolutionneededby=null&hashtags=test,test1;&isvirtual=false&isregisteredaddress=true&address1=&address2&address3=&city=&stateid=&countryid=&pincode="; //using (WebClient client = new WebClient()) //{ // txtResult.Text = client.DownloadString(url); //} } if (cmbService.SelectedValue == "UploadFiles") { string fileName = FileUpload1.FileName; string url = fileUploadBaseURL + "?fc=uploadfile&sessionkey=" + txtSessionKey.Text + "&filename=" + fileName + "&filetype=" + txtFileType.Text; WebClient client = new WebClient(); txtResult.Text = client.DownloadString(url); } if (cmbService.SelectedValue == "EditBid") { BidEngine bid = new BidEngine(); //txtResult.Text = bid.SaveBids(txtSessionKey.Text, txtProblemId.Text, null, txtDescription.Text, "1", txtLink1.Text, txtTitle1.Text, txtLink2.Text, txtTitle2.Text, "1", "500", null, "20/09/2015,10:00,11:00;21/09/2015,17:00,19:00", "false"); } }
/// <summary> /// This method is used to upload images and videos. /// </summary> /// <param name="sessionKey">string</param> /// <param name="filename">string</param> /// <param name="context">string</param> /// <param name="filetype">string</param> /// <param name="problemId">string</param> /// <returns>string</returns> public string UploadFiles(string sessionKey, HttpContext context, string fileType, string problemId, string resolutionId) { string retValue = string.Empty; string fileUploadPath = "media"; string newFileName = string.Empty; AuthenticationEngine authEngine = new AuthenticationEngine(); ResponseObjectForAnything obj = new ResponseObjectForAnything(); ProblemEngine probEngine = new ProblemEngine(); BidEngine bidEngine = new BidEngine(); UserEngine user = new UserEngine(); try { bool isValid = true; if (!string.IsNullOrEmpty(sessionKey)) { authEngine.IsValidSession(sessionKey); } if (isValid) { obj.ResultCode = "SUCCESS"; if (Directory.Exists(fileUploadPath) == false) { Directory.CreateDirectory(fileUploadPath); } HttpFileCollection files = context.Request.Files; string[] uplaodedfiles = new string[files.Count]; for (int filecount = 0; filecount < files.Count; filecount++) { HttpPostedFile file = files[filecount]; string fname; if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE" || HttpContext.Current.Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER") { string[] testfiles = file.FileName.Split(new char[] { '\\' }); fname = testfiles[testfiles.Length - 1]; } else { fname = file.FileName; } //fname = System.IO.Path.Combine(context.Server.MapPath("~/uploads/"), fname); newFileName = Guid.NewGuid().ToString() + "_" + fname.Replace(" ", "_"); if (ConfigurationManager.AppSettings["FileUploadPath"] != null) { fileUploadPath = ConfigurationManager.AppSettings["FileUploadPath"].ToString(); } fileUploadPath = context.Server.MapPath("~/" + fileUploadPath + "/"); string sPath = fileUploadPath + newFileName; file.SaveAs(sPath); obj.ResultMessage = newFileName; //if (fileType.ToLower() == "profileimage") { user.SaveUserProfileImage(sessionKey, newFileName); } //else if (fileType.ToLower() == "problemimage") { obj.ResultObjectJSON = probEngine.SaveMedia(sessionKey, problemId, sPath, "image"); } //else if (fileType.ToLower() == "problemvideo") { obj.ResultObjectJSON = probEngine.SaveMedia(sessionKey, problemId, sPath, "video"); } //else if (fileType.ToLower() == "resolutionimage") { obj.ResultObjectJSON = bidEngine.SaveMedia(sessionKey, resolutionId, sPath, "image"); } //else if (fileType.ToLower() == "resolutionvideo") { obj.ResultObjectJSON = bidEngine.SaveMedia(sessionKey, resolutionId, sPath, "video"); } } //Stream objStream = context.Request.InputStream; //StreamReader objStreamReader = new StreamReader(objStream); //// instance a filestream pointing to the //// storage folder, use the original file name //// to name the resulting file //FileStream fs = new FileStream(sPath, FileMode.Create); //// write the memory stream containing the original //// file as a byte array to the filestream //ms.WriteTo(fs); //// clean up //ms.Close(); //fs.Close(); //fs.Dispose(); } } catch (Exception ex) { obj.ResultCode = "ERROR"; obj.ResultMessage = ex.Message.ToString(); CustomException exc = new CustomException(ex.ToString(), this.ToString(), "UploadFiles", System.DateTime.Now); ExceptionManager.PublishException(exc); } retValue = Serializer.ObjectToJSON(obj); return retValue; }