public ActionResult PrepareReport(Libs.ReportRequest rptReq) { Libs.KmoAjaxResult result = new Libs.KmoAjaxResult() { success = false }; try { rptReq.SessionID = Guid.NewGuid().ToString().Replace("-", ""); TempData.Add("rptReq_" + rptReq.SessionID, rptReq); result.data = Url.RouteUrl("Default", new { Controller = "Report", Action = "Index", id = rptReq.SessionID }); result.success = true; } catch (Exception x) { result.message = x.Message; } return(Json(result)); }
public Task <JsonResult> GetLoo(string looId) { return(Task.Factory.StartNew(() => { var returnVal = new Libs.KmoAjaxResult() { success = false }; try { LetterOfOffer.Models.vi_LOO loo = new LetterOfOffer.Models.vi_LOO(); var data = LetterOfOffer.Services.Getloo(Application.AppSettingsValue("HoldingCompany"), looId.Substring(0, 2), looId.Substring(2, 8)); if (data != null) { loo = data; } else { // new loo.CtrId = "XXXXXXXX"; loo.LooId = string.Empty; loo.LooIssue = string.Empty; loo.Cid = string.Empty; loo.CreatedDate = DateTime.Now.Date; loo.CtrDate = DateTime.Now.Date; loo.Status = "WIP"; } //throw new Exception("Raise Error if any"); returnVal.data = loo; returnVal.success = true; } catch (Exception x) { returnVal.message = x.Message; } return Json(returnVal, JsonRequestBehavior.AllowGet); })); }
public Task <JsonResult> GetSuite(string floorId, int suiteId) { return(Task.Factory.StartNew(() => { var returnVal = new Libs.KmoAjaxResult() { success = false }; try { Models.vi_SAS suite = new Models.vi_SAS(); suite = Services.GetSuite(Application.AppSettingsValue("HoldingCompany"), floorId, suiteId); if (suite == null) { // new suite = new Models.vi_SAS(); suite.SuiteOrder = 0; suite.SuiteName = string.Empty; suite.SuiteArea = 0; suite.ElectricityCapacity = 0; suite.Zone = string.Empty; } suite.SuitId = Services.NewSuiteId(Application.AppSettingsValue("HoldingCompany"), Application.GlobalUseApi, floorId); //throw new Exception("Raise Error if any"); returnVal.data = suite; returnVal.success = true; } catch (Exception x) { returnVal.message = x.Message; } return Json(returnVal, JsonRequestBehavior.AllowGet); })); }
public Task <JsonResult> GetCfsPic(string clientIssue, string clientId) { return(Task.Factory.StartNew(() => { var returnVal = new Libs.KmoAjaxResult() { success = false }; try { var data = Services.ListOfPics(Application.AppSettingsValue("HoldingCompany"), clientIssue, clientId); //throw new Exception("Raise Error if any"); returnVal.data = data; returnVal.success = true; } catch (Exception x) { returnVal.message = x.Message; } return Json(returnVal, JsonRequestBehavior.AllowGet); })); }
public Task <JsonResult> GetLoo(string looIssue, string looId) { return(Task.Factory.StartNew(() => { var returnVal = new Libs.KmoAjaxResult() { success = false }; try { Models.vi_LOO loo = new Models.vi_LOO(); var data = Services.Getloo(Application.AppSettingsValue("HoldingCompany"), looIssue, looId); if (data != null) { // revise data.LooIssue = (Convert.ToInt32(data.LooIssue) + 1).ToString().PadLeft(2, '0'); loo = data; } else { // new loo.LooId = Services.NewLOOID(Application.AppSettingsValue("HoldingCompany"), Application.GlobalUseApi); loo.LooIssue = "00"; loo.Cid = string.Empty; loo.LooSubjectDate = DateTime.Now.Date; loo.FittingOutDate = DateTime.Now.Date; loo.AgreementCommencementDate = DateTime.Now.Date; loo.RentCommencementDate = DateTime.Now.Date; loo.ServChargeCommencementDate = DateTime.Now.Date; loo.LeaseExpiryDate = DateTime.Now.Date; loo.FloorCondition = "-"; loo.RentPayableAdvanced = 3; loo.SecurityDepositDuration = 3; loo.ServiceChargeDepositDuration = 3; loo.RentalRate = 0; loo.ServiceCharge = 0; loo.SecurityUnitPrice = 0; loo.ServiceChargeUnitPrice = 0; loo.ParkCarReservedPerUnitPrice = 7000000; loo.ParkCarUnreservedUnitPrice = 4000000; loo.ParkMotorbikeUnitPrice = 150000; loo.TelephoneDepositUnitPrice = 3000000; loo.ParkCarReservedDuration = 1; loo.ParkCarUnreservedDuration = 1; loo.ParkMotorbikeDuration = 1; loo.TelephoneDepositDuration = 1; loo.ParkCarReservedQty = 1; loo.ParkCarUnreservedQty = 1; loo.ParkMotorbikeQty = 1; loo.TelephoneDepositQty = 1; } //throw new Exception("Raise Error if any"); returnVal.data = loo; returnVal.success = true; } catch (Exception x) { returnVal.message = x.Message; } return Json(returnVal, JsonRequestBehavior.AllowGet); })); }
public Task <JsonResult> GetCfs(string clientIssue, string clientId) { return(Task.Factory.StartNew(() => { var returnVal = new Libs.KmoAjaxResult() { success = false }; try { Models.ta_CLIENT1 client = new Models.ta_CLIENT1(); var data = Services.GetClient(Application.AppSettingsValue("HoldingCompany"), clientIssue, clientId); if (data != null) { // revise data.ClientIssue = (Convert.ToInt32(data.ClientIssue) + 1).ToString().PadLeft(2, '0'); client = data; } else { // new client.ClientId = Services.NewClientID(Application.AppSettingsValue("HoldingCompany"), Application.GlobalUseApi); client.ClientIssue = "00"; var lob = "XX"; var propName = "10"; var looYear = client.ClientId.Substring(6, 2); var ctrYear = "00"; var seq = Services.NewCidSequence(Application.GlobalUseApi, looYear); client.Cid = string.Format("{0}-{1}-{2}-{3}-{4}", lob, propName, seq, looYear, ctrYear); client.CreatedDate = DateTime.Now.Date; client.RentStartingDate = DateTime.Now.Date; client.CompanyName = string.Empty; client.CompanyAddress = string.Empty; client.CompanyEmail = string.Empty; client.City = string.Empty; client.ZipCode = string.Empty; client.Telephone = string.Empty; client.RequiredSpaceArea = 0; client.ProposedSuite = string.Empty; client.ProposedArea = 0; client.RentPeriod = 0; client.IspFirstMedia = false; client.IspExcelcomindo = false; client.IspOthers = false; client.IspTelkom = false; client.FreeTax = false; } if (string.IsNullOrEmpty(client.Fax)) { client.Fax = string.Empty; } if (string.IsNullOrEmpty(client.Npwp)) { client.Npwp = string.Empty; } if (string.IsNullOrEmpty(client.LineOfBusinessOthersValue)) { client.LineOfBusinessOthersValue = string.Empty; } if (string.IsNullOrEmpty(client.IspOthersValue)) { client.IspOthersValue = string.Empty; } if (string.IsNullOrEmpty(client.RefCompanyValue)) { client.RefCompanyValue = string.Empty; } if (string.IsNullOrEmpty(client.RefIndividualValue)) { client.RefIndividualValue = string.Empty; } if (string.IsNullOrEmpty(client.RefKmoRentalSignageValue)) { client.RefKmoRentalSignageValue = string.Empty; } if (string.IsNullOrEmpty(client.RefKmoWebsiteValue)) { client.RefKmoWebsiteValue = string.Empty; } if (string.IsNullOrEmpty(client.RefNewspaperValue)) { client.RefNewspaperValue = string.Empty; } if (string.IsNullOrEmpty(client.RefOthersValue)) { client.RefOthersValue = string.Empty; } //throw new Exception("Raise Error if any"); returnVal.data = client; returnVal.success = true; } catch (Exception x) { returnVal.message = x.Message; } return Json(returnVal, JsonRequestBehavior.AllowGet); })); }
public JsonResult ReadReport(string sessionID) { var result = new Libs.KmoAjaxResult() { success = false }; var rptReq = TempData["rptReq_" + sessionID] as Libs.ReportRequest; TempData.Remove("rptReq_" + sessionID); TempData.Add("rptReq_" + sessionID, rptReq); try { if (!TempData.ContainsKey("pdfbin_" + rptReq.SessionID)) { Libs.ReportParameterCollection rptPars; if (!string.IsNullOrEmpty(rptReq.RecordSelectionFormula)) { rptPars = Application.Report_Crpt_BuildParameters(rptReq.ReportName, rptReq.RecordSelectionFormula); } else { rptPars = Application.Report_Crpt_BuildParameters(rptReq.ReportName); } rptPars.AddRange(rptReq.Parameters.ToArray()); var pdfBin = Application.Report_Crpt_BuildRptPdf(rptPars).Result; var base64string = GhostScript.RasterizePdf(pdfBin).ToBase64Strings(); var rptView = new Libs.ReportViewModel(); rptView.CurrentPage = 1; rptView.TotalPage = base64string.Count(); rptView.PageData = base64string[0]; rptView.SessionID = sessionID; result.data = rptView; if (TempData.ContainsKey("pageNumber_" + rptReq.SessionID)) { TempData.Remove("pageNumber_" + rptReq.SessionID); } TempData.Add("pdfbin_" + rptReq.SessionID, pdfBin); TempData.Add("pageNumber_" + rptReq.SessionID, (Int32)1); result.success = true; } else { var pdfBin = (byte[])TempData["pdfbin_" + rptReq.SessionID]; var base64string = GhostScript.RasterizePdf(pdfBin).ToBase64Strings(); var page = base64string[0]; var rptView = new Libs.ReportViewModel(); rptView.CurrentPage = 1; rptView.TotalPage = base64string.Count(); rptView.PageData = base64string[0]; rptView.SessionID = sessionID; result.data = rptView; if (TempData.ContainsKey("pageNumber_" + rptReq.SessionID)) { TempData.Remove("pageNumber_" + rptReq.SessionID); } TempData.Add("pageNumber_" + rptReq.SessionID, (Int32)1); TempData.Remove("pdfbin_" + rptReq.SessionID); TempData.Add("pdfbin_" + rptReq.SessionID, pdfBin); result.success = true; } } catch (Exception x) { result.message = x.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }