public BusinessResult <bool> Update(Label model) { BusinessBase <bool> update = new BusinessBase <bool>(logger); Func <bool> onBeforeExecute = () => { var result = repository.Any(x => x.Title.Equals(model.Title) && x.LabelId != model.LabelId && x.RecordStatusId == RecordStatus.Exist); if (result) { update.Result.Message = new BusinessMessage("اطلاعات تکراری", "برچسب وارد شده تکراری می باشد.", MessageType.Error); return(false); } return(true); }; Func <bool> onExecute = () => { model.UserId = (Thread.CurrentPrincipal.Identity as Identity).Id; return(repository.Update(model)); }; update.Execute(onBeforeExecute, onExecute, null); if (update.Result.IsOnExecute) { update.Result.Data = true; update.Result.Message = new BusinessMessage("افزودن اطلاعات", "عملیات ویرایش با موفقیت انجام شد.", MessageType.Information); } return(update.Result); }
public static bool ComprobarUnicidad(BusinessBase obj, string campo) { string buscar = Lib.NoStringNulo(obj[campo]).Trim().Replace("'", "''"); if (buscar.Length > 3 && (obj.Modificado || obj.Nuevo)) { string sql = "Select IDEmpresa From Empresa Where " + campo + " = '" + buscar + "'"; string sqlED = "Select IDEmpresaDelegacion From EmpresaDelegacion Where " + campo + " = '" + buscar + "'"; if (!obj.Nuevo) { string idEmpresa = (obj is Empresa ? obj.IDActual[0].ToString() : Lib.NoStringNulo(obj["IDEmpresa"])); sql += " AND IDEmpresa != " + idEmpresa; sqlED += " AND IDEmpresa != " + idEmpresa; } if (Data.Instancia().DameExpresionInt(sql) != 0) { obj.ErrorMensaje = "Existe otra empresa con el mismo " + (campo == "CIF" ? "CIF" : "Código de " + Empresa.NombreContabilidad) + " '" + Lib.NoStringNulo(obj[campo]).Trim() + "'."; return(false); } if (Data.Instancia().DameExpresionInt(sqlED) != 0) { obj.ErrorMensaje = "Existe otra delegación con el mismo " + (campo == "CIF" ? "CIF" : "Código de " + Empresa.NombreContabilidad) + " '" + Lib.NoStringNulo(obj[campo]).Trim() + "'."; return(false); } } return(true); }
public static DataSet SearchPositionDescription(int userID, int searchType, long?positionDescriptionID, char?isStandardPD, int?PositionDescriptionTypeID, int?jobSeries, int?workflowStatusID, int?proposedGrade, string opmPositionTitle, string agencyPositionTitle, int?organizationCodeID, string pdCreator, int?pdNumberType, string fppsPDID , string keyword, int?regionID ) { object[] parameters = new object[] { userID, searchType, positionDescriptionID, isStandardPD, PositionDescriptionTypeID, jobSeries, workflowStatusID, proposedGrade, opmPositionTitle, agencyPositionTitle, organizationCodeID, pdCreator, pdNumberType, fppsPDID, keyword, regionID }; DataSet dsPositionDescription = BusinessBase.ExecuteDataSet("[dbo].[spr_SearchPositionDescription]", parameters); return(dsPositionDescription); }
public BusinessResult <bool> Add(Label model) { BusinessBase <bool> add = new BusinessBase <bool>(logger); Func <bool> onBeforeExecute = () => { bool result = repository.Any(x => x.Title == model.Title && x.RecordStatusId == RecordStatus.Exist); if (result) { add.Result.Data = false; add.Result.Message = new BusinessMessage("اطلاعات تکراری", "برچسب وارده شده تکراری می باشد.", MessageType.Error); return(false); } return(true); }; Func <bool> onExecute = () => { model.UserId = (Thread.CurrentPrincipal.Identity as Identity).Id; model.RecordStatusId = RecordStatus.Exist; model.CreateDate = repository.GetDateTime(); return(repository.Add(model)); }; add.Execute(onBeforeExecute, onExecute, null); if (add.Result.IsOnExecute) { add.Result.Data = true; add.Result.Message = new BusinessMessage("افزودن اطلاعات", "عملیات افزودن با موفقیت انجام شد.", MessageType.Information); } return(add.Result); }
public BusinessResult <bool> Delete(Person model) { BusinessBase <bool> delete = new BusinessBase <bool>(logger); delete.Execute(() => { model.RecordStatusId = RecordStatus.Deleted; var listResult = repository.GetAll(x => x.OrderItem > model.OrderItem && x.RecordStatusId == RecordStatus.Exist); foreach (var item in listResult) { item.OrderItem--; } return(repository.Update(model)); }); if (delete.Result.IsOnExecute) { delete.Result.Data = true; delete.Result.Message = new BusinessMessage("حذف اطلاعات", "عملیات حذف با موفقیت انجام شد.", MessageType.Information); } return(delete.Result); }
public IHttpActionResult GetRUsuarioByCCF() { try { if (HelperGeneral.IsUserLogin()) { //HelperGeneral.SaveFile(); var usuario = HelperGeneral.GetSession(); var CCFUserLogin = this.objDb.Get(o => o.Usuario == usuario).FirstOrDefault().IdCcf; var obj = this.objDb.Get(o => o.IdCcf == CCFUserLogin).ToList(); using (BusinessBase <RCCF> objRCCF = new BusinessBase <RCCF>()) { using (BusinessBase <RRole> objRRole = new BusinessBase <RRole>()) { foreach (var item in obj) { item.RCCF = objRCCF.Get(o => o.IdCcf == item.IdCcf).FirstOrDefault(); item.RRole = objRRole.Get(o => o.IdRole == item.IdRole).FirstOrDefault(); } } } return(Ok(obj)); } else { return(Ok(HelperGeneral.resultsNull())); } } catch (Exception ex) { return(Ok(HelperGeneral.exceptionError(ex))); } }
public static void MarkOld(this BusinessBase cslaBo) { var markOldMethod = typeof(Csla.Core.BusinessBase).GetMethod("MarkOld", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); markOldMethod.Invoke(cslaBo, null); }
private void UpdateState() { Popup popup = (Popup)FindName("popup"); if (popup != null) { popup.IsOpen = false; } BusinessBase businessObject = Source as BusinessBase; if (businessObject != null) { // for some reason Linq does not work against BrokenRulesCollection... List <BrokenRule> allRules = new List <BrokenRule>(); foreach (var r in businessObject.BrokenRulesCollection) { if (r.Property == Property) { allRules.Add(r); } } var removeRules = (from r in BrokenRules where !allRules.Contains(r) select r).ToArray(); var addRules = (from r in allRules where !BrokenRules.Contains(r) select r).ToArray(); foreach (var rule in removeRules) { BrokenRules.Remove(rule); } foreach (var rule in addRules) { BrokenRules.Add(rule); } BrokenRule worst = (from r in BrokenRules orderby r.Severity select r).FirstOrDefault(); if (worst != null) { _worst = worst.Severity; } _isValid = BrokenRules.Count == 0; GoToState(true); } else { BrokenRules.Clear(); _isValid = true; GoToState(true); } }
public static PropertyInfo <T> Register <TTarget, T>(Expression <Func <TTarget, object> > propertyLambdaExpression, RelationshipTypes relationship) { var property = new PropertyInfo <T>( Reflect <TTarget> .GetProperty(propertyLambdaExpression).Name, relationship); return(BusinessBase.RegisterProperty <T>(typeof(TTarget), property)); }
private void Collect(BusinessBase businessObject) { if (_brokenRules != null) { foreach (BrokenRule br in businessObject.BrokenRulesCollection) { _brokenRules.Add(br, businessObject); } } }
private void Collect(BusinessBase businessObject) { if (_brokenRules != null) { foreach (BrokenRule br in businessObject.BrokenRulesCollection) { _brokenRules.Add(br, businessObject); } } }
public AppUser SelectById(int?id) { AppUser appUser = new AppUser(); dataProvider.ExecuteCmd( "AppUser_SelectById1", (parameters) => { parameters.AddWithValue("@Id", id); }, (reader, resultSetIndex) => { switch (resultSetIndex) { case 0: appUser.Id = (int)reader["Id"]; appUser.FirstName = (string)reader["FirstName"]; appUser.LastName = (string)reader["LastName"]; appUser.Email = (string)reader["Email"]; appUser.AvatarUrl = reader["AvatarUrl"] as string; appUser.TenantId = (int)reader["TenantId"]; appUser.DateCreated = (DateTime)reader["DateCreated"]; appUser.DateModified = (DateTime)reader["DateModified"]; appUser.CustomerBusinessId = reader.GetSafeInt32Nullable("CustomerBusinessId"); appUser.CustomerBusinessName = reader.GetSafeString("CustomerBusinessName"); appUser.DefaultBusinessId = reader.GetSafeInt32Nullable("DefaultBusinessId"); appUser.DefaultBusinessName = reader.GetSafeString("DefaultBusinessName"); break; case 1: if (appUser.UserRoleIds == null) { appUser.UserRoleIds = new List <int>(); } int appUserRoleId = reader.GetSafeInt32("UserRoleId"); appUser.UserRoleIds.Add(appUserRoleId); break; case 2: if (appUser.Businesses == null) { appUser.Businesses = new List <BusinessBase>(); } BusinessBase bb = new BusinessBase() { Id = reader.GetSafeInt32("Id"), Name = reader.GetSafeString("Name") }; appUser.Businesses.Add(bb); break; } }); return(appUser); }
/// <summary> /// 获取用户信息 /// </summary> /// <param name="tel">手机号</param> /// <returns></returns> public LoginInfoModel GetUserInfo(string tel) { using (var db = new BusinessBase().OpenConnection()) { string sql = @"select um.id as userid,um.wx_open_id as wxopenid from user_main as um where um.user_name=@tel"; DynamicParameters param = new DynamicParameters(); param.Add("tel", tel); var result = db.Query <LoginInfoModel>(sql, param) as List <LoginInfoModel>; return(result.FirstOrDefault()); } }
/// <summary> /// 查询实名认证信息 /// </summary> /// <returns></returns> public RealNameAuthenticationModel FindRealName(int user_id) { using (var db = new BusinessBase().OpenConnection()) { string viewSQl = (@"select real_name,card_no,card_type from user_realInfo where user_id=@user_id"); DynamicParameters param = new DynamicParameters(); param.Add("user_id", user_id); var result = db.Query <RealNameAuthenticationModel>(viewSQl, param); return(result.FirstOrDefault()); } }
public int BuildTreeNode(BusinessBase businessObject, int parentId, bool initiallyExpanded) { int id = GetUid(); if (BusinessObjectTree != null) { var brokenRulesCollector = new BrokenRulesCollector(businessObject); brokenRulesCollector.Collect(); BusinessObjectTree.Add(new TreeNode(id, parentId, ((IDisplayTexts) businessObject).ToDisplayText(), businessObject, brokenRulesCollector.BrokenRules, initiallyExpanded)); } return id; }
/// <summary> /// 获取用户权限 /// </summary> /// <param name="userid">用户id</param> /// <returns></returns> public string GetUserRole(string userid) { using (var db = new BusinessBase().OpenConnection()) { string sql = @"select top 1 F_RoleId as Roleid from Sys_User as sysuser left join Sys_Role as sysrole on sysuser.F_id=sysrole.F_id where sysuser.F_Id=@userid and (sysuser.F_RoleId='13b8fe89-c60c-48c0-a01d-2c4b6149fa27' or sysuser.F_RoleId='13b8fe89-c60c-48c0-a01d-2c4b6Leaders')"; DynamicParameters param = new DynamicParameters(); param.Add("userid", userid); var result = db.Query <string>(sql, param).FirstOrDefault(); return(result); } }
private void HandleSourceEvents(object old, object source) { if (!ReferenceEquals(old, source)) { DetachSource(old); AttachSource(source); BusinessBase bb = Source as BusinessBase; if (bb != null) { IsBusy = bb.IsPropertyBusy(Property); } } }
public int BuildTreeNode(BusinessBase businessObject, int parentId, bool initiallyExpanded) { int id = GetUid(); if (BusinessObjectTree != null) { var brokenRulesCollector = new BrokenRulesCollector(businessObject); brokenRulesCollector.Collect(); BusinessObjectTree.Add(new TreeNode(id, parentId, ((IDisplayTexts)businessObject).ToDisplayText(), businessObject, brokenRulesCollector.BrokenRules, initiallyExpanded)); } return(id); }
protected override void Dispose(bool disposing) { if (disposing) { if (this.objDb != null) { this.objDb.Dispose(); this.objDb = null; } //this.o.Dispose(); } base.Dispose(disposing); }
/// <summary> /// 总渠道 /// </summary> /// <returns></returns> public List <TotalChannel> GetTotalChannel() { using (var db = new BusinessBase().OpenConnection()) { string sql = @" select CONVERT(varchar(10),um.create_time, 25)as createtime from WeChatServiceFlatform.dbo.user_main um inner join WeChatServiceFlatform.dbo.user_type ut on um.id = ut.user_id inner join WeChatServiceFlatform.dbo.user_main ums on um.wx_open_id_b=ums.wx_open_id inner join WeChatServiceFlatform.dbo.user_type uts on ums.id =uts.user_id INNER join WeChatServiceFlatform.dbo.Sys_User sus on sus.F_Id = CONVERT(varchar(50),ums.id) where ut.user_type=1 and uts.user_type=0"; var result = db.Query <TotalChannel>(sql) as List <TotalChannel>; return(result.ToList()); } }
private void ValidateRule(Rule rule, BusinessBase businessBase) { if (rule.RuleType == RuleType.Custom) { rule.Validate(businessBase); } else if (!String.IsNullOrEmpty(rule.PropertyName)) { object value = Shared.FindPropertyValue(rule.PropertyName, businessBase); rule.Validate(value); } }
/// <summary> /// 单日销售额 /// </summary> /// <returns></returns> public List <DaySalesVolume> GetDaySalesVolumes(string startTime, string endTime) { using (var db = new BusinessBase().OpenConnection()) { string sql = string.Format(@"select dayData.createtime,sum(isnull(dayData.pricetotal ,0)) as pricetotal from ( select CONVERT(varchar(10),ord.create_time, 25)as createtime,ord.price_total as pricetotal from [dbo].[order_main_spnc] as ord where ord.create_time BETWEEN '{0} 00:00:00' AND '{1} 23:59:59') as dayData group by dayData.createtime order by dayData.createtime" , startTime, endTime); var result = db.Query <DaySalesVolume>(sql) as List <DaySalesVolume>; return(result.ToList()); } }
/// <summary> /// 单日订单数 /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns></returns> public List <DayOrderNum> GetDayOrderNums(string startTime, string endTime) { using (var db = new BusinessBase().OpenConnection()) { string sql = string.Format(@"select dayData.createtime,COUNT(*) as ordernum from ( select CONVERT(varchar(10),ord.create_time, 25)as createtime from [dbo].[order_main_spnc] as ord where ord.create_time BETWEEN '{0} 00:00:00' AND '{1} 23:59:59' )as dayData group by dayData.createtime order by dayData.createtime" , startTime, endTime); var result = db.Query <DayOrderNum>(sql) as List <DayOrderNum>; return(result.ToList()); } }
/// <summary> /// 单日授权用户 /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns></returns> public List <DayUserNum> GetUserNums(string startTime, string endTime) { using (var db = new BusinessBase().OpenConnection()) { string sql = string.Format(@"select dayData.createtime,COUNT(*) as usernum from ( select CONVERT(varchar(10),um.create_time, 25)as createtime from [dbo].[user_main] as um left join user_type as ut on um.id=ut.user_id where ut.user_type=3 and um.create_time BETWEEN'{0} 00:00:00' AND '{1} 23:59:59' )as dayData group by dayData.createtime order by dayData.createtime" , startTime, endTime); var result = db.Query <DayUserNum>(sql) as List <DayUserNum>; return(result.ToList()); } }
public bool IsOrganizationCodeSupervisor(int OrganizationCodeID) { bool isOrgcodesupervisor = false; try { isOrgcodesupervisor = (bool)BusinessBase.ExecuteScalar("spr_IsOrgCodeSupervisor", this._userID, OrganizationCodeID); } catch (Exception ex) { HandleException(ex); } return(isOrgcodesupervisor); }
public BusinessResult <bool> Delete(Label model) { BusinessBase <bool> delete = new BusinessBase <bool>(logger); model.RecordStatusId = RecordStatus.Deleted; delete.Execute(() => repository.Update(model)); if (delete.Result.IsOnExecute) { delete.Result.Data = true; delete.Result.Message = new BusinessMessage("حذف اطلاعات", "عملیات حذف با موفقیت انجام شد.", MessageType.Information); } return(delete.Result); }
public bool CanViewReportsWithPhoneNumber() { bool canView = false; try { canView = (bool)BusinessBase.ExecuteScalar("spr_CanUserViewReportsWithPhoneNumber", this._userID); } catch (Exception ex) { HandleException(ex); } return(canView); }
private void SetSource(object oldSource, object newSource) { DetachSource(oldSource); AttachSource(newSource); BusinessBase bb = newSource as BusinessBase; if (bb != null && !string.IsNullOrEmpty(Property)) { IsBusy = bb.IsPropertyBusy(Property); } UpdateState(); }
public static DataTable GetJNPAccessForUser(long jnpID, int userID) { DataTable dt = new DataTable(); try { dt = BusinessBase.ExecuteDataTable("GetJNPAccessForUser", jnpID, userID); } catch (Exception ex) { HandleException(ex); } return(dt); }
/// <summary> /// 根据渠道id查询渠道具体详细信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public Info_TotalDataModel FindChannelDetail(int id) { using (var db = new BusinessBase().OpenConnection()) { string sqlView = (@"select um.id,um.wx_picture,ISNULL(ct.career_type_name,'未激活') as career_type_name,um.user_nickname, DATEDIFF(DAY,um.create_time,GETDATE()) as count_day from user_main um left join career_type ct on um.career_type = ct.id where um.id=@id"); DynamicParameters param = new DynamicParameters(); param.Add("id", id); var result = db.Query <Info_TotalDataModel>(sqlView, param) as List <Info_TotalDataModel>; return(result.FirstOrDefault()); } }
public override void ValoresPorDefecto(BusinessBase origen) { if (origen == null) { return; } if (origen is Empresa) { this["Razon"] = origen["Razon"]; } if (this["Razon"] is DBNull && origen.ObjetoAsociado("Empresa") != null) { this["Razon"] = origen.ObjetoAsociado("Empresa")["Razon"]; } base.ValoresPorDefecto(origen); }
/// <summary> /// 获取渠道详细信息 /// </summary> /// <returns>渠道id</returns> public Channel_User_Info GetChannel_User_Info(int userid) { using (var db = new BusinessBase().OpenConnection()) { string sql = @"select ut.user_type_name as channeltype,ue.name as username,ue.mobile_number as phone,ct.career_type_name as channelname,up.village as address from user_main as um join user_type as ut on um.id=ut.user_id left join user_extra as ue on um.id=ue.user_id left join career_type as ct on um.career_type=ct.id left join user_pickup_info as up on um.id=up.user_id where ut.user_type=1 and um.id=@userid "; DynamicParameters param = new DynamicParameters(); param.Add("userid", userid); var result = db.Query <Channel_User_Info>(sql, param) as List <Channel_User_Info>; return(result.FirstOrDefault()); } }
void source_BusyChanged(object sender, BusyChangedEventArgs e) { if (e.PropertyName == PropertyName || string.IsNullOrEmpty(e.PropertyName)) { bool busy = e.Busy; BusinessBase bb = Source as BusinessBase; if (bb != null) { busy = bb.IsPropertyBusy(PropertyName); } if (busy != IsBusy) { IsBusy = busy; UpdateState(); } } }
/// <summary> /// Adds the field. /// </summary> /// <param name="sectionId">The section identifier.</param> /// <param name="parentModel">The parent model.</param> /// <param name="f">The f.</param> public void AddField(int sectionId, BusinessBase parentModel, FieldEdit f) { foreach (var step in f.StepList) { step.AddProps(); } var expandableObj = new ExpandableStepPropBag(parentModel) { FieldSecurityManager = ProcessScreenSecuritySettings, Model = f }; foreach (var step in f.StepList) { step.UpdateProps(expandableObj); } expandableObj.PreviewMode = true; //if (expandableObj.SectionId == sectionId) { Fields.Add(expandableObj); FieldList.Add(f); } }
internal List<Rule> Validate(BusinessBase businessBase, params Rule[] rules) { Rules.ForEach(r => r.Valid = true); Rules.AddRange(rules); foreach (var rule in Rules) { if (rule.Ignored) { continue; } ValidateRule(rule, businessBase); } return Rules.FindAll(r => r.Valid == false); }
private static void Static(WeakEventListener<SpreadsheetCellDataFieldViewModel, BusinessBase, PropertyChangedEventArgs> listener, BusinessBase source) { source.PropertyChanged -= listener.OnEvent; }
public void AddToBusinessBases(BusinessBase businessBase) { base.AddObject("BusinessBases", businessBase); }
/// <summary> /// Initializes a new instance of the <see cref="ChildWindowResult"/> class. /// </summary> /// <param name="closeAction">The close action.</param> /// <param name="item">The item.</param> public ChildWindowResult(ChildWindowCloseActions closeAction, BusinessBase item) { CloseAction = closeAction; Item = item; }
public BrokenRulesCollector(BusinessBase businessObject) { _businessObject = businessObject; _brokenRules = new ExtendedBrokenRulesCollection(); }
public EditTreeValidator(BusinessBase parentBusinessObject) { _parentBusinessObject = parentBusinessObject; }
private static void Static(WeakEventListener<BusinessObjectIsValidListener, BusinessBase, ChildChangedEventArgs> listener, BusinessBase source) { source.ChildChanged -= listener.OnEvent; }