public KeyPayApiV2Client(string baseUrl, AuthenticationDetails authenticationDetails) { var api = new ApiRequestExecutor(baseUrl) { Authenticator = authenticationDetails.Authenticator }; Business = new BusinessFunction(api); PayCategory = new PayCategoryFunction(api); PaySchedule = new PayScheduleFunction(api); Employee = new EmployeeFunction(api); Location = new LocationFunction(api); PayRun = new PayRunFunction(api); LeaveCategory = new LeaveCategoryFunction(api); Report = new ReportFunction(api); Timesheet = new TimesheetFunction(api); User = new UserFunction(api); PayRateTemplates = new PayRateTemplateFunction(api); DeductionCategory = new DeductionCategoryFunction(api); ExpenseCategory = new ExpenseCategoryFunction(api); WorkType = new WorkTypeFunction(api); Document = new DocumentFunction(api); EmployeeGroup = new EmployeeGroupFunction(api); EmployingEntity = new EmployingEntityFunction(api); PaymentSummary = new PaymentSummaryFunction(api); RosterShift = new RosterShiftFunction(api); Manager = new ManagerFunction(api); Kiosk = new KioskFunction(api); TimeAndAttendance = new TimeAndAttendanceFunction(api); Unavailability = new UnavailabilityFunction(api); }
static String GetFunctionName(DocumentFunction function) { switch (function) { case DocumentFunction.Url: return(FunctionNames.Url); case DocumentFunction.UrlPrefix: return(FunctionNames.Url_Prefix); case DocumentFunction.Domain: return(FunctionNames.Domain); case DocumentFunction.RegExp: return(FunctionNames.Regexp); } return(String.Empty); }
// get the function name data and form the data in javascript object public StringBuilder getData(string FunctionName, int ProjectId, string Type) { try { DocumentFunction docFun = doctDto.GetFunctionDetail(FunctionName, ProjectId, Type); //if (docFun.Input == null || docFun.Output == null || docFun.FunctionDescription == null) // return null; string[] response = new string[3]; response[0] = docFun.Input.Trim(); //remove leading and tailing white spaces in get data response[1] = docFun.Output.Trim(); response[2] = docFun.FunctionDescription.Trim(); StringBuilder sbuild = new StringBuilder(); sbuild.Append("{input:\""); sbuild.Append((!string.IsNullOrEmpty(docFun.Input) ? docFun.Input.Trim() : "") + "\","); sbuild.Append("output: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.Output) ? docFun.Output.Trim() : "") + "\","); sbuild.Append("serversidescripting: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.ServerSideScripting) ? docFun.ServerSideScripting.Trim() : "") + "\","); sbuild.Append("database: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.Database) ? docFun.Database.Trim() : "") + "\","); sbuild.Append("service: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.Service) ? docFun.Service.Trim() : "") + "\","); sbuild.Append("linkingmethod: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.LinkingMethod) ? docFun.LinkingMethod.Trim() : "") + "\","); sbuild.Append("procedure: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.Procedure) ? docFun.Procedure.Trim() : "") + "\","); sbuild.Append("tableorview: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.TableorViewUsed) ? docFun.TableorViewUsed.Trim() : "") + "\","); sbuild.Append("functionDescription: \""); sbuild.Append((!string.IsNullOrEmpty(docFun.FunctionDescription) ? docFun.FunctionDescription.Trim() : "") + "\" }"); return(sbuild); } catch (Exception ex) { return(null); } }
public ActionResult saveDocument(Document document) { // if(model.ProjectId=="" || model.MainSection.) // return Redirect("../Document/AddDocument"); string result = ""; StringBuilder client = new StringBuilder(); //client stringBulder is used for holding <ClientSide Type=""> data like wise server,database,service, StringBuilder server = new StringBuilder(); StringBuilder database = new StringBuilder(); StringBuilder service = new StringBuilder(); StringBuilder param = new StringBuilder(); //param is used for holding client,server, database, service data's string commonRow = Request.Form["common_row"]; //used for store added client,server.database, service data's ex: it store client_row0,server_row0,database_row0,service_row0 string[] commonArray = commonRow.Split(','); string clients, servers, databases, services; document.created_by = Request.Form["CreatedBy"]; string created_by = document.created_by; int document_id = 0; document.docFunList = new List <DocumentFunction>(); DocumentDao docDao = new DocumentDao(); try { if (document.Image != null) { List <project> projctList = doctDto.GetProject(); string projectname = projctList.Where(w => w.Id == document.ProjectId).Select(s => s.ProjectName).First(); string AWSAccessKey = ConfigurationManager.AppSettings["AWSAccessKey"].ToString(); string AWSSecretKey = ConfigurationManager.AppSettings["AWSSecretKey"].ToString(); var s3client = new AmazonS3Client(AWSAccessKey, AWSSecretKey, Amazon.RegionEndpoint.USEast1); TransferUtility utility = new TransferUtility(s3client); TransferUtilityUploadRequest request = new TransferUtilityUploadRequest(); Stream inputstream = document.Image.InputStream != null ? document.Image.InputStream : null; string contenttype = "image/jpeg"; string FileName = document.MainSection; string Extension = document.Image.FileName.Split('.')[1]; string bucket = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["imagebucket"]) ? ConfigurationManager.AppSettings["imagebucket"] : string.Empty; FileName = FileName + "." + Extension; request.BucketName = bucket + projectname; request.CannedACL = S3CannedACL.PublicRead; request.Key = FileName; request.InputStream = inputstream; request.ContentType = contenttype; utility.Upload(request); Amazon.S3.IO.S3FileInfo fileinfo = new Amazon.S3.IO.S3FileInfo(s3client, bucket + projectname, Path.GetFileName(FileName)); if (fileinfo.Exists) { document.ImageName = FileName; var res = "success"; } } string root = "<Root>" + "<Document ProjectId=\"" + document.ProjectId + "\" MainSection=\"" + document.MainSection + "\" Controller=\"" + document.Controller + "\" Action=\"" + document.Action + "\" Url=\"" + document.Url + "\" SubSection=\"" + document.SubSection + "\" FunctionalityDescription=\"" + document.FunctionalityDescription + "\" Image=\"" + document.ImageName + "\" >"; clients = "<ClientSide Type=\"" + "Client" + "\">"; servers = "<ServerSide Type =\"" + "server" + "\">"; databases = "<Database Type=\"" + "Database" + "\">"; services = "<Service Type=\"" + "service" + "\"> "; param.Append(root); client.Append(clients); server.Append(servers); database.Append(databases); service.Append(services); foreach (string str in commonArray) { if (string.IsNullOrEmpty(str)) { continue; } DocumentFunction docFun = new DocumentFunction(); docFun.FunctionName = Request.Form[str + "Name"]; if (!string.IsNullOrEmpty(docFun.FunctionName)) { docFun.Input = Request.Form[str + "input"]; docFun.Output = Request.Form[str + "output"]; docFun.FunctionDescription = Request.Form[str + "dDescription"]; docFun.ServerSideScripting = Request.Form[str + "server"]; docFun.Database = Request.Form[str + "database"]; docFun.Service = Request.Form[str + "service"]; docFun.LinkingMethod = Request.Form[str + "linkmethod"]; docFun.Procedure = Request.Form[str + "procedure"]; docFun.TableorViewUsed = Request.Form[str + "tables"]; docFun.CreatedBy = Request.Form["CreatedBy"]; docFun.Type = str.Substring(0, str.IndexOf('_')); //get the function type whether it is client or server or database or service document.docFunList.Add(docFun); string source = "<Source FunctionName=\"" + docFun.FunctionName + "\" FunctionDescription =\"" + docFun.FunctionDescription + "\" Input=\"" + docFun.Input + "\"" + " Output =\"" + docFun.Output + "\" ServerSideScripting =\"" + docFun.ServerSideScripting + "\" Database =\"" + docFun.Database + "\" Service =\"" + docFun.Service + "\" LinkingMethod =\"" + docFun.LinkingMethod + "\" Procedure =\"" + docFun.Procedure + "\" TableorViewUsed =\"" + docFun.TableorViewUsed + "\" />"; if (docFun.Type.ToString() == "client") { client.Append(source); } else if (docFun.Type.ToString() == "server") { server.Append(source); } else if (docFun.Type.ToString() == "database") { database.Append(source); } else if (docFun.Type.ToString() == "service") { service.Append(source); } } } client.Append("</ClientSide>"); server.Append("</ServerSide>"); database.Append("</Database>"); service.Append("</Service>"); param.Append(client); param.Append(server); param.Append(database); param.Append(service); param.Append("</Document></Root>"); result = docDao.InsertNewDocument(param, document.Id, created_by); } catch (Exception e) { } //if (result == "success") // return "success"; //else // return "failed"; if (document != null && document.Id != 0) { return(RedirectToAction("EditDocument", "Document", new { docid = document.Id, from = "update" })); } else { return(RedirectToAction("AddDocument", "Document")); } }