public ResponseModel setLicenseVariables(out LicenseModel License) { string sFunctionName = "setLicenseVariables()"; ResponseModel Response = new ResponseModel(); //LicenseModel License = new LicenseModel(); License = new LicenseModel(); try { License.OrganizationName = OrganizationModel.Name; License.OrganizationMnemonic = OrganizationModel.Mnemonic; License.ProductionYear = OrganizationModel.ProdutionYear; License.TotalBranches = OrganizationModel.TotalBranches; Response.SuccessfullyPassed(); } catch (Exception ex) { #region Text Logging oLog.Log( sClassName, sFunctionName, ex.ToString()); #endregion Text Logging Response.FailedWithException(); } return(Response); }
/// <summary> /// 修改审批信息 /// </summary> /// <returns></returns> public int ModifyApproveInf(LicenseModel model) { using (Entities db = new Entities()) { xz_licensings lic_model = db.xz_licensings.FirstOrDefault(a => a.licensingid == model.licensingid); if (lic_model != null) { lic_model.xksx = model.xksx; lic_model.splx = model.splx; lic_model.b_address = model.b_address; lic_model.sxmx = model.sxmx; lic_model.sqr = model.sqr; lic_model.cardtype = model.cardtype; lic_model.card = model.card; lic_model.contactphone = model.contactphone; lic_model.s_address = model.s_address; lic_model.processtime_start = model.processtime_start; lic_model.processtime_end = model.processtime_end; lic_model.processcontent = model.processcontent; lic_model.processaddress = model.processaddress; lic_model.geography = model.geography; lic_model.issh = 0; lic_model.shresult = model.shresult; lic_model.shuser = model.createuserid; lic_model.shopinion = ""; lic_model.shtime = DateTime.Now; return(db.SaveChanges()); } else { return(0); } } }
internal License(Api api, LicenseModel model) { _api = api; Id = model.Id; Name = model.Name; Url = model.Url; }
public async Task <ActionResult> NewLicense(LicenseModel model) { try { if (ModelState.IsValid) { var doc = await _userService.GetCurrentUserAsync <Doctor>(UserTypes.Doctor) as Doctor; if (doc == null) { throw new Exception("user is not a doctor"); } Data.Entities.DoctorLicense license = new Data.Entities.DoctorLicense(); license.Title = model.Title; license.DoctorId = doc.Id; license.Status = DoctorLicenseStatuses.Pending; await _context.DoctorLicenses.AddAsync(license); await _context.SaveChangesAsync(); } else { TempData["message"] = ModelState.ErrorGathering(); } return(RedirectToAction(nameof(Index))); } catch (Exception ex) { TempData["message"] = ex.Message; return(RedirectToAction(nameof(Index))); } }
public HttpResponseMessage ModifyApproveInf(LicenseModel model) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); string[] fileClass = model.uploadpanelValue; List <FileUploadClass> list = new List <FileUploadClass>(); if (fileClass != null && fileClass.Length > 0) { foreach (var item in fileClass) { FileUploadClass file = new FileUploadClass(); JObject jo = new JObject(); jo = (JObject)JsonConvert.DeserializeObject(item); file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString(); file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString(); file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString(); file.size = jo["size"] == null ? 0 : (double)jo["size"]; list.Add(file); } } int success = bll.ModifyApproveInf(model); if (success > 0) { response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html"); } return(response); }
public ResponseModel <bool> Put([FromBody] LicenseModel licenseModel) { var resp = new ResponseModel <bool>(); try { if (licenseModel == null) { throw new Exception("Data is null"); } var id = licenseModel.Id; if (id <= 0) { throw new Exception("Id license <= 0"); } resp.Data = AppRepo.EditLicense(id, licenseModel); resp.Status = 200; resp.Description = "OK"; } catch (Exception ex) { resp.Status = 500; resp.Description = $"Error: {ex.Message}"; resp.Data = false; } return(resp); }
//public bool check_connection(string conn) //{ // bool result = false; // MySqlConnection connection = new MySqlConnection(conn); // try // { // connection.Open(); // result = true; // connection.Close(); // } // catch // { // result = false; // } // return result; //} private void saveDbCredentials_click(object sender, RoutedEventArgs e) { string connection = "SERVER=localhost;UID='" + txtDbUser.Text + "';password='******'"; MySqlConnection Connection = new MySqlConnection(connection); var isConnectionExist = check_connection(connection); if (isConnectionExist) { using (MySqlCommand Command = new MySqlCommand("CREATE USER IF NOT EXISTS '" + Common.CommonProperties.mySqlUser + "'@'localhost' IDENTIFIED BY '" + Common.CommonProperties.mySqlPassword + "';", Connection)) { Connection.Open(); Command.ExecuteNonQuery(); } using (MySqlCommand cmd = new MySqlCommand("GRANT ALL ON finpos.* TO '" + Common.CommonProperties.mySqlUser + "'@'localhost';", Connection)) { cmd.ExecuteNonQuery(); Connection.Close(); } this.Hide(); LicenseModel license = new LicenseModel(string.Empty, _license.MacAddress.ToString(), _license.AccessToken); License form = new License(license); form.ShowDialog(); } else { errorGrid.Visibility = Visibility.Visible; errormessage.Text = "Invalid credential! please enter valid credentials..."; } // this.Close(); }
public System.Web.Mvc.ActionResult SetLicenseFromFile(FormCollection form) { var model = new LicenseModel(); ExceptionsML bizEx = null; try { SR <License[]> result = null; if (Context.Request.Files != null && Context.Request.Files.Count == 1) { HttpPostedFileBase file = Context.Request.Files[0]; byte[] bytes = new byte[file.ContentLength]; file.InputStream.Read(bytes, 0, file.ContentLength); string responseFile = Context.Request.ContentEncoding.GetString(bytes); var client = SvcBldr.LicenseV2(); result = client.SetLicenses(responseFile); if (bizEx == null) { model.Message = String.Format(Constants.i18n("licensesUpdated"), result.Result.SafeLength()); } else { model.Error = bizEx; } } } catch (Exception ex) { model.Error = ExceptionsML.GetExceptionML(ex); } return(View("LicensingFrame", model)); }
public IActionResult Create([FromBody] LicenseModel model) { SerialBuilder builder = new SerialBuilder(); // Create sign keys builder.CreateKeyPair(); int id; if (int.TryParse(model.Id ?? "1", out id)) { builder.LicenseId = id; } builder.LicenseInfo = model.Type; if (model.ExpireDate.HasValue) { builder.ExpireDate = model.ExpireDate.Value.ToUniversalTime(); } if (model.ExpireDays.HasValue) { builder.ExpireDays = model.ExpireDays.Value; } model.PublicKey = builder.PublicKey; model.SerialKey = builder.GenerateSerial(5); return(Ok(model)); }
public void PutLicenseWithoutDataTest() { var mockDependency = new Mock <ILicenseRepository>(); LicenseModel model = null; mockDependency.Setup(x => x.EditLicense(1, model)).Returns(() => true); // Act var controller = new LicenseController() { AppRepo = mockDependency.Object }; // Assert var res = controller.Put(model); if (res?.Data != null) { Assert.AreEqual("Error: Data is null", res.Description); Assert.AreEqual(false, res.Data); } else { Assert.AreEqual(1, 2); } }
public void PostReturnIdLicenseWithoutIdClientTest() { var mockDependency = new Mock <ILicenseRepository>(); var modelLicenseModel = new LicenseModel() { ClientName = "test" }; var modelLicenses = new Licenses() { Number = "XXX-XXX-XXX-XXX" }; mockDependency.Setup(x => x.Insert(modelLicenses)).Returns(() => true); // Act var controller = new LicenseController() { AppRepo = mockDependency.Object }; // Assert var res = controller.PostReturnId(modelLicenseModel); if (res?.Data != null) { Assert.AreEqual("Id Client is required", res.Description); Assert.AreEqual(0, res.Data); } else { Assert.AreEqual(1, 2); } }
public async Task <LicenseModel> PrepareLicenseModel(LicenseModel model, License license, bool excludeProperties = false) { if (license != null) { model = model ?? license.ToModel <LicenseModel>(); if (!excludeProperties) { model.CountDevices = (await _licenseService.GetDeviceLicenseByLicenseId(model.Id)).Count(); model.LicenseType = CommonHelper.ConvertEnum(license.LicenseType.ToString()); model.Generated = model.DownloadId > 0; } await PrepareFeatureSearchModel(model.DeviceLicenseSearchModel, license); } if (license == null) { model.Generated = false; } await PrepareLicenseType(model.AvailableLicenseType); return(model); }
public void PostReturnIdLicenseTest() { var mockDependency = new Mock <ILicenseRepository>(); var modelLicenseModel = new LicenseModel() { ClientName = "test", IdClient = 1, IdApplication = 5 }; var modelLicenses = new Licenses() { Number = "XXX-XXX-XXX-XXX", Id = 0, }; mockDependency.Setup(x => x.Insert(modelLicenses)).Returns(() => (bool)true); // Act var controller = new LicenseController { AppRepo = mockDependency.Object }; // Assert var res = controller.PostReturnId(modelLicenseModel); if (res?.Data != null) { Assert.AreEqual(modelLicenses.Id, res.Data); } else { Assert.AreEqual(1, 2); } }
public LicenseViewModel() { Model = new LicenseModel(); var licenseFile = io::Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LicenseHeader.txt"); LoadLicense(licenseFile); }
/// <summary> /// The do work. /// </summary> /// <returns> /// The <see cref="string" />. /// </returns> public string GetTask() { var licenseModel = new LicenseModel { LicenseKey = this.serverSetting.LicenseId }; return(this.Call.DoWork(this.serverSetting.AddressUrl + this.serverSetting.CommandTaskGet, licenseModel)); }
public void CreateHttpTest() { _licenseModel = new LicenseModel { Url = _url, Bot = _bot, Key = _key }; }
public LicenseModel GetLicenseByNum(int num) { var license = _licensesRepository.GetLicenseByNum(num); var result = new LicenseModel { Id = license.Id, Number = license.Number }; return(result); }
protected async Task <string> ValidateLicense(LicenseModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var license = await _licenseService.GetLicenseById(model.Id) != null; return(license ? $"The license with (ID = {model.Id}) existed." : string.Empty); }
public HttpResponseMessage AddDealAdvice(LicenseModel model) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); int success = bll.AddDealAdvice(model); if (success > 0) { response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html"); } return(response); }
public static void Patch(this LicenseModel licenseModel, License license, UserModel user) { if (licenseModel == null) { return; } licenseModel.Name = license.Name; licenseModel.Description = license.Description; licenseModel.Url = license.Url; licenseModel.PatchBase(user); }
public IHttpActionResult SaveLicense(LicenseModel license) { try { return(Ok(_licenseService.SaveLicense(license))); } catch (Exception ex) { return(InternalServerError(ex)); } }
public LicenseModel UpdateLicense(LicenseModel license) { try { return(_licenseRepository.UpdateLicense(license)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取行政许可详情 /// </summary> /// <param name="licensingid"></param> /// <returns></returns> public LicenseModel GetApprovalInfo(int licensingid) { LicenseModel model = new LicenseModel(); using (Entities db = new Entities()) { IQueryable <LicenseModel> queryable = from a in db.xz_licensings join b in db.base_zds.Where(t => t.zd_type == "type_splx") on a.splx equals b.zd_id join c in db.base_zds.Where(t => t.zd_type == "type_xzxk_zjlx") on a.cardtype equals c.zd_id where a.licensingid == licensingid select new LicenseModel { licensingid = a.licensingid, sph = a.sph, xksx = a.xksx, splx = a.splx, b_address = a.b_address, sxmx = a.sxmx, sqr = a.sqr, cardtype = a.cardtype, card = a.card, contactphone = a.contactphone, s_address = a.s_address, processtime_start = a.processtime_start, processtime_end = a.processtime_end, processcontent = a.processcontent, processaddress = a.processaddress, geography = a.geography, createuserid = a.createuserid, createtime = a.createtime, shresult = a.shresult, shopinion = a.shopinion, shuser = a.shuser, issh = a.issh, shtime = a.shtime, splxname = b.zd_name, cardtypename = c.zd_name }; model = queryable.FirstOrDefault(); if (GetFilesByLicenseID(licensingid) != null) { List <string> imgList = GetFilesByLicenseID(licensingid); if (imgList.Count > 0) { if (model != null) { model.imgUrl = imgList; } } } } return(model); }
public LicenseModel UpdateLicense(LicenseModel licenseModel) { var license = _dbContext.Licenses .FirstOrDefault(x => x.Id == licenseModel.Id && x.RecordStatus == true); license.Name = licenseModel.Name; license.UpdateDate = DateTime.Now; _dbContext.SaveChanges(); return(licenseModel); }
/// <summary> /// Confirms whether the license the user is inserting is valid or not. /// </summary> /// <param name="license">The license you want to apply</param> public async Task <bool> ConfirmLicense(LicenseModel license) { var data = await ReadLicense(); if (data != null) { return(EncryptionData.ValidateEncryptedData(license.LicenseKey, data.LicenseKey)); } else { return(false); } }
protected void AddLicenseModel(LicenseModel value) { if (QueryParameters.ContainsKey(Constants.LicenseModelsKey)) { QueryParameters[Constants.LicenseModelsKey] = value == LicenseModel.None ? value : (LicenseModel) QueryParameters[Constants.LicenseModelsKey] | value; } else { QueryParameters.Add(Constants.LicenseModelsKey, value); } }
public LicenseModel SaveLicense(LicenseModel licenseModel) { var license = new License { Name = licenseModel.Name }; _dbContext.Licenses.Add(license); _dbContext.SaveChanges(); licenseModel.Id = license.Id; return(licenseModel); }
protected void AddLicenseModel(LicenseModel value) { if (QueryParameters.ContainsKey(Constants.LicenseModelsKey)) { QueryParameters[Constants.LicenseModelsKey] = value == LicenseModel.None ? value : (LicenseModel)QueryParameters[Constants.LicenseModelsKey] | value; } else { QueryParameters.Add(Constants.LicenseModelsKey, value); } }
private async Task <List <LicenseModel> > GetLicenses(string customerId, string userId) { IAggregatePartner operations; LicenseModel licenseModel; List <LicenseModel> values; ResourceCollection <License> licenses; ResourceCollection <SubscribedSku> subscribedSkus; if (string.IsNullOrEmpty(customerId)) { throw new ArgumentNullException(nameof(customerId)); } if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } try { values = new List <LicenseModel>(); operations = await new SdkContext().GetPartnerOperationsAysnc(); licenses = await operations.Customers.ById(customerId).Users.ById(userId).Licenses.GetAsync(); subscribedSkus = await operations.Customers.ById(customerId).SubscribedSkus.GetAsync(); foreach (SubscribedSku sku in subscribedSkus.Items) { licenseModel = new LicenseModel() { ConsumedUnits = sku.ConsumedUnits, Id = sku.ProductSku.Id, IsAssigned = licenses.Items .SingleOrDefault(x => x.ProductSku.Name.Equals(sku.ProductSku.Name)) != null ? true : false, Name = sku.ProductSku.Name, SkuPartNumber = sku.ProductSku.SkuPartNumber, TargetType = sku.ProductSku.TargetType, TotalUnits = sku.TotalUnits }; values.Add(licenseModel); } return(values); } finally { licenseModel = null; licenses = null; subscribedSkus = null; } }
private LmsCompany GetLicense(Guid key) { var license = LicenseModel.GetOneByConsumerKey(key.ToString()).Value; if (license == null) { Logger.WarnFormat("LmsCompany not found. Key: {0}.", key); return(null); } System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(LanguageModel.GetById(license.LanguageId).TwoLetterCode); return(license); }
public Exception ValidateLicenseAdd(LicenseModel dataToAdd) { if (dataToAdd.IdClient <= 0) { return(new Exception("Id Client is required")); } if (dataToAdd.IdApplication <= 0) { return(new Exception("Id Application is required")); } return(null); }
IBlendedVideosSearch IBlendedVideosSearch.WithLicenseModel(LicenseModel value) { return WithLicenseModel(value); }
public SearchVideos WithLicenseModel(LicenseModel value) { if ((value & LicenseModel.RightsManaged) == LicenseModel.RightsManaged) { throw new SdkException(LicenseModel.RightsManaged + " is not a valid License Model for video searches."); } AddLicenseModel(value); return this; }
ICreativeVideosSearch ICreativeVideosSearch.WithLicenseModel(LicenseModel value) { return WithLicenseModel(value); }
public virtual SearchImages WithLicenseModel(LicenseModel value) { AddLicenseModel(value); return this; }
ICreativeImagesSearch ICreativeImagesSearch.WithLicenseModel(LicenseModel value) { return WithLicenseModel(value); }
IBlendedImagesSearch IBlendedImagesSearch.WithLicenseModel(LicenseModel value) { return WithLicenseModel(value); }