public static void EliminarEvento(int AppointmentId, int Status, int Id, int Tipo) { if (Tipo == 0) { Factory fac = new Factory(); #region modificar calendario //primero lo buscamos List <Entidad.Calendario> listaCal = NegocioMySQL.Calendario.ObtenerCalendarioPorId(Id); Entidad.Calendario cal = new Entidad.Calendario(); if (listaCal != null && listaCal.Count > 0) { cal = listaCal[0]; } if (cal != null && cal.Id > 0) { Entidad.Calendario calendario = new Entidad.Calendario(); cal.Eliminado = 1; cal.Nuevo = false; cal.Modificado = true; cal.Borrado = false; fac.Update <Entidad.Calendario>(cal, setCnsWebLun); } #endregion } else { throw new Exception("No puede Eliminar un Evento del Tipo Proyecto."); } }
public long SaveOrUpdate(Party party) { try { string catalog = AppUsers.GetCurrentUserDB(); int userId = AppUsers.GetCurrent().View.UserId.ToInt(); if (string.IsNullOrWhiteSpace(party.PartyName)) { party.PartyName = party.LastName + ", " + party.FirstName; } party.AuditUserId = userId; party.AuditTs = DateTime.UtcNow; if (party.PartyId > 0) { Factory.Update(catalog, party, party.PartyId); return(party.PartyId); } //Party code will be created on server side. party.PartyCode = null; long id = Conversion.TryCastLong(Factory.Insert(catalog, party)); return(id); } catch (Exception ex) { Log.Warning("Could not save items. {Exception}", ex); throw; } }
/// <summary> /// Saves the specified FileInclude. /// </summary> /// <param name="entity">The entity.</param> public void Save(FileInclude entity) { if (entity.Context == null) { entity.Context = Context; } entity.Validate(); if (Identifier.IsValid(entity.FileIncludeID)) { Factory.Update(entity.ObjectValue); } else { entity.FileIncludeID = Guid.NewGuid(); try { Factory.Insert(entity.ObjectValue); } catch { entity.FileIncludeID = Guid.Empty; throw; } } }
public static void UpdateEvento(int Id, string Descripcion, DateTime FechaInicio, DateTime FechaTermino, int Status, string Asunto, string Ubicacion, int Etiqueta, int Tipo, int InstId, bool Borrado) { if (Tipo == 0) { Factory fac = new Factory(); Entidad.Calendario calendario = new Entidad.Calendario(); if (Descripcion == null) { Descripcion = "Sin descripción"; } calendario.Id = Id; calendario.Asunto = Asunto; calendario.Descripcion = Descripcion; calendario.Etiqueta = Etiqueta; calendario.FechaInicio = FechaInicio; calendario.FechaTermino = FechaTermino; //ver como sacar la institucion calendario.InstId = InstId; calendario.Status = Status; calendario.Tipo = Tipo; if (Ubicacion == null) { Ubicacion = ""; } calendario.Ubicacion = Ubicacion; calendario.Url = ""; calendario.Nuevo = false; calendario.Modificado = true; fac.Update <Entidad.Calendario>(calendario, setCnsWebLun); if (NegocioMySQL.Utiles.ENVIA_CORREO_EVENTO(InstId) == "1") { List <UsuariosCorreos> correos = UsuariosCorreos.ListaUsuariosCorreosPorInstId(InstId); List <string> listaCorreos = new List <string>(); if (correos != null && correos.Count > 0) { foreach (UsuariosCorreos us in correos) { listaCorreos.Add(us.Correo); } } if (listaCorreos != null && listaCorreos.Count > 0) { NegocioMySQL.ServidorCorreo cr = new NegocioMySQL.ServidorCorreo(); Entidad.Institucion institucion = NegocioMySQL.Institucion.ObtenerInstitucionPorId(InstId); string fecha1 = Utiles.ConstruyeFecha(FechaInicio); string fecha2 = Utiles.ConstruyeFecha(FechaTermino); MailMessage mnsj = NegocioMySQL.Utiles.ConstruyeMensajeCrearEvento(institucion.Nombre, Asunto, fecha1 + " " + fecha2, Ubicacion, listaCorreos, false); cr.Enviar(mnsj); } } } else { throw new Exception("No puede Modificar un Evento del Tipo Proyecto."); } }
public static int Modificar(Entidad.Calendario entidad) { int retorno = 0; Factory fac = new Factory(); retorno = fac.Update <Entidad.Calendario>(entidad, setCnsWebLun); return(retorno); }
/// <summary> /// /// </summary> private void Save() { string msg = ""; #region email if (CurrentUser != null) { string email = txtemail.Value.Trim(); string newemail = txtnewemail.Value.Trim(); if (string.IsNullOrEmpty(email)) { msg = "请输入当前邮箱。"; } else if (email != CurrentUser.Email) { msg = "当前邮件账号输入不正确 请重新输入"; } else if (newemail == email) { msg = "新邮箱不能原邮箱一样;"; } else if (!viviLib.Text.PageValidate.IsEmail(email)) { msg = "新邮箱格式不正确;"; } if (string.IsNullOrEmpty(msg)) { if (CurrentUser.IsEmailPass == 1) { msg = SendChange_email(newemail); } else { CurrentUser.Email = newemail; CurrentUser.IsEmailPass = 0; if (Factory.Update(CurrentUser, null)) { msg = "修改成功"; } else { msg = "修改失败"; } } } } else { msg = "用户不存在"; } #endregion this.lblMessage.Text = msg; }
public FactoryInfo Save() { if (this.Id != null) { Factory.Update(this); return(this); } this.Create_time = DateTime.Now; return(Factory.Insert(this)); }
public static void SetSuccess(string database, long queueId) { dynamic poco = new ExpandoObject(); poco.queue_id = queueId; poco.delivered = true; poco.delivered_on = DateTimeOffset.UtcNow; Factory.Update(database, poco, queueId, "config.email_queue", "queue_id"); }
/// <summary> /// Saves the specified FileLink. /// </summary> /// <param name="entity">The entity.</param> public void Save(FileLink entity) { entity.Validate(); if (Identifier.IsValid(entity.FileLinkID)) { Factory.Update(entity.ObjectValue); } else { Factory.Insert(entity.ObjectValue); } }
public BaseController() { if (factory == null) { factory = new Factory(); factory.Initialize(); } else { factory.Update(); } }
private void DockView(IDock dock, IView view, bool add = true) { if (add) { dock.Views.Add(view); Factory.Update(view, view, dock); } else { Factory.Update(view, view, view.Parent); } Factory.SetCurrentView(view); }
/// <summary> /// Deletes the specified Knowledge. /// </summary> /// <param name="entity">The entity.</param> public virtual void Delete(Knowledge entity) { var permission = Context.RequirePermission(entity.CategoryID, Permission.Moderate); if (permission.HasPermission(Permission.Admin)) { Factory.Delete(entity.ObjectValue); } else { entity.KnowledgeStatus = KnowledgeStatus.Deleted; Factory.Update(entity.ObjectValue); } }
public static int Modificar(Entidad.Articulo item) { int retorno = 0; item.Modificado = true; item.Nuevo = false; item.Borrado = false; Factory fac = new Factory(); retorno = fac.Update <Entidad.Articulo>(item, setCnsWebLun); return(retorno); }
public static int Modificar(VCFramework.Entidad.CursoApoderado cursoApoderado) { int retorno = 0; cursoApoderado.Nuevo = false; cursoApoderado.Modificado = true; cursoApoderado.Borrado = false; Factory fac = new Factory(); retorno = fac.Update <Entidad.CursoApoderado>(cursoApoderado, setCnsWebLun); return(retorno); }
public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Area_id, [FromForm] string Capacity, [FromForm] string Main_business, [FromForm] string Min_order, [FromForm] string Process_cost, [FromForm] string Sampling_period, [FromForm] string Sampling_price, [FromForm] string Telphone, [FromForm] string Title, [FromForm] string Turn_single_time, [FromForm] uint[] mn_Franchising) { FactoryInfo item = Factory.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } item.Area_id = Area_id; item.Capacity = Capacity; item.Create_time = DateTime.Now; item.Main_business = Main_business; item.Min_order = Min_order; item.Process_cost = Process_cost; item.Sampling_period = Sampling_period; item.Sampling_price = Sampling_price; item.Telphone = Telphone; item.Title = Title; item.Turn_single_time = Turn_single_time; int affrows = Factory.Update(item); //关联 Franchising if (mn_Franchising.Length == 0) { item.UnflagFranchisingALL(); } else { List <uint> mn_Franchising_list = mn_Franchising.ToList(); foreach (var Obj_franchising in item.Obj_franchisings) { int idx = mn_Franchising_list.FindIndex(a => a == Obj_franchising.Id); if (idx == -1) { item.UnflagFranchising(Obj_franchising.Id); } else { mn_Franchising_list.RemoveAt(idx); } } mn_Franchising_list.ForEach(a => item.FlagFranchising(a)); } if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }
protected void btnSave_Click(object sender, EventArgs e) { string msg = string.Empty; //string email = viviLib.XRequest.GetString("email"); string oldpass = this.txtoldpassword.Value.Trim(); string newpass = this.txtnewpassword.Value.Trim(); string repass = this.txtrepassword.Value.Trim(); if (Cryptography.MD5(oldpass) != this.CurrentUser.Password) { msg = "旧密码不正确"; } //else if (email != viviapi.BLL.User.Login.CurrentMember.Email) //{ // msg = "邮件地址不正确"; //} else if (newpass != repass) { msg = "两次密码不一致"; } else if (newpass == oldpass) { msg = "新密码不能为新一样"; } if (string.IsNullOrEmpty(msg)) { CurrentUser.Password = Cryptography.MD5(newpass); if (Factory.Update(CurrentUser, null)) { msg = "true"; } else { msg = "更新失败"; } } if (msg.Equals("true")) { ShowMessageBox("修改成功"); } else { ShowMessageBox(msg); } }
static void TurnInitialize() { Troops = new List <Troop>(); Bombs = new List <Bomb>(); int entityCount = int.Parse(Console.ReadLine()); // the number of entities (e.g. factories and troops) for (int i = 0; i < entityCount; i++) { string[] inputs = Console.ReadLine().Split(' '); int entityId = int.Parse(inputs[0]); string entityType = inputs[1]; int arg1 = int.Parse(inputs[2]); int arg2 = int.Parse(inputs[3]); int arg3 = int.Parse(inputs[4]); int arg4 = int.Parse(inputs[5]); int arg5 = int.Parse(inputs[6]); if (entityType == "FACTORY") { Factory f = Factories[entityId]; f.Update(arg1, arg2, arg3); } if (entityType == "TROOP") { Troop troop = new Troop(entityId) { Owner = arg1, Source = arg2, Target = arg3, CyborgCount = arg4, RemaingTurns = arg5, }; Troops.Add(troop); } if (entityType == "BOMB") { Bomb bomb = new Bomb(entityId) { Owner = arg1, Source = arg2, Target = arg3, RemaingTurns = arg4, }; Bombs.Add(bomb); } } }
/// <summary> /// Saves the specified Keyword. /// </summary> /// <param name="entity">The entity.</param> public void Save(Keyword entity) { entity.Validate(); if (Identifier.IsValid(entity.KeywordID)) { Factory.Update(entity.ObjectValue); } else { var value = entity.ObjectValue; if (value.KeywordTypeID == 0) { value.KeywordTypeID = (short)KeywordType.Other; } Factory.Insert(value); } }
/// <summary> /// /// </summary> void DoCmd() { if (!string.IsNullOrEmpty(this.cmd) && this.UserID > 0) { List <UsersUpdateLog> updateList = new List <UsersUpdateLog>(); UserInfo userinfo = Factory.GetModel(UserID); if (cmd == "ok") { updateList.Add(newUpdateLog("Status", ((int)userinfo.Status).ToString(), "2", "审核")); userinfo.Status = 2; } else if (cmd == "del") { updateList.Add(newUpdateLog("Status", ((int)userinfo.Status).ToString(), "4", "锁定")); userinfo.Status = 4; } else if (cmd == "pok") { updateList.Add(newUpdateLog("UserType", ((int)userinfo.UserType).ToString(), "2", "设为代理")); updateList.Add(newUpdateLog("UserLevel", ((int)userinfo.UserLevel).ToString(), "1", "设为代理")); //userinfo.UserType = UserTypeEnum.代理; //userinfo.UserLevel = UserLevelEnum.普通代理; } else if (cmd == "pdel") { updateList.Add(newUpdateLog("UserType", ((int)userinfo.UserType).ToString(), "1", "取消代理")); updateList.Add(newUpdateLog("UserLevel", ((int)userinfo.UserLevel).ToString(), "100", "取消代理")); userinfo.UserType = UserTypeEnum.会员; //userinfo.UserLevel = UserLevelEnum.初级代理; } if (Factory.Update(userinfo, updateList)) { AlertAndRedirect("操作成功", "UserList.aspx"); } else { AlertAndRedirect("操作失败"); } } }
protected void lbtnSave_Click(object sender, EventArgs e) { string msg = string.Empty; string loginpass = txtloginpwd.Value; string email = txtmail.Value; string newpass = txtcashpass.Value; string repass = txtrecashpass.Value; if (Cryptography.MD5(loginpass) != this.CurrentUser.Password) { msg = "登录密码不正确"; } if (email != CurrentUser.Email) { msg = "安全邮箱不正确"; } if (newpass != repass) { msg = "两次密码输入不一致"; } if (string.IsNullOrEmpty(msg)) { CurrentUser.Password2 = Cryptography.MD5(newpass); if (CurrentUser.Password2 == CurrentUser.Password) { msg = "登录密码与提现密码不能相同"; } else { if (Factory.Update(CurrentUser, null)) { msg = "设置成功!"; } else { msg = "更新失败"; } } } lblMessage.Visible = true; lblMessage.Text = msg; }
public async Task ProcessMailQueueAsync() { IEnumerable <EmailQueue> queue = Database.MailQueue.GetMailInQueue(this.Catalog); if (this.IsEnabled()) { foreach (EmailQueue mail in queue) { Processor processor = new Processor(this.Catalog); bool success = await processor.Send(mail.SendTo, mail.Subject, mail.Message, false, mail.Attachments.Split(',').ToArray()); if (success) { mail.Delivered = true; mail.DeliveredOn = DateTime.UtcNow; Factory.Update(this.Catalog, mail, mail.QueueId); } } } }
/// <summary> /// Saves the specified User. /// </summary> /// <param name="entity">The entity.</param> public virtual void Save(User entity) { entity.Validate(); if (Identifier.IsValid(entity.UserID)) { if (entity.UserID != KbContext.CurrentUserId && !Context.HasUserAdminPermission) { throw new PermissionException("UserAdmin"); } Factory.Update(entity.ObjectValue); } else { Context.RequireUserAdminPermission(); entity.CreationDate = DateTime.Now; Factory.Insert(entity.ObjectValue); } }
/// <summary> /// Saves the specified Category. /// </summary> /// <param name="entity">The entity.</param> public virtual void Save(Category entity) { if (entity.Context == null) { entity.Context = Context; } entity.Validate(); if (Identifier.IsValid(entity.CategoryID)) { Context.RequirePermission(entity.CategoryID, Permission.Admin); Factory.Update(entity.ObjectValue); } else { Context.RequirePermission(entity.ParentCategoryID ?? 0, Permission.Admin); entity.CreationDate = DateTime.Now.ToUniversalTime(); Factory.Insert(entity.ObjectValue); } }
protected void lbtnSave_Click(object sender, EventArgs e) { string msg = ""; string newques = txtnewques.Value; string newans = txtnewans.Value; string oldans = txtoldans.Value; if (!Isnew) { if (oldans != CurrentUser.answer) { msg = "问题答案不对"; } } if (string.IsNullOrEmpty(newques)) { msg = "新问题为空"; } else if (string.IsNullOrEmpty(newans)) { msg = "新问题为空"; } if (string.IsNullOrEmpty(msg)) { CurrentUser.question = newques; CurrentUser.answer = newans; if (Factory.Update(CurrentUser, null)) { msg = "更新成功"; } else { msg = "更新失败"; } } AlertAndRedirect(msg); }
/// <summary> /// Updates the row of the table "core.currencies" with an instance of "Currency" class against the primary key value. /// </summary> /// <param name="currency">The instance of "Currency" class to update.</param> /// <param name="currencyCode">The value of the column "currency_code" which will be updated.</param> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public void Update(dynamic currency, string currencyCode) { if (string.IsNullOrWhiteSpace(this._Catalog)) { return; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Edit, this._LoginId, this._Catalog, false); } if (!this.HasAccess) { Log.Information("Access to edit entity \"Currency\" with Primary Key {PrimaryKey} was denied to the user with Login ID {LoginId}. {Currency}", currencyCode, this._LoginId, currency); throw new UnauthorizedException("Access is denied."); } } Factory.Update(this._Catalog, currency, currencyCode, "core.currencies", "currency_code"); }
/// <summary> /// Updates the row of the table "transactions.transaction_master" with an instance of "TransactionMaster" class against the primary key value. /// </summary> /// <param name="transactionMaster">The instance of "TransactionMaster" class to update.</param> /// <param name="transactionMasterId">The value of the column "transaction_master_id" which will be updated.</param> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public void Update(dynamic transactionMaster, long transactionMasterId) { if (string.IsNullOrWhiteSpace(this._Catalog)) { return; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Edit, this._LoginId, this._Catalog, false); } if (!this.HasAccess) { Log.Information("Access to edit entity \"TransactionMaster\" with Primary Key {PrimaryKey} was denied to the user with Login ID {LoginId}. {TransactionMaster}", transactionMasterId, this._LoginId, transactionMaster); throw new UnauthorizedException("Access is denied."); } } Factory.Update(this._Catalog, transactionMaster, transactionMasterId, "transactions.transaction_master", "transaction_master_id"); }
/// <summary> /// Updates the row of the table "office.cost_centers" with an instance of "CostCenter" class against the primary key value. /// </summary> /// <param name="costCenter">The instance of "CostCenter" class to update.</param> /// <param name="costCenterId">The value of the column "cost_center_id" which will be updated.</param> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public void Update(dynamic costCenter, int costCenterId) { if (string.IsNullOrWhiteSpace(this._Catalog)) { return; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Edit, this._LoginId, this._Catalog, false); } if (!this.HasAccess) { Log.Information("Access to edit entity \"CostCenter\" with Primary Key {PrimaryKey} was denied to the user with Login ID {LoginId}. {CostCenter}", costCenterId, this._LoginId, costCenter); throw new UnauthorizedException("Access is denied."); } } Factory.Update(this._Catalog, costCenter, costCenterId, "office.cost_centers", "cost_center_id"); }
/// <summary> /// Updates the row of the table "core.verification_statuses" with an instance of "VerificationStatus" class against the primary key value. /// </summary> /// <param name="verificationStatus">The instance of "VerificationStatus" class to update.</param> /// <param name="verificationStatusId">The value of the column "verification_status_id" which will be updated.</param> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public void Update(dynamic verificationStatus, short verificationStatusId) { if (string.IsNullOrWhiteSpace(this._Catalog)) { return; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Edit, this._LoginId, this._Catalog, false); } if (!this.HasAccess) { Log.Information("Access to edit entity \"VerificationStatus\" with Primary Key {PrimaryKey} was denied to the user with Login ID {LoginId}. {VerificationStatus}", verificationStatusId, this._LoginId, verificationStatus); throw new UnauthorizedException("Access is denied."); } } Factory.Update(this._Catalog, verificationStatus, verificationStatusId, "core.verification_statuses", "verification_status_id"); }
/// <summary> /// Updates the row of the table "hrm.education_levels" with an instance of "EducationLevel" class against the primary key value. /// </summary> /// <param name="educationLevel">The instance of "EducationLevel" class to update.</param> /// <param name="educationLevelId">The value of the column "education_level_id" which will be updated.</param> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public void Update(dynamic educationLevel, int educationLevelId) { if (string.IsNullOrWhiteSpace(this._Catalog)) { return; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Edit, this._LoginId, this._Catalog, false); } if (!this.HasAccess) { Log.Information("Access to edit entity \"EducationLevel\" with Primary Key {PrimaryKey} was denied to the user with Login ID {LoginId}. {EducationLevel}", educationLevelId, this._LoginId, educationLevel); throw new UnauthorizedException("Access is denied."); } } Factory.Update(this._Catalog, educationLevel, educationLevelId, "hrm.education_levels", "education_level_id"); }
/// <summary> /// Updates the row of the table "core.widgets" with an instance of "Widget" class against the primary key value. /// </summary> /// <param name="widget">The instance of "Widget" class to update.</param> /// <param name="widgetName">The value of the column "widget_name" which will be updated.</param> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public void Update(dynamic widget, string widgetName) { if (string.IsNullOrWhiteSpace(this._Catalog)) { return; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Edit, this._LoginId, this._Catalog, false); } if (!this.HasAccess) { Log.Information("Access to edit entity \"Widget\" with Primary Key {PrimaryKey} was denied to the user with Login ID {LoginId}. {Widget}", widgetName, this._LoginId, widget); throw new UnauthorizedException("Access is denied."); } } Factory.Update(this._Catalog, widget, widgetName, "core.widgets", "widget_name"); }