public override string GetInformation() { // LOCAL VARIABLES int i; // Counter to for(). string s = string.Empty; s += "\n\t\tName: " + Name; s += "\n\t\tTitle: " + Title; s += "\n\t\tCompany: " + CompanyName; s += "\n\t\tCompany ID: " + CompanyId.ToString(); s += "\n\t\tList of Languages:"; if (_languages.Count > 0) { for (i = 0; i < _languages.Count; i++) { s += "\n\t\t\t" + _languages[i]; } } else { s += "\n\t\t\tNULL\n"; } return(s); }
public ActionResult UserPermission(Permissionviewmodel vm, string Search, string Save) { List <string> result = new List <string>(); PermissionMaster _master = new PermissionMaster(); List <ModulePermission> p = new List <ModulePermission>(); Permissionviewmodel searchmodel = new Permissionviewmodel(); Guid CompanyId = new Guid(); if (Request.Cookies["CompanyId"] != null) { CompanyId = new Guid(Commonhelper.GetCookie("CompanyId")); } if (vm.PermissionMaster != null) { _master.Id = Guid.NewGuid().ToString(); _master.CompanyId = CompanyId.ToString(); _master.UserId = vm.PermissionMaster.UserId; _master.CreatedBy = User.Identity.GetUserId(); _master.DateCreated = DateTime.Now; _master.Workstation = Commonhelper.GetStation(); } if (vm.Menumaster.Count() > 0) { foreach (var item in vm.Menumaster) { foreach (var child in item._SubMenumaster) { if (child.IsAdd == true || child.IsEdit == true || child.Isview == true || child.Isdelete == true) { ModulePermission mp = new ModulePermission(); mp.Id = Guid.NewGuid().ToString(); mp.MenuId = item.MenuId; mp.SubMenuId = child.SubMenumasterId; mp.IsAdd = child.IsAdd; mp.IsEdit = child.IsEdit; mp.Isview = child.Isview; mp.Isdelete = child.Isdelete; mp.DisplayOrder = child.order; mp.Displayclass = child.Displayclass; mp.DisplayName = child.DisplayName; _master._ModulePermission.Add(mp); } } } try { Commonhelper.SavePermission(_master); return(Content("<script language='javascript' type='text/javascript'>alert('permission saved successfully!');</script>")); } catch (Exception ex) { } } return(Json(result, JsonRequestBehavior.AllowGet)); ///return View(); }
// /// <summary> /// Create a 'to string'. /// </summary> public override string ToString() { // StringBuilder _return = new StringBuilder("record:["); _return.AppendFormat("Id: {0}, ", Id); _return.AppendFormat("UserName: {0}, ", UserName); _return.AppendFormat("Email: {0}, ", Email); _return.AppendFormat("FirstName: {0}, ", FirstName); _return.AppendFormat("LastName: {0}, ", LastName); _return.AppendFormat("FullName: {0}, ", FullName); _return.AppendFormat("UserNicName: {0}, ", UserNicName); _return.AppendFormat("CompanyId: {0}, ", CompanyId.ToString()); _return.AppendFormat("CreateDate: {0}, ", CreateDate.ToString()); _return.AppendFormat("EmailConfirmed: {0}, ", EmailConfirmed.ToString()); _return.AppendFormat("PhoneNumber: {0}, ", PhoneNumber); _return.AppendFormat("PhoneNumberConfirmed: {0}, ", PhoneNumberConfirmed.ToString()); _return.AppendFormat("TwoFactorEnabled: {0}, ", TwoFactorEnabled.ToString()); if (LockoutEndDateUtc.HasValue) { _return.AppendFormat("LockoutEndDateUtc: {0}, ", LockoutEndDateUtc.ToString()); } else { _return.AppendFormat("/LockoutEndDateUtc/, "); } _return.AppendFormat("LockoutEnabled: {0}, ", LockoutEnabled.ToString()); _return.AppendFormat("AccessFailedCount: {0}]", AccessFailedCount.ToString()); return(_return.ToString()); }
public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); userIdentity.AddClaim(new Claim(nameof(CompanyId), CompanyId.ToString())); // Add custom user claims here return(userIdentity); }
// /// <summary> /// Create a 'to string'. /// </summary> public override string ToString() { // StringBuilder _return = new StringBuilder("record:["); _return.AppendFormat("CompanyId: {0}, ", CompanyId.ToString()); _return.AppendFormat("CompanyName: {0}, ", CompanyName); _return.AppendFormat("]"); return(_return.ToString()); }
public override Dictionary <string, string> ToDictionary() { var parameters = new Dictionary <string, string>(); parameters.Add("{protocol}", Protocol); parameters.Add("{cdn}", CDN); parameters.Add("{companyId}", CompanyId.ToString()); parameters.Add("{domain}", Domain); return(parameters); }
public ICollection <Claim> GetUserClaims() { var claims = new List <Claim>(); claims.Add(new Claim(SaleManagementClaimTypes.Version, CurrentClaimsVersion.ToString())); claims.Add(new Claim(ClaimTypes.NameIdentifier, Id)); claims.Add(new Claim(ClaimTypes.Name, Name)); claims.Add(new Claim(SaleManagementClaimTypes.CompanyId, CompanyId.ToString())); claims.Add(new Claim(SaleManagementClaimTypes.IdentityType, IdentityType.ToString())); return(claims); }
public override async Task <SyncResult> Receive(Guid token) { try { using (HttpClient client = new HttpClient()) { client.Init(token); var query = HttpUtility.ParseQueryString(string.Empty); query["companyId"] = CompanyId.ToString(); query["clientMac"] = MobileCommon.MachineMac; HttpResponseMessage response = await client.GetAsync($"api/LemAP?{query.ToString()}"); if (response.IsSuccessStatusCode) { UpdateStatus(EnumTableSyncStatus.Receiving); List <LemAP> list = await response.Content.ReadAsAsync <List <LemAP> >(); list.ForEach(x => { BeforeReceiveRecord(x.MatchId); string sql = $"insert LemAp(MatchId, CompanyId, ProjectId, InvoiceDate, LogHeaderId, InvoiceNum, SupplierCode, PONum, InvoiceAmount, MarkupAmount, BillAmount, SyncStatus) " + $"values({x.MatchId}, {x.CompanyId}, {x.ProjectId}, '{x.InvoiceDate}', null, '{x.InvoiceNum}', '{x.SupplierCode}', '{x.PONum}', {x.InvoiceAmount}, {x.MarkupAmount}, {x.BillAmount}, '{EnumRecordSyncStatus.Receiving}'); " + $"Select CAST(SCOPE_IDENTITY() AS INT);"; int mid = Convert.ToInt32(MobileCommon.ExecuteScalar(sql)); foreach (var d in x.DetailList) { sql = $"insert LemAPDetail(MatchId, CompanyId, LemAPId, LineNum, Description, Reference, Amount, MarkupPercent, MarkupAmount, BillAmount, Level1Id, Level2Id, Level3Id, Level4Id) " + $"values({d.MatchId}, {d.CompanyId}, {mid}, {d.LineNum}, '{d.Description}', '{d.Reference}', {d.Amount}, {d.MarkupPercent}, {d.MarkupAmount}, {d.BillAmount}, " + $"{StrEx.ValueOrNull(d.Level1Id)}, {StrEx.ValueOrNull(d.Level2Id)}, {StrEx.ValueOrNull(d.Level3Id)}, {StrEx.ValueOrNull(d.Level4Id)});"; MobileCommon.ExecuteNonQuery(sql); } }); UpdateStatus(EnumTableSyncStatus.CompleteReceive); return(new SyncResult { Successful = true }); } throw new Exception($"Response StatusCode={response.StatusCode}"); } } catch (Exception e) { UpdateStatus(EnumTableSyncStatus.ErrorInReceive); return(new SyncResult { Successful = false, Task = TableName, Message = e.Message }); } }
public override async Task <SyncResult> Receive(Guid token) { try { using (HttpClient client = new HttpClient()) { client.Init(token); var query = HttpUtility.ParseQueryString(string.Empty); query["companyId"] = CompanyId.ToString(); query["clientMac"] = MobileCommon.MachineMac; query["contactId"] = LoginUser.CurrUser.MatchId.ToString(); HttpResponseMessage response = await client.GetAsync($"api/LabourTimeEntry?{query.ToString()}"); if (response.IsSuccessStatusCode) { UpdateStatus(EnumTableSyncStatus.Receiving); var list = await response.Content.ReadAsAsync <List <LabourTimeEntry> >(); list.ForEach(x => { BeforeReceiveRecord(x.MatchId); string sql = $"insert LabourTimeEntry(MatchId, CompanyId, LogHeaderId, EmpNum, ChangeOrderId, Level1Id, Level2Id, Level3Id, Level4Id, Billable, Manual, WorkClassCode, IncludedHours, TotalHours, BillAmount, SyncStatus, Deleted) " + $"values({x.MatchId}, {x.CompanyId}, {x.HeaderId}, {x.EmpNum}, {StrEx.ValueOrNull(x.ChangeOrderId)}, {StrEx.ValueOrNull(x.Level1Id)}, {StrEx.ValueOrNull(x.Level2Id)}, " + $"{StrEx.ValueOrNull(x.Level3Id)}, {StrEx.ValueOrNull(x.Level4Id)}, '{x.Billable}', '{x.Manual}', '{x.WorkClassCode}', {StrEx.ValueOrNull(x.IncludedHours)}, {StrEx.ValueOrNull(x.TotalHours)}, {StrEx.ValueOrNull(x.BillAmount)}, '{EnumRecordSyncStatus.Receiving}', 0); " + $"Select CAST(SCOPE_IDENTITY() AS INT);"; int entryId = Convert.ToInt32(MobileCommon.ExecuteScalar(sql)); foreach (var d in x.DetailList) { LabourTimeDetail.SqlInsert(entryId, d.TimeCodeId, d.BillRate, d.WorkHours, d.Amount); } }); UpdateStatus(EnumTableSyncStatus.CompleteReceive); return(new SyncResult { Successful = true }); } throw new Exception($"Response StatusCode={response.StatusCode}"); } } catch (Exception e) { UpdateStatus(EnumTableSyncStatus.ErrorInReceive); return(new SyncResult { Successful = false, Task = TableName, Message = e.Message }); } }
// /// <summary> /// Create a 'to string'. /// </summary> public override string ToString() { // StringBuilder _return = new StringBuilder("record:["); _return.AppendFormat("CompanyId: {0}, ", CompanyId.ToString()); _return.AppendFormat("CompanyName: {0}]", CompanyName); _return.AppendLine(); foreach (ServerData _sd in Servers) { _return.AppendFormat(_sd.ToString()).AppendLine(); } return(_return.ToString()); }
public override async Task <SyncResult> Receive(Guid token) { try { using (HttpClient client = new HttpClient()) { client.Init(token); var query = HttpUtility.ParseQueryString(string.Empty); query["companyId"] = CompanyId.ToString(); query["clientMac"] = MobileCommon.MachineMac; query["contactId"] = LoginUser.CurrUser.MatchId.ToString(); HttpResponseMessage response = await client.GetAsync($"api/LemHeader?{query.ToString()}"); if (response.IsSuccessStatusCode) { UpdateStatus(EnumTableSyncStatus.Receiving); var list = await response.Content.ReadAsAsync <List <LemHeader> >(); list.ForEach(x => { BeforeReceiveRecord(x.MatchId); string sql = $"insert LemHeader(MatchId, CompanyId, LogDate, LogStatus, SubmitStatus, ProjectId, LemNum, LEM_Desc, ApprovalComments, CreatorId, SyncStatus, Deleted) " + $"values({x.MatchId}, {x.CompanyId}, '{x.LogDate}', '{(char)x.LogStatus}', '{(char)EnumSubmitStatus.Open}', {x.ProjectId}, '{x.LemNum}', '{StrEx.SqlEsc(x.Description)}', '{StrEx.SqlEsc(x.ApprovalComments)}', {x.CreatorId}, '{EnumRecordSyncStatus.Receiving}', 0);"; MobileCommon.ExecuteNonQuery(sql); }); UpdateStatus(EnumTableSyncStatus.CompleteReceive); return(new SyncResult { Successful = true }); } throw new Exception($"Response StatusCode={response.StatusCode}"); } } catch (Exception e) { UpdateStatus(EnumTableSyncStatus.ErrorInReceive); return(new SyncResult { Successful = false, Task = TableName, Message = e.Message }); } }
public override async Task <SyncResult> Receive(Guid token) { try { using (HttpClient client = new HttpClient()) { client.Init(token); var query = HttpUtility.ParseQueryString(string.Empty); query["companyId"] = CompanyId.ToString(); query["clientMac"] = MobileCommon.MachineMac; query["contactId"] = LoginUser.CurrUser.MatchId.ToString(); HttpResponseMessage response = await client.GetAsync($"api/EquipTimeEntry?{query.ToString()}"); if (response.IsSuccessStatusCode) { UpdateStatus(EnumTableSyncStatus.Receiving); var list = await response.Content.ReadAsAsync <List <EquipTimeEntry> >(); list.ForEach(x => { BeforeReceiveRecord(x.MatchId); string sql = $"insert EquipTimeEntry(MatchID, CompanyId, LogHeaderId, EqpNum, ChangeOrderId, Level1Id, Level2Id, Level3Id, Level4Id, Billable, Quantity, BillCycle, BillAmount, SyncStatus, Deleted) " + $"values({x.MatchId}, {x.CompanyId}, {x.HeaderId}, '{x.EqpNum}', {StrEx.ValueOrNull(x.ChangeOrderId)}, {StrEx.ValueOrNull(x.Level1Id)}, {StrEx.ValueOrNull(x.Level2Id)}, " + $"{StrEx.ValueOrNull(x.Level3Id)}, {StrEx.ValueOrNull(x.Level4Id)}, '{x.Billable}', {x.Quantity}, '{(char)x.BillCycle}', {StrEx.ValueOrNull(x.BillAmount)}, '{EnumRecordSyncStatus.Receiving}', 0)"; MobileCommon.ExecuteNonQuery(sql); }); UpdateStatus(EnumTableSyncStatus.CompleteReceive); return(new SyncResult { Successful = true }); } throw new Exception($"Response StatusCode={response.StatusCode}"); } } catch (Exception e) { UpdateStatus(EnumTableSyncStatus.ErrorInReceive); return(new SyncResult { Successful = false, Task = TableName, Message = e.Message }); } }
public IHttpActionResult Delete(Guid id) { var file = UploadService.GetFile(id); if (file == null) { return(BadRequest("File not found")); } var path = Path.Combine(BaseFilePath, file.Template ? "000" : CompanyId.ToString(), file.SoaChapterId.ToString(), file.FileName); if (File.Exists(path)) { File.Delete(path); } UploadService.DeleteFile(file); return(Ok()); }
// /// <summary> /// Create a 'to string'. /// </summary> public override string ToString() { // StringBuilder _return = new StringBuilder("record:["); _return.AppendFormat("CompanyId: {0}, ", CompanyId.ToString()); _return.AppendFormat("CompanyShortName: {0}, ", CompanyShortName); _return.AppendFormat("IncidentTypeId: {0}, ", IncidentTypeId.ToString()); _return.AppendFormat("IncidentTypeShortDesc: {0}, ", IncidentTypeShortDesc); _return.AppendFormat("SubjectLine: {0}, ", SubjectLine); _return.AppendFormat("EmailTemplate: {0}, ", EmailBody); _return.AppendFormat("TimeTemplate: {0}, ", TimeTemplate); _return.AppendFormat("ThanksTemplate: {0}, ", ThanksTemplate); _return.AppendFormat("LogTemplate: {0}, ", LogTemplate); _return.AppendFormat("Template: {0}, ", Template); _return.AppendFormat("FromServer: {0}, ", FromServer.ToString()); _return.AppendFormat("]"); return(_return.ToString()); }
public override async System.Threading.Tasks.Task <SyncResult> Receive(Guid token) { try { ProjectLevelCode.Refresh(); using (HttpClient client = new HttpClient()) { client.Init(token); var query = HttpUtility.ParseQueryString(string.Empty); query["contactId"] = LoginUser.CurrUser.MatchId.ToString(); query["companyId"] = CompanyId.ToString(); HttpResponseMessage response = await client.GetAsync($"api/ProjectLevelCode?{query.ToString()}"); if (response.IsSuccessStatusCode) { UpdateStatus(EnumTableSyncStatus.Receiving); List <ProjectLevelCode> list = await response.Content.ReadAsAsync <List <ProjectLevelCode> >(); list.ForEach(x => { string sql = $"insert ProjectLevelCode(ProjectId, CompanyId, Level1Id, Level2Id, Level3Id, Level4Id, InSync) " + $"values({x.ProjectId}, {x.CompanyId}, {StrEx.ValueOrNull(x.Level1Id)}, {StrEx.ValueOrNull(x.Level2Id)}, {StrEx.ValueOrNull(x.Level3Id)}, {StrEx.ValueOrNull(x.Level4Id)}, 1 )"; MobileCommon.ExecuteNonQuery(sql); }); UpdateStatus(EnumTableSyncStatus.CompleteReceive); return(new SyncResult { Successful = true }); } throw new Exception($"Response StatusCode={response.StatusCode}"); } } catch (Exception e) { UpdateStatus(EnumTableSyncStatus.ErrorInReceive); return(new SyncResult { Successful = false, Task = TableName, Message = e.Message }); } }
public override async Task <SyncResult> Receive(Guid token) { try { using (HttpClient client = new HttpClient()) { client.Init(token); var query = HttpUtility.ParseQueryString(string.Empty); query["companyId"] = CompanyId.ToString(); query["syncId"] = CompanySyncProcess.GetSyncProcess(CompanyId, EnumSyncType.Core).SyncId.ToString(); HttpResponseMessage response = await client.GetAsync($"api/FieldPO?{query.ToString()}"); if (response.IsSuccessStatusCode) { UpdateStatus(EnumTableSyncStatus.Receiving); List <string[]> list = await response.Content.ReadAsAsync <List <string[]> >(); list.ForEach(x => { int matchId = int.Parse(x[0]); BeforeReceiveRecord(matchId); SyncCoreMatch.SqlUpdate(TableName, matchId, x[1]); }); UpdateStatus(EnumTableSyncStatus.CompleteReceive); return(new SyncResult { Successful = true }); } throw new Exception($"Response StatusCode={response.StatusCode}"); } } catch (Exception e) { UpdateStatus(EnumTableSyncStatus.ErrorInReceive); return(new SyncResult { Successful = false, Task = TableName, Message = e.Message }); } }
// /// <summary> /// Create a 'to string'. /// </summary> public override string ToString() { // StringBuilder _return = new StringBuilder("record:["); _return.AppendFormat("Id: {0}, ", Id); _return.AppendFormat("UserName: {0}, ", UserName); _return.AppendFormat("Email: {0}, ", Email); _return.AppendFormat("FirstName: {0}, ", FirstName); _return.AppendFormat("LastName: {0}, ", LastName); _return.AppendFormat("FullName: {0}, ", FullName); _return.AppendFormat("UserNicName: {0}, ", UserNicName); _return.AppendFormat("CompanyId: {0}, ", CompanyId.ToString()); _return.AppendFormat("EmailConfirmed: {0}, ", EmailConfirmed.ToString()); _return.AppendFormat("PhoneNumber: {0}, ", PhoneNumber); _return.AppendFormat("PhoneNumberConfirmed: {0}, ", PhoneNumberConfirmed.ToString()); _return.AppendFormat("ServerShortName: {0}, ", ServerShortName); return(_return.ToString()); // }
public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser, int> manager) { var userIdentity = await manager .CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); userIdentity.AddClaim(new Claim("Name", FirstName + " " + LastName)); userIdentity.AddClaim(new Claim("Company", CompanyId.ToString())); userIdentity.AddClaim(new Claim("LoginTime", DateTime.Now.ToString("dd/MM/YY hh:mm:ss"))); List <String> roles = manager.GetRoles <ApplicationUser, int>(this.Id) .ToList <String>() .Select(x => x.ToUpper().Replace(' ', '_')) .ToList <String>(); userIdentity.AddClaim(new Claim("Roles", String.Join(";", roles.ToArray()))); return(userIdentity); }
public SqlParameter[] generateSqlParametersFromObjectFields() { return(new SqlParameter[] { new SqlParameter("CompanyId", CompanyId.ToString(), DbType.Int32), new SqlParameter("Name", Name, DbType.String), new SqlParameter("PIB", PIB, DbType.String), new SqlParameter("Address", Address, DbType.String), new SqlParameter("City", City, DbType.String), new SqlParameter("PostalCode", PostalCode.ToString(), DbType.Int32), new SqlParameter("Owner", Owner, DbType.String), new SqlParameter("BankAccount", BankAccount, DbType.String), new SqlParameter("IdentificationNumber", IdentificationNumber, DbType.String), new SqlParameter("Bank", Bank, DbType.String), new SqlParameter("ActivityCode", ActivityCode.ToString(), DbType.Int32), new SqlParameter("Telephone", Telephone, DbType.String), new SqlParameter("MobileNumber", MobileNumber, DbType.String), new SqlParameter("Email", Email, DbType.String), new SqlParameter("Fax", Fax, DbType.String) }); }
// /// <summary> /// Create a 'to string'. /// </summary> public override string ToString() { // StringBuilder _return = new StringBuilder("record:["); _return.AppendFormat("ServerId: {0}, ", ServerId.ToString()); _return.AppendFormat("CompanyId: {0}, ", CompanyId.ToString()); _return.AppendFormat("ServerShortName: {0}, ", ServerShortName); _return.AppendFormat("ServerName: {0}, ", ServerName); _return.AppendFormat("ServerDescription: {0}, ", ServerDescription); _return.AppendFormat("ServerLocation: {0}, ", ServerLocation); _return.AppendFormat("FromName: {0}, ", FromName); _return.AppendFormat("FromNicName: {0}, ", FromNicName); _return.AppendFormat("FromEmailAddress: {0}, ", FromEmailAddress); _return.AppendFormat("TimeZone: {0}, ", TimeZone); _return.AppendFormat("DST: {0}, ", DST.ToString()); _return.AppendFormat("TimeZone_DST: {0}, ", TimeZone_DST); if (DST_Start.HasValue) { _return.AppendFormat("DST_Start: {0}, ", DST_Start.ToString()); } else { _return.AppendFormat("/DST_Start/, "); } if (DST_End.HasValue) { _return.AppendFormat("DST_End: {0}, ", DST_End.ToString()); } else { _return.AppendFormat("/DST_End/, "); } _return.AppendFormat("]"); return(_return.ToString()); }
public override string GetInformation() { // LOCAL VARIABLES string s = string.Empty; s += "\n\t\tName: " + Name; s += "\n\t\tTitle: " + Title; s += "\n\t\tCompany: " + CompanyName; s += "\n\t\tCompany ID: " + CompanyId.ToString(); s += "\n\t\tList of Frameworks:"; if (_frameworks.Count > 0) { foreach (var f in _frameworks) { s += "\n\t\t\t" + f; } } else { s += "\n\t\tNULL\n"; } return(s); }
public async Task <HttpResponseMessage> PostFormData() { // Check if the request contains multipart/form-data. if (!Request.Content.IsMimeMultipartContent()) { throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } var companyDir = Path.Combine(BaseFilePath, CompanyId.ToString()); if (!Directory.Exists(companyDir)) { Directory.CreateDirectory(companyDir); } var provider = new CustomMultipartFormDataStreamProvider(companyDir); try { // Read the form data. await Request.Content.ReadAsMultipartAsync(provider); var soaChapterId = provider.FormData.GetValues("soachapterid")[0]; var soaType = int.Parse(provider.FormData.GetValues("soaType")[0]); var fileName = provider.FileData[0].Headers.ContentDisposition.FileName.Replace("\"", "").Trim(); var master = bool.Parse(provider.FormData.GetValues("master")[0]); if (soaType == 3 && master) { var masterCompanyDir = Path.Combine(BaseFilePath, "000"); if (!Directory.Exists(masterCompanyDir)) { Directory.CreateDirectory(masterCompanyDir); } File.Move(Path.Combine(companyDir, provider.FileData[0].LocalFileName), Path.Combine(masterCompanyDir, provider.FileData[0].LocalFileName)); companyDir = masterCompanyDir; } var chapterDir = Path.Combine(companyDir, soaChapterId); if (!Directory.Exists(chapterDir)) { Directory.CreateDirectory(chapterDir); } fileName = Path.Combine(chapterDir, fileName); if (File.Exists(fileName)) { File.Delete(fileName); } File.Move(Path.Combine(companyDir, provider.FileData[0].LocalFileName), fileName); //Update db with filenames var file = UploadService.AddFile(Convert.ToInt32(soaChapterId), fileName, soaType == 3 && master); return(Request.CreateResponse(HttpStatusCode.OK, file)); } catch (System.Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e)); } }
public override string ToString() { return("PermissionId = " + PermissionId.ToString() + ",RoleId = " + RoleId.ToString() + ",PageId = " + PageId.ToString() + ",CanCreate = " + CanCreate.ToString() + ",CanDelete = " + CanDelete.ToString() + ",CanUpdate = " + CanUpdate.ToString() + ",CanSelect = " + CanSelect.ToString() + ",AssignedBy = " + AssignedBy.ToString() + ",CompanyId = " + CompanyId.ToString()); }
public IHttpActionResult GetFile(Guid guid) { HttpContext.Current.Response.Buffer = true; //Get file name and soachapterid from db, create correct FilePath including companyid var file = UploadService.GetFile(guid); if (file == null) { return(null); } return(new FileActionResult(file.FileName, Path.Combine(BaseFilePath, file.Template ? "000" : CompanyId.ToString(), file.SoaChapterId.ToString()))); }
public override string ToString() { return(CompanyId.ToString() + " " + Name + " " + City); }
public override string ToString() { return("StoreId = " + StoreId.ToString() + ",StoreName = " + StoreName + ",StoreAddress = " + StoreAddress + ",PhoneNo = " + PhoneNo + ",Email = " + Email + ",ProjectId = " + ProjectId.ToString() + ",CompanyId = " + CompanyId.ToString() + ",Mobile = " + Mobile + ",ContactPerson = " + ContactPerson + ",StoreCF1 = " + StoreCF1 + ",StoreCF2 = " + StoreCF2 + ",StoreCF3 = " + StoreCF3); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage req, ILogger log) { log.LogTrace("C# HTTP trigger function processed a request."); dynamic body = await req.Content.ReadAsStringAsync(); Guid? CompanyId; string CompanyName = null; try { var data = JsonConvert.DeserializeObject <Company>(body as string); CompanyId = data?.CompanyId; CompanyName = data?.CompanyName; } catch (Exception ex) { throw ex; } // parse query parameter string connectionstring2 = "DefaultEndpointsProtocol=https;AccountName=spassessservices20190227;AccountKey=KLx/VDJ279oOZ2Z2wELr90GauiVlEN4pr8r2ss2xAiokZJGAi4PF6eGz0nI0Vz0IieEwtKxqkgoM+ukeVoWxMw==;EndpointSuffix=core.windows.net"; string json = null; if (CompanyName == null) { return(req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a company name")); } try { //this code will do a insert and do a check for the id CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionstring2); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); CloudTable cloudTable = tableClient.GetTableReference("company"); TableOperation tableOperation = TableOperation.Retrieve <Company>(CompanyId.ToString(), CompanyName); TableResult tableResult = await cloudTable.ExecuteAsync(tableOperation); Company person = tableResult.Result as Company; if (person != null) { // add the code here to pass the id back to the client json = JsonConvert.SerializeObject(person, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });; } } catch (StorageException se) { log.LogTrace(se.Message); } catch (Exception ex) { log.LogTrace(ex.Message); } //change this to return the companyid return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(json, Encoding.UTF8, "application/json") }); }
public ActionResult Updatepermission(Permissionviewmodel vm) { List <string> result = new List <string>(); PermissionMaster _master = new PermissionMaster(); List <ModulePermission> p = new List <ModulePermission>(); Guid CompanyId = new Guid(); if (Request.Cookies["CompanyId"] != null) { CompanyId = new Guid(Commonhelper.GetCookie("CompanyId")); } Permissionviewmodel searchmodel = new Permissionviewmodel(); if (vm.PermissionMaster != null) { _master.Id = vm.Id; _master.CompanyId = CompanyId.ToString(); _master.UserId = vm.UserId; _master.ModifiedBy = User.Identity.GetUserId(); _master.Datemodified = DateTime.Now; _master.Workstation = Commonhelper.GetStation(); } if (vm.Menumaster.Count() > 0) { foreach (var item in vm.Menumaster) { foreach (var child in item._SubMenumaster) { if (child.IsAdd == true || child.IsEdit == true || child.Isview == true || child.Isdelete == true) { ModulePermission mp = new ModulePermission(); mp.Id = Guid.NewGuid().ToString(); mp.MenuId = item.MenuId; mp.SubMenuId = child.SubMenumasterId; mp.IsAdd = child.IsAdd; mp.IsEdit = child.IsEdit; mp.Isview = child.Isview; mp.Isdelete = child.Isdelete; mp.DisplayOrder = Commonhelper.GetSubmenuOrder(mp.SubMenuId); mp.Displayclass = child.Displayclass; mp.DisplayName = child.DisplayName; _master._ModulePermission.Add(mp); } } } try { Commonhelper.UpdatePermission(_master); return(RedirectToAction("RegisteredAccounts")); ////return Content("<script language='javascript' type='text/javascript'>alert('permission update successfully!');</script>"); } catch (Exception ex) { } } //List<Permission> permissions = new List<Permission>(); //List<ModulePermission> _MPermission = new List<ModulePermission>(); //try //{ // if(pm!=null) // { // pm.Datemodified = DateTime.Now; // pm.ModifiedBy = User.Identity.GetUserId(); // if (pm._Permission.Count() > 0) // { // foreach(var item in pm._Permission) // { // Permission p = new Permission(); // p.DisplayOrder = item.DisplayOrder; // p.Id = Guid.NewGuid(); // p.Isactive = item.Isactive; // p.MenuId = item.MenuId; // p.PermissionMasterId = pm.Id; // p.Displayclass = item.Displayclass; // p.DisplayName = item.DisplayName; // permissions.Add(p); // } // pm._Permission.Clear(); // pm._Permission = permissions; // foreach(var child in pm._ModulePermission) // { // ModulePermission mp = new ModulePermission(); // mp.Id = Guid.NewGuid(); // mp.PermissionMasterId = pm.Id; // mp.MenuId = child.MenuId; // mp.SubMenuId = child.SubMenuId; // mp.IsAdd = child.IsAdd; // mp.IsEdit = child.IsEdit; // mp.Isview = child.Isview; // mp.Isdelete = child.Isdelete; // mp.DisplayOrder = child.DisplayOrder; // mp.Displayclass = child.Displayclass; // mp.DisplayName = child.DisplayName; // _MPermission.Add(mp); // } // pm._ModulePermission.Clear(); // pm._ModulePermission.AddRange(_MPermission); // try // { // Commonhelper.SavePermission(_master); // /// Commonhelper.UpdatePermission(pm); // } // catch(Exception ex) // { // result.Add("Internal server Issue try again."); // } // } // } // return Content("<script language='javascript' type='text/javascript'>alert('permission update successfully!');</script>"); // //result.Add("permission update successfully."); // //ModelState.Clear(); // //return Json(new { url = Url.Action("UserLevelPermission") }); //} //catch(Exception ex) //{ // result.Add("Internal server Issue try again."); //} return(Json(result)); }
public override string ToString() { return("RoleId = " + RoleId.ToString() + ",RoleName = " + RoleName + ",LoweredRoleName = " + LoweredRoleName + ",Description = " + Description + ",CompanyId = " + CompanyId.ToString()); }
public async Task <ActionResult> Register(ApplicationUser model) { if (ModelState.IsValid) { Guid CompanyId = new Guid(); if (Request.Cookies["CompanyId"] != null) { CompanyId = new Guid(Commonhelper.GetCookie("CompanyId")); } var user = new ApplicationUser { UserName = model.UserName, Email = model.Email, Password = model.Password, FirstName = model.FirstName, LastName = model.LastName, MobileNo = model.MobileNo, createdby = User.Identity.GetUserId(), Datecreated = DateTime.Now, Status = true, StoreId = model.StoreId, CompanyId = CompanyId.ToString(), RegisteredDeailer = false, TaxExempted = false, IsVendor = false, IsRetailCustomer = false, IsWholeCustomer = false, UserExpiry = model.UserExpiry }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { /////await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false); var Usermanager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(); Usermanager.AddToRole(user.Id, model.UserRole); // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("RegisteredAccounts")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }