public void ProcessRequest(HttpContext context) { var jobNo = context.Request["jobNo"] ?? ""; if (jobNo == "") { return; } JobInfoDetails x = GetJobDetails(jobNo); var js = new JavaScriptSerializer(); context.Response.Write(js.Serialize(x)); }
public JobInitResult RegisterNewJob(JobInitRequest jobInitRequest) { if (fileServer == null) { throw new InvalidOperationException("Sftp server is not configured and started"); } try { // Create a new unique user and a unique directory for that user var newJobGuid = Guid.NewGuid().ToString("N"); var user = new FileServerUser(newJobGuid, password); Debug.Assert(user != null); var di = GetJobDirectory(newJobGuid); di.Create(); // Create a sftp file system object and assign it to the user. var localFileSystem = CreateFileSystem(di.FullName); user.SetFileSystem(localFileSystem); lock (fileServerLock) { fileServer.Users.Add(user); } var jobInitResult = new JobInitResult { JobGuid = newJobGuid, User = user.Name, Password = password, UploadUrl = baseAddress, Port = port }; // Add the information about the job to our local in memory storage var jobInfoDetails = new JobInfoDetails { Request = jobInitRequest, Result = jobInitResult }; jobStorage.AddOrUpdate(newJobGuid, jobInfoDetails, (k, v) => v); return(jobInitResult); } catch (Exception e) { Log.Error(e, e.Message); return(new JobInitResult { IsInvalid = true, ErrorMessage = e.Message }); } }
public JobInfoDetails GetJobDetails(string jobNo) { if (jobNo.Contains("|")) { var qry = new StringBuilder("Select JobNo From tblCnF_JobInfo Where JobId='" + jobNo + "'"); jobNo = DataHelper.GetData(qry.ToString()).Tables[0].Rows[0][0].ToString(); } var query = new StringBuilder("Select top 1 a.JobNo,a.JobYear,a.JobType,b.CompanyBranchName,c.AccountsRegisterName, a.PartyId,a.JobDate,0 As JobBillAmount,d.CompanyName From "); query.Append(" tblCnF_JobInfo As a Inner Join tblGS_ComanyBranchInfo As b On a.BranchId = b.CompanyBranchID "); query.Append(" Inner Join tblACC_AccountsRegister As c On a.PartyId = c.AccountsRegisterId "); query.Append(" Inner Join tblGS_CompanyInfo d On a.CompanyId=d.CompanyID "); query.Append(" where a.JobNo = '" + jobNo + "' "); var data = DataHelper.GetData(query.ToString()).Tables[0]; JobInfoDetails x = new JobInfoDetails(); if (data != null && data.Rows.Count > 0) { x = new JobInfoDetails() { JobNo = data.Rows[0][0].ToString(), Year = data.Rows[0][1].ToString(), Type = data.Rows[0][2].ToString(), Branch = data.Rows[0][3].ToString(), PartyName = data.Rows[0][4].ToString(), PartyId = data.Rows[0][5].ToString(), JobDate = DateTime.Parse(data.Rows[0][6].ToString()), JobBillAmount = double.Parse(data.Rows[0][7].ToString()), CompanyName = data.Rows[0][8].ToString() }; } return(x); }