[HttpPost] // them san pham public ActionResult Create(Product product) { if (product.Name != null) { if (ModelState.IsValid) { var dao = new ProductDao(); product.MetaTitle = CommonConstants.convertToUnSign3(product.Name); product.Description = product.Name; product.MoreImages = ("<Images></Images>").ToString(); product.CreatedDate = DateTime.Now; //var session = (Common.UserLogin)Session[OnlineShop.Common.CommonConstants.USER_SESSION]; //product.CreatedBy = session.UserName; product.MetaKeywords = product.MetaTitle; product.MetaDescriptions = product.MetaTitle; product.TopHot = DateTime.Now; product.ViewCount = 0; long id = dao.Insert(product); if (id > 0) { SetAlert("Thêm sản phẩm thành công", "success"); return(RedirectToAction("Create", "Product")); } else { ModelState.AddModelError("", "Thêm sản phẩm không thành công"); } } } SetViewBag(); // SetAlert("Thêm sản phẩm không thành công", "success"); SetAlert("Tên sản phẩm bắt buộc", "error"); return(View("Create")); }
public ActionResult Edit(Product product) { if (ModelState.IsValid) { var dao = new ProductDao(); product.MetaTitle = CommonConstants.convertToUnSign3(product.Name); product.Description = product.Name; //var session = (Common.UserLogin)Session[OnlineShop.Common.CommonConstants.USER_SESSION]; //product.ModifiedBy = session.UserName; product.MetaKeywords = product.MetaTitle; product.MetaDescriptions = product.MetaTitle; product.TopHot = DateTime.Now; var result = dao.Update(product); if (result) { SetAlert("Cập nhật sản phẩm thành công", "success"); return(RedirectToAction("Select", "Product")); } else { ModelState.AddModelError("", "Cập nhật sản phẩm không thành công"); } } SetViewBag(); return(View("Select")); }
public PortalController( IConfiguration configuration, Core.SecurityContext securityContext, TenantManager tenantManager, SettingsManager settingsManager, ApiSystemHelper apiSystemHelper, CommonMethods commonMethods, HostedSolution hostedSolution, CoreSettings coreSettings, TenantDomainValidator tenantDomainValidator, UserFormatter userFormatter, UserManagerWrapper userManagerWrapper, CommonConstants commonConstants, IOptionsMonitor <ILog> option, TimeZonesProvider timeZonesProvider, TimeZoneConverter timeZoneConverter) { Configuration = configuration; SecurityContext = securityContext; TenantManager = tenantManager; SettingsManager = settingsManager; ApiSystemHelper = apiSystemHelper; CommonMethods = commonMethods; HostedSolution = hostedSolution; CoreSettings = coreSettings; TenantDomainValidator = tenantDomainValidator; UserFormatter = userFormatter; UserManagerWrapper = userManagerWrapper; CommonConstants = commonConstants; TimeZonesProvider = timeZonesProvider; TimeZoneConverter = timeZoneConverter; Log = option.Get("ASC.ApiSystem"); }
public RegistrationController( CommonMethods commonMethods, CommonConstants commonConstants, IOptionsSnapshot <HostedSolution> hostedSolution, TimeZonesProvider timeZonesProvider, TimeZoneConverter timeZoneConverter, ApiSystemHelper apiSystemHelper, SecurityContext securityContext, TenantManager tenantManager, SettingsManager settingsManager, CoreSettings coreSettings, TenantDomainValidator tenantDomainValidator, UserFormatter userFormatter, UserManagerWrapper userManagerWrapper, IConfiguration configuration, IOptionsMonitor <ILog> option, PasswordHasher passwordHasher) { CommonMethods = commonMethods; CommonConstants = commonConstants; HostedSolution = hostedSolution.Value; TimeZonesProvider = timeZonesProvider; TimeZoneConverter = timeZoneConverter; ApiSystemHelper = apiSystemHelper; SecurityContext = securityContext; TenantManager = tenantManager; SettingsManager = settingsManager; CoreSettings = coreSettings; TenantDomainValidator = tenantDomainValidator; UserFormatter = userFormatter; UserManagerWrapper = userManagerWrapper; Configuration = configuration; PasswordHasher = passwordHasher; Log = option.Get("ASC.ApiSystem"); }
public static void PromptForActualExeFile(string originalPathToFile) { var box = MessageBox.Show( CommonConstants.PromptForActualExeFile(originalPathToFile), OpenInAppCommand.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); switch (box) { case DialogResult.Yes: var resultAndNamePicked = CommonFileHelper.BrowseToFileLocation(ConstantsForApp.ExecutableFileToBrowseFor); if (resultAndNamePicked.DialogResult == DialogResult.OK) { PersistVSToolOptions(resultAndNamePicked.FileNameChosen); } break; case DialogResult.No: PersistVSToolOptions(originalPathToFile); break; default: break; } }
public bool Update(Product entity) { try { var product = db.Products.Find(entity.ID); product.Name = entity.Name; product.MetaTitle = CommonConstants.convertToUnSign3(entity.Name); product.Description = product.Name; product.Code = entity.Code; product.Image = entity.Image; product.Price = entity.Price; product.PromotionPrice = entity.PromotionPrice; product.IncludedVAT = entity.IncludedVAT; product.ModifiedBy = entity.ModifiedBy; product.Quantity = entity.Quantity; product.ModifiedDate = DateTime.Now; product.Status = entity.Status; product.TopHot = DateTime.Now; product.MetaKeywords = product.MetaTitle; product.MetaDescriptions = product.MetaTitle; db.SaveChanges(); return(true); } catch (Exception) { //logging return(false); } }
protected override void OnDelete(SyncStatus status) { if (!MMCDlgHelper.ShowConfirm(CommonConstants.GetSelectedDeleteMsg("secret keys", this.SelectedNodes.Count))) { return; } base.OnDelete(status); var entriesNode = this.ScopeNode as VecsStoreEntriesNode; var dto = entriesNode.ServerDTO; var storeName = entriesNode.StoreName; var storePass = ""; MMCActionHelper.CheckedExec(delegate() { using (var session = new VecsStoreSession(dto.VecsClient, storeName, storePass)) { foreach (ResultNode node in this.SelectedNodes) { var certDTO = node.Tag as Vecs.CertDTO; session.DeleteCertificate(certDTO.Alias); } } }); Refresh(); }
private void FillBillDetailsForEdit(string billID) { try { _dalBills = new DAL_Bills(); var bills = _dalBills.GetBillDetails(new M_Bills_RQ() { BillID = Convert.ToInt32(billID) }); if (bills != null) { btnAdd.Text = "Update"; btnPrint.Enabled = true; txtCustomerName.Text = bills[0].BillTo; txtMobileNo.Text = bills[0].MobileNo; txtAddress.Text = bills[0].BillToAddress; txtBillNo.Text = bills[0].BillNo; txtEmailID.Text = bills[0].EmailID; dtpBillDate.Value = bills[0].BillDate; IsInv.Checked = Convert.ToBoolean(bills[0].IsIndividual); //txtCaseDetails.Text = bills[0].BillDescription; txtGrandTotal.Text = Convert.ToString(bills[0].BillAmout); lblGrandTotalInWords.Text = "Rupees " + CommonConstants.ConvertNumbertoWords(Convert.ToString(bills[0].BillAmout)); BindParticularDetails(); } } catch (Exception) { throw; } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (!string.IsNullOrWhiteSpace(txtBoxCustomersName.Text)) { dAL_Customers = new DAL_Customers(); dAL_Customers.AddUpdateCustomers(new Models.M_Customers() { CreatedBy = CommonConstants.CreatedBy, CreatedOn = DateTime.Now, CustAddress = txtBoxCustomerAddress.Text, CustID = Convert.ToInt32(!string.IsNullOrWhiteSpace(lblCustomerID.Text) ? lblCustomerID.Text : "0"), CustMobile = txtBoxCustomerMobile.Text, IsActive = true, CustName = txtBoxCustomersName.Text, CustomerType = Convert.ToString(cmbCustomerType.SelectedValue), EmailID = Convert.ToString(txtEmail.Text) }); BindCustomerData(); ClearControls(); } else { CommonConstants.ShowMessageBox("Please enter customer name !!", "Warning", MessageBoxIcon.Warning); } } catch (Exception) { throw; } }
public bool Edit(ProductCategory entity) { try { var model = db.ProductCategories.Find(entity.ID); model.NameCategory = entity.NameCategory; model.CreatedDate = DateTime.Now; model.DisplayOrder = entity.DisplayOrder; model.Image = entity.Image; model.MenuID = entity.MenuID; if (!string.IsNullOrEmpty(entity.NameCategory)) { var chuyendoi = CommonConstants.utf8Convert1(entity.NameCategory); model.MetaTiile = chuyendoi; } model.ParentID = entity.ParentID; model.Status = entity.Status; db.SaveChanges(); return(true); } catch { return(false); } }
public async Task <AuthenticationData> RequestClientCredentialsTokenAsync(CommonConstants.ApiScopes apiScopes, CommonConstants.DefaultScopes defaultScopes) { var disco = await GetDiscoveryResponse(); var client = new HttpClient(); var response = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest { GrantType = OidcConstants.GrantTypes.ClientCredentials, Address = disco.TokenEndpoint, ClientId = Options.ClientId, ClientSecret = Options.ClientSecret, Scope = CommonConstants.GetScopes(apiScopes, defaultScopes) }); ValidateResponse(response); return(new AuthenticationData { AccessToken = response.AccessToken, RefreshToken = response.RefreshToken, ExpiresAt = DateTime.Now.AddSeconds(response.ExpiresIn) }); }
private void PrePopulateFields() { var tenant = MiscUtil.GetBrandConfig(CommonConstants.TENANT); BindDN.StringValue = string.IsNullOrWhiteSpace(_dto.BindDN) ?"Administrator@" + tenant:_dto.BindDN; BaseDN.StringValue = string.IsNullOrWhiteSpace(_dto.BaseDN)?CommonConstants.GetDNFormat(tenant):_dto.BaseDN; }
public async Task <AuthenticationData> RequestPasswordTokenAsync(string username, string password, CommonConstants.ApiScopes apiScopes) { ArgumentValidation.ValidateString(nameof(username), username); ArgumentValidation.ValidateString(nameof(password), password); var disco = await GetDiscoveryResponse(); var client = new HttpClient(); var response = await client.RequestPasswordTokenAsync(new PasswordTokenRequest { Address = disco.TokenEndpoint, ClientId = Options.ClientId, ClientSecret = Options.ClientSecret, UserName = username, Password = password, Scope = CommonConstants.GetScopes(apiScopes, CommonConstants.DefaultScopes.UserDefault | CommonConstants.DefaultScopes.OfflineAccess) }); ValidateResponse(response); return(new AuthenticationData { AccessToken = response.AccessToken, RefreshToken = response.RefreshToken, ExpiresAt = DateTime.Now.AddSeconds(response.ExpiresIn) }); }
public async Task <DeviceAuthenticationRequestData> RequestDeviceAuthorizationAsync( CommonConstants.ApiScopes apiScopes) { var disco = await GetDiscoveryResponse(); var client = new HttpClient(); var response = await client.RequestDeviceAuthorizationAsync(new DeviceAuthorizationRequest { Address = disco.DeviceAuthorizationEndpoint, ClientId = Options.ClientId, ClientSecret = Options.ClientSecret, Scope = CommonConstants.GetScopes(apiScopes, CommonConstants.DefaultScopes.UserDefault | CommonConstants.DefaultScopes.OfflineAccess) }); ValidateResponse(response); return(new DeviceAuthenticationRequestData { UserCode = response.UserCode, DeviceCode = response.DeviceCode, VerificationUri = response.VerificationUri, VerificationUriComplete = response.VerificationUriComplete, PollingInterval = response.Interval, ExpiresAt = response.ExpiresIn.HasValue ? DateTime.Now.AddSeconds(response.ExpiresIn.Value) : default(DateTime?) }); }
public CommonMethods( IHttpContextAccessor httpContextAccessor, IConfiguration configuration, IOptionsMonitor <ILog> option, CoreSettings coreSettings, CommonLinkUtility commonLinkUtility, EmailValidationKeyProvider emailValidationKeyProvider, TimeZoneConverter timeZoneConverter, CommonConstants commonConstants, IMemoryCache memoryCache, IOptionsSnapshot <HostedSolution> hostedSolutionOptions, CoreBaseSettings coreBaseSettings, TenantManager tenantManager) { HttpContextAccessor = httpContextAccessor; Configuration = configuration; Log = option.Get("ASC.ApiSystem"); CoreSettings = coreSettings; CommonLinkUtility = commonLinkUtility; EmailValidationKeyProvider = emailValidationKeyProvider; TimeZoneConverter = timeZoneConverter; CommonConstants = commonConstants; MemoryCache = memoryCache; CoreBaseSettings = coreBaseSettings; TenantManager = tenantManager; HostedSolution = hostedSolutionOptions.Get(CommonConstants.BaseDbConnKeyString); }
private void btnSaveAs_Click(object sender, EventArgs e) { StringBuilder sbMsg = new StringBuilder(); if (!string.IsNullOrWhiteSpace(txtBillNo.Text)) { var confirmResult = MessageBox.Show("Are you sure to make new invoice !", "Confirm !!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { _dalBills = new DAL_Bills(); List <M_Bills_RS> result = _dalBills.BillSaveAs(new M_Bills_RQ() { BillNo = txtBillNo.Text }); if (result != null && result.Count > 0) { CommonConstants.ShowMessageBox(result[0].BillNo.ToString() + sbMsg.ToString(), "Success !!", MessageBoxIcon.Information); BindPageEdit(result[0].BillID.ToString()); //lblBillID.Text = Convert.ToString(result[0].BillID); //txtBillNo.Text = Convert.ToString(result[0].BillNo); } } } else { CommonConstants.ShowMessageBox("Can not create copy of this invoice !!", "Success !!", MessageBoxIcon.Information); } }
public bool Edit(Product entity) { try { var model = db.Products.Find(entity.ID); model.CategoryID = entity.CategoryID; model.Code = entity.Code; model.CreatedDate = DateTime.Now; model.Description = entity.Description; model.Detail = entity.Detail; model.Image = entity.Image; model.MetaDescriptions = entity.MetaDescriptions; if (!string.IsNullOrEmpty(entity.Name)) { var chuyendoi = CommonConstants.utf8Convert1(entity.Name); model.MetaTitle = chuyendoi; } model.Name = entity.Name; model.Price = entity.Price; model.PromotionPrice = entity.PromotionPrice; model.Quantity = entity.Quantity; model.Status = entity.Status; model.TopHot = entity.TopHot; db.SaveChanges(); return(true); } catch { return(false); } }
public HomeController(ILogger <HomeController> logger, IWebHostEnvironment hostingEnvironment, IOptions <CommonConstants> constants, IRepository repository, IHubContext <DocumentHub> hubContext) { _logger = logger; _hostingEnvironment = hostingEnvironment; _constants = constants.Value; _repository = repository; _hubContext = hubContext; }
protected override void OnDelete(SyncStatus status) { if (!MMCDlgHelper.ShowConfirm(CommonConstants.GetDeleteMsg("server", ServerDTO.Server))) { return; } base.OnDelete(status); VMCASnapInEnvironment.Instance.LocalData.RemoveServer(ServerDTO); (Parent as VMCARootNode).RefreshAll(); }
public ClientDto(string clientId, OspDashboardOptions ospDashboardOptions) { ClientId = clientId; Authority = ospDashboardOptions.AuthorityUrl.EnsureEndsWith("/"); CoreServices = ospDashboardOptions.CoreServiceUrl.EnsureEndsWith("/"); JobServices = ospDashboardOptions.JobServiceUrl.EnsureEndsWith("/"); RedirectUri = ospDashboardOptions.PublicUrl.EnsureEndsWith("/"); PostLogoutRedirectUri = ospDashboardOptions.PublicUrl.EnsureEndsWith("/"); Scope = CommonConstants.GetScopes(CommonConstants.ApiScopes.IdentityApiFullAccess | CommonConstants.ApiScopes.SystemApiFullAccess | CommonConstants.ApiScopes.JobApiFullAccess, CommonConstants.DefaultScopes.UserDefault | CommonConstants.DefaultScopes.OfflineAccess); }
public static string GetBrandConfig(string key) { try { return(CommonConstants.GetConfigValue(key)); } catch (Exception) { MessageBox.Show(CommonConstants.CONFIG_NOT_FOUND); return(string.Empty); } }
// Use this for initialization void Start() { SoundManager.Instance.PlaySound(5); #if UNITY_WEBGL //webgl CommonConstants.AssignTexture(userprofile.GetComponent <RawImage>(), AlertController.instance.profileimg); username.text = WebServices.instance.currentUser.firstname; #else //WhotCommonConstants.AssignTexture(userprofile.GetComponent<RawImage>(),AlertController.instance.profileimg); #endif }
public long Insert(Content id) { if (!string.IsNullOrEmpty(id.Name)) { var chuyendoi = CommonConstants.utf8Convert1(id.Name); id.MetaTitle = chuyendoi; } id.CreatedDate = DateTime.Now; db.Contents.Add(id); db.SaveChanges(); return(id.ID); }
public long Create(ProductCategory entity) { if (!string.IsNullOrEmpty(entity.NameCategory)) { var chuyendoi = CommonConstants.utf8Convert1(entity.NameCategory); entity.MetaTiile = chuyendoi; } entity.CreatedDate = DateTime.Now; db.ProductCategories.Add(entity); db.SaveChanges(); return(entity.ID); }
private void GenerateAllMaterials(UserLanguages userLanguages) { var allMaterialsSalesGenerator = new AllMaterialsSalesGenerator(WebSettingsConfig.Instance.DomainWithProtocol, CommonConstants.GetFontPath(Server), WebSettingsConfig.Instance. SalesPicturesCache, WebSettingsConfig.Instance. IsSectionForbidden); allMaterialsSalesGenerator.Generate(WebSettingsConfig.Instance.GetLanguageFromId(), userLanguages); }
private void btnSendMail_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtBillNo.Text)) { BillForm billForm = new BillForm(); billForm.SavePDF(Convert.ToInt32(lblBillID.Text), true); } else { CommonConstants.ShowMessageBox("Add bill before sent mail to client !!", "Success !!", MessageBoxIcon.Information); } }
public CalDavController( CommonMethods commonMethods, EmailValidationKeyProvider emailValidationKeyProvider, CoreSettings coreSettings, CommonConstants commonConstants, IOptionsMonitor <ILog> option) { CommonMethods = commonMethods; EmailValidationKeyProvider = emailValidationKeyProvider; CoreSettings = coreSettings; CommonConstants = commonConstants; Log = option.Get("ASC.ApiSystem"); }
private GetUserCodeModel GenerateCode(long userId, long storeId) { var data = GetExistingUserCode(userId, storeId); GetUserCodeModel userCodeModel = new GetUserCodeModel(); if (data != null && !string.IsNullOrWhiteSpace(data.Code)) { // check code is active if (data.ExpiryDate <= DateTime.Now) { var sqlQuery = GetUpdateUserCodeQuery(data.UserId, data.StoreId, data.CreatedDate); _db.Query(sqlQuery); userCodeModel.ErrorMessage = string.Format("Koden har löpt ut! Försök efter {0} dag, {1}:{2} timmar.", data.ExpiryDate.AddDays(1).Subtract(DateTime.Now).Days, data.ExpiryDate.AddDays(1).Subtract(DateTime.Now).Hours, data.ExpiryDate.AddDays(1).Subtract(DateTime.Now).Minutes); return(userCodeModel); } else { userCodeModel.Code = data.Code; userCodeModel.IsActive = data.IsActive; return(userCodeModel); } } else { // generate code.. var sqlQuery = GetGenerateUserCodeQuery(userId, storeId); _db.Query(sqlQuery, new { @userId = userId, @storeId = storeId, @code = CommonConstants.GenerateRandomCode(), @createdDate = DateTime.Now, @expiryDate = DateTime.Now.AddMinutes(CommonConstants.UserCodeExpireTime), @isActive = true }); var model = GetExistingUserCode(userId, storeId); if (model != null) { userCodeModel.Code = model.Code; userCodeModel.IsActive = model.IsActive; return(userCodeModel); } else { userCodeModel.ErrorMessage = "Error vid försök att få ny kod. Vänligen prova igen."; return(userCodeModel); } } }
protected override void OnDelete(SyncStatus status) { if (!MMCDlgHelper.ShowConfirm(CommonConstants.GetDeleteMsg("store", StoreName))) { return; } MMCActionHelper.CheckedExec(delegate { base.OnDelete(status); ServerDTO.VecsClient.DeleteStore(StoreName); Parent.Children.Remove(this); }); }
public static string GetBrandConfig(string key) { try { return(CommonConstants.GetConfigValue(key)); } catch (Exception e) { var alert = new NSAlert() { AlertStyle = NSAlertStyle.Critical, InformativeText = CommonConstants.CONFIG_NOT_FOUND }; alert.RunModal(); return(string.Empty); } }