/// <summary> /// 删除 /// </summary> private void DoDeleteSelected() { OrgEntity removeEntity = SelectedRow; if (removeEntity == null) { MsgBox.Warn("请选中要删除的行。"); return; } if (MsgBox.AskOK(string.Format("确定要删除{0}吗?", removeEntity.OrgName)) == DialogResult.OK) { int result = OrgDal.Delete(removeEntity.OrgCode); if (result == 1) { bindingSource1.Remove(removeEntity); ReLoad(); } else if (result == -1) { MsgBox.Warn("不能删除,该行有相关联的仓库。"); } else if (result == -2) { MsgBox.Warn("不能删除,该行有相关联的用户。"); } } }
public virtual async Task <_ <OrgEntity> > UpdateOrg(OrgEntity model) { model.Should().NotBeNull(); model.Id.Should().NotBeNullOrEmpty(); var res = new _ <OrgEntity>(); var entity = await this._orgRepo.QueryOneAsync(x => x.Id == model.Id); entity.Should().NotBeNull("组织不存在"); entity.OrgDescription = model.OrgDescription; entity.OrgImage = model.OrgImage; entity.OrgWebSite = model.OrgWebSite; entity.Phone = model.Phone; entity.SetUpdateTime(); if (!entity.IsValid(out var msg)) { res.SetErrorMsg(msg); return(res); } await this._orgRepo.UpdateAsync(entity); res.SetSuccessData(entity); return(res); }
private void OnCreateChanage(object sender, EventArgs e) { OrgEntity newEntity = (OrgEntity)sender; bindingSource1.Add(newEntity); bindingSource1.ResetBindings(false); }
private void InitView() { _appList = _nsiService.Applications; _appList.Add(AppEntity.Create()); _orgList = _nsiService.Organizations; _orgList.Add(OrgEntity.Create()); _userList = _nsiService.Users; _userList.Add(UserEntity.Create()); _tagList = _nsiService.Tags; _dialogResult = null; _control = new RequestFilterControl(this); _caption = string.Format("Параметри пошуку звернень", ""); _hint = string.Format("Параметри пошуку звернень", ""); _image = Properties.Resources.Request; _filterList = new List <RequestListFilterEntity>(); foreach (RequestListFilterEntity filter in _mainController.Filters) { _filterList.Add(filter.Clone()); } if (_filterOrigin == null) { Filter = RequestListFilterEntity.Create(); } else { Filter = _filterOrigin.Clone(); } }
/// <summary> /// 修改组织机构 /// </summary> /// <param name="orgEntity"></param> /// <param name="tran"></param> /// <returns></returns> public static int UpdateOrg(OrgEntity orgEntity, YicelTransaction tran) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@OrgID", orgEntity.OrgID), new SqlParameter("@OrgName", orgEntity.OrgName), new SqlParameter("@Coperson", orgEntity.Coperson), new SqlParameter("@CardType", orgEntity.CardType), new SqlParameter("@CardNum", orgEntity.CardNum), new SqlParameter("@ParentOrgID", orgEntity.ParentOrgId), new SqlParameter("@ParentOrgName", orgEntity.ParentOrgName), new SqlParameter("@Reperson", orgEntity.Reperson), new SqlParameter("@PhoneNum", orgEntity.PhoneNum), // new SqlParameter("@TelePhone",orgEntity.TelePhone),//组织编码不能修改 new SqlParameter("@Email", orgEntity.Email), new SqlParameter("@Address", orgEntity.Address), new SqlParameter("@AddTime", orgEntity.AddTime), new SqlParameter("@Status", (int)orgEntity.Status) }; StringBuilder strSql = new StringBuilder(); // strSql.AppendFormat(@"UPDATE Base_Org SET // OrgName = @OrgName,Coperson = @Coperson,CardType =@CardType,CardNum = @CardNum,ParentOrgID = @ParentOrgID,ParentOrgName=@ParentOrgName,Reperson = @Reperson, // PhoneNum = @PhoneNum,TelePhone = @TelePhone,Email = @Email,Address =@Address,AddTime = @AddTime,Status = @Status // WHERE OrgID = @OrgID", Fields.Org_FIELD_List); strSql.AppendFormat(@"UPDATE Base_Org SET OrgName = @OrgName,Coperson = @Coperson,CardType =@CardType,CardNum = @CardNum,ParentOrgID = @ParentOrgID,ParentOrgName=@ParentOrgName,Reperson = @Reperson, PhoneNum = @PhoneNum,Email = @Email,Address =@Address,AddTime = @AddTime,Status = @Status WHERE OrgID = @OrgID", Fields.Org_FIELD_List); object obj = DbHelper.ExecuteNonQuery(strSql.ToString(), parms, tran.Transaction); return(obj == null || obj == DBNull.Value ? 0 : Convert.ToInt32(obj)); }
RequestListFilterEntity SettingToFilter(FilterEntitySetting setting) { RequestListFilterEntity filter = RequestListFilterEntity.Create(); filter.CloneKey = new IdentKey(setting.CloneKey); filter.FilterName = setting.FilterName; filter.StartDateTime = setting.StartDateTime; filter.StopDateTime = setting.StopDateTime; UserEntity user = _nsiService.GetUserById(setting.ResponseId); filter.ResponseUser = user == null?UserEntity.Create() : user; user = _nsiService.GetUserById(setting.CreatorId); filter.CreatorUser = user == null?UserEntity.Create() : user; AppEntity app = _nsiService.GetAppById(setting.ApplicationId); filter.Application = app == null?AppEntity.Create() : app; OrgEntity org = _nsiService.GetOrgById(setting.OrganizationId); filter.Organization = org == null?OrgEntity.Create() : org; filter.Comments = setting.Comments; filter.Subject = setting.Subject; filter.Contact = setting.Contact; filter.TagIdList = setting.TagIdList; filter.StatusIdList = setting.StatusIdList; return(filter); }
public override bool FullEquals(RequestListFilterEntity other) { if (other == null) { return(false); } if (object.ReferenceEquals(this, other)) { return(true); } return(other != null && StartDateTime == other.StartDateTime && Nullable.Equals(StopDateTime, other.StopDateTime) && UserEntity.Equals(ResponseUser, other.ResponseUser) && UserEntity.Equals(CreatorUser, other.CreatorUser) && AppEntity.Equals(Application, other.Application) && OrgEntity.Equals(Organization, other.Organization) && string.Equals(StatusIdList, other.StatusIdList) && string.Equals(TagIdList, other.TagIdList) && string.Equals(Subject, other.Subject) && string.Equals(Comments, other.Comments) && string.Equals(Contact, other.Contact) && string.Equals(RequestId, other.RequestId)); }
private static InvitationIsEnabledResult Check(OrgEntity org, String message) { if (org != null && org.IsInvEnabled) return new InvitationIsEnabledResult(true, null); return new InvitationIsEnabledResult(false, message); }
public void UpdateOrg(OrgEntity org) { org.UpdateTime = DateTime.Now; this.Org.Attach(org); this.Entry <OrgEntity>(org).Property(nameof(org.Cloud_TenantId)).IsModified = true; this.SaveChanges(); }
public int CreateOrg(OrgEntity org) { org.UpdateTime = DateTime.Now; this.Org.Add(org); this.SaveChanges(); return(org.Id); }
/// <summary> /// 添加或编辑 /// </summary> /// <param name="entity"></param> /// <param name="isNew">添加或编辑</param> /// <returns></returns> public int Save(OrgEntity entity, bool isNew) { IMapper map = DatabaseInstance.Instance(); int ret = -2; if (isNew) { //检查编号是否已经存在 if (IsCodeExists(entity)) { return(-1); } ret = map.Execute("insert into ORGANIZATIONS(ORG_CODE, ORG_NAME, ALLOW_EDIT, IS_ACTIVE) " + "values(@COD, @NAM, @ALLOW_EDIT, @IS_ACTIVE)", new { COD = entity.OrgCode, NAM = entity.OrgName, ALLOW_EDIT = entity.AllowEdit, IS_ACTIVE = entity.IsActive }); } else { //更新 ret = map.Execute("update ORGANIZATIONS set ORG_NAME = @NAM where ORG_CODE = @COD", new { COD = entity.OrgCode, NAM = entity.OrgName }); } return(ret); }
private static OrgNotExistsResult Check(OrgEntity org, string message) { if (org != null) { return new OrgNotExistsResult(false, message, org); } return new OrgNotExistsResult(true, null, null); }
public virtual void AssignFrom(OrgEntity entity) { if (entity == null) throw new ArgumentNullException(nameof(entity)); this.Id = entity.Id; this.Name = entity.Name; this.AdminStaff = entity.AdminStaff?.ToViewModel(); this.IsInvEnabled = entity.IsInvEnabled; this.SecurityStamp = entity.SecurityStamp; }
public RequestListFilterEntity() : base("ReqFilter") { FilterName = "Новий фільтр"; StartDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(-3); StopDateTime = null; ResponseUser = UserEntity.Create(); CreatorUser = UserEntity.Create(); Application = AppEntity.Create(); Organization = OrgEntity.Create(); }
/// <summary> /// 检查编码是否已存在 /// </summary> /// <param name="org"></param> /// <returns></returns> private bool IsCodeExists(OrgEntity org) { IMapper map = DatabaseInstance.Instance(); string id = map.ExecuteScalar <string>("select ORG_CODE from ORGANIZATIONS where ORG_CODE = @COD", new { COD = org.OrgCode }); if (!string.IsNullOrEmpty(id)) { return(true); } return(false); }
private RequestEntity ToRequest(DataRow row) { RequestEntity request = new RequestEntity(); request.IsPersisit = true; request.Id = row["ID"].ToString(); request.ReqDateTime = Convert.ToDateTime(row["REQ_DATE"]); request.CreateDateTime = Convert.ToDateTime(row["CREATE_DATE"]); request.Subject = row["SUBJECT"].ToString(); request.Comments = row["NOTE"].ToString(); request.Contact = row["CONTACT"].ToString(); AppEntity application = _nsiService.GetAppById(row["COMP_ID"].ToString()); if (application != null) { request.Application = application; } request.TagsString = row["TAGS"].ToString(); OrgEntity organization = _nsiService.GetOrgById(row["ORG_ID"].ToString()); if (organization != null) { request.Organization = organization; } UserEntity respUser = _nsiService.GetUserById(row["RESP_ID"].ToString()); if (respUser != null) { request.ResponseUser = respUser; } UserEntity creator = _nsiService.GetUserById(row["CREATOR_ID"].ToString()); if (creator != null) { request.CreatorUser = creator; } request.InfoSourceType = (InfoSourceType)Convert.ToInt32(row["REQ_TYPE"]); request.State = (RequestState)Convert.ToInt32(row["REQ_STATE"]); request.BugNumber = row["BUG_NUM"].ToString(); request.CMVersion = row["CM_NUM"].ToString(); request.ComponentVersion = row["VER_NUM"].ToString(); request.IsImportant = row["IMPORTANT"].ToString() == "1"; return(request); }
///<summary> ///枚举所有 ///</summary> ///<returns></returns> public List <OrgEntity> GetAllOrganization() { List <OrgEntity> list = new List <OrgEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); //loStr.Append("vhNo=").Append(vehicleNO); string jsons = string.Empty; string jsonQuery = WebWork.SendRequest(jsons, WebWork.URL_GetAllOrganization); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonGetAllOrganization bill = JsonConvert.DeserializeObject <JsonGetAllOrganization>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonGetAllOrganizationResult jbr in bill.result) { OrgEntity asnEntity = new OrgEntity(); asnEntity.OrgCode = jbr.orgCode; asnEntity.OrgName = jbr.orgName; list.Add(asnEntity); } return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }
RequestEntity SettingToRequest(RequestEntitySetting setting) { RequestEntity request = RequestEntity.Create(); request.Id = setting.Id; request.ReqDateTime = setting.RequestDateTime; request.CreateDateTime = setting.CreateDateTime; request.Subject = setting.Subject; request.Comments = setting.Comments; request.Contact = setting.Contact; AppEntity app = _nsiService.GetAppById(setting.ApplicationId); request.Application = app == null?AppEntity.Create() : app; OrgEntity org = _nsiService.GetOrgById(setting.OrganizationId); request.Organization = org == null?OrgEntity.Create() : org; UserEntity user = _nsiService.GetUserById(setting.ResponseId); request.ResponseUser = user == null?UserEntity.Create() : user; user = _nsiService.GetUserById(setting.CreatorId); request.CreatorUser = user == null?UserEntity.Create() : user; if (setting.TagIdList != null) { foreach (string id in setting.TagIdList) { TagEntity tag = _nsiService.GetTagById(id); if (tag != null) { request.Tags.Entities.Add(tag); } else { _logger.Warn("Can not find tag with such id = {0}", id); } } } //request.Attaches = setting.Attaches.Clone(); request.InfoSourceType = setting.InfoSourceType; request.State = setting.State; request.BugNumber = setting.BugNumber; request.CMVersion = setting.CMVersion; request.ComponentVersion = setting.ComponentVersion; request.IsImportant = setting.IsImportant; return(request); }
public static int UpdateChileOrg(OrgEntity orgEntity, YicelTransaction tran) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@ParentOrgID", orgEntity.ParentOrgId), new SqlParameter("@ParentOrgName", orgEntity.ParentOrgName) }; StringBuilder strSql = new StringBuilder(); strSql.AppendFormat(@"UPDATE Base_Org SET ParentOrgName=@ParentOrgName WHERE ParentOrgID = @ParentOrgID"); object obj = DbHelper.ExecuteNonQuery(strSql.ToString(), parms, tran.Transaction); return(obj == null || obj == DBNull.Value ? 0 : Convert.ToInt32(obj)); }
private void GetParent(HashSet <long> hset, List <OrgEntity> perms, OrgEntity perm) { if (hset.Add(perm.Id)) { if (!perm.ParentId.Equals("0")) { var parentPerm = perms.FirstOrDefault(p => p.Id.Equals(perm.ParentId)); if (parentPerm != null) { GetParent(hset, perms, parentPerm); } } } }
public RequestEntity() : base("Request") { Tags = new EntityList <TagEntity>(); Attaches = new EntityList <AttachEntity>(); InfoSourceType = InfoSourceType.Call; State = RequestState.Open; Organization = OrgEntity.Create(); Application = AppEntity.Create(); ResponseUser = UserEntity.Create(); CreatorUser = UserEntity.Create(); CreateDateTime = DateHlp.GetDateTime_hhmmss(); ReqDateTime = DateHlp.GetDateTime_hhmmss(); PropertyChanged += new PropertyChangedEventHandler(RequestEntity_PropertyChanged); }
public void RemoveOrg(OrgEntity org) { if (org == null) { throw new NullReferenceException("Org param can not be null."); } _logger.Debug("RemoveUser. Id = {0}", org.Id); OraCommand command = new OraCommand("MAIN_PKG.DEL_ORG"); command.CommandType = CommandType.StoredProcedure; command.AddDBParam(new OraParamInt32("p_id", ParameterDirection.Input, Convert.ToInt32(org.Id))); Execute(command); }
public OrgEntity PrepareSave() { OrgEntity editEntity = orgEntity; if (editEntity == null) { editEntity = new OrgEntity(); } editEntity.OrgCode = txtCode.Text.Trim(); editEntity.OrgName = txtName.Text.Trim(); editEntity.IsActive = "Y"; editEntity.AllowEdit = "Y"; return(editEntity); }
/// <summary> /// 编辑 /// </summary> private void ShowEditRow() { OrgEntity editEntity = SelectedRow; if (editEntity == null) { MsgBox.Warn("请选中要修改的行。"); return; } FrmOrgEdit frmEdit = new FrmOrgEdit(editEntity); frmEdit.DataSourceChanged += OnEditChanage; frmEdit.ShowDialog(); }
/// <summary> /// 组织机构查询 /// </summary> /// <param name="orgEntity"></param> /// <param name="TdUser"></param> /// <param name="pageindex"></param> /// <param name="pagesize"></param> /// <param name="page"></param> /// <returns></returns> public static DataTable GetOrgList(OrgEntity orgEntity, TradeUser TdUser, int pageindex, int pagesize, ref int page) { SqlParameter[] paras = null; StringBuilder sb = new StringBuilder(); string PartSearchCondition = string.Empty; string ParentOrgID = string.Empty; if (UserType.OrgType == TdUser.UType && !string.IsNullOrEmpty(TdUser.OrgId)) { PartSearchCondition = " and orgid in (select orgid from #tmp) "; ParentOrgID = TdUser.OrgId; } if (!string.IsNullOrEmpty(orgEntity.OrgName)) { //PartSearchCondition = " and orgid in (select orgid from #tmp) "; //ParentOrgID = orgEntity.OrgName; sb.AppendFormat(@" and orgid='{0}'", orgEntity.OrgName); } if (!string.IsNullOrEmpty(orgEntity.CardNum)) { sb.AppendFormat(@" and CardNum like '{0}%'", orgEntity.CardNum); } if (!string.IsNullOrEmpty(orgEntity.Reperson)) { sb.AppendFormat(@" and Reperson like '{0}%'", orgEntity.Reperson); } paras = new SqlParameter[] { new SqlParameter("@selectlist", "OrgID,OrgName,Coperson,CardType,CardNum,ParentOrgID,ParentOrgName,Reperson,PhoneNum,TelePhone,Email,Address,AddTime,Status"), new SqlParameter("@SubSelectList", "OrgID,OrgName,Coperson,CardType,CardNum,ParentOrgID,ParentOrgName,Reperson,PhoneNum,TelePhone,Email,Address,AddTime,Status"), new SqlParameter("@TableSource", "V_Base_org"), new SqlParameter("@TableOrder", "a"), new SqlParameter("@SearchCondition", string.Format(@" 1=1 {0} {1}", sb.ToString(), PartSearchCondition)), new SqlParameter("@OrderExpression", " order by OrgName desc"), new SqlParameter("@ParentOrgID", ParentOrgID), new SqlParameter("@PageIndex", pageindex), new SqlParameter("@PageSize", pagesize), new SqlParameter("@PageCount", page) }; paras[9].Direction = ParameterDirection.Output; DataTable dt = DbHelper.RunProcedure("GetRecordFromPageEx", paras, "Base_org").Tables[0]; page = Convert.ToInt32(paras[9].Value); return(dt); }
public void AddOrg(OrgEntity org) { if (org == null) { throw new NullReferenceException("Org param can not be null."); } _logger.Debug("AddOrg. Name = {0}", org.Name); OraCommand command = new OraCommand("MAIN_PKG.INS_ORG"); command.CommandType = CommandType.StoredProcedure; command.AddDBParam(new OraParamString("p_name", ParameterDirection.Input, org.Name)); Execute(command); }
/// <summary> /// 新增组织机构 /// </summary> /// <param name="orgEntity"></param> /// <param name="tran"></param> /// <returns></returns> public static int AddOrg(OrgEntity orgEntity, YicelTransaction tran) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@OrgID", orgEntity.OrgID), new SqlParameter("@OrgName", orgEntity.OrgName), new SqlParameter("@Coperson", orgEntity.Coperson), new SqlParameter("@CardType", orgEntity.CardType), new SqlParameter("@CardNum", orgEntity.CardNum), new SqlParameter("@ParentOrgId", orgEntity.ParentOrgId), new SqlParameter("@ParentOrgName", orgEntity.ParentOrgName), new SqlParameter("@Reperson", orgEntity.Reperson), new SqlParameter("@PhoneNum", orgEntity.PhoneNum), new SqlParameter("@TelePhone", orgEntity.TelePhone), new SqlParameter("@Email", orgEntity.Email), new SqlParameter("@Address", orgEntity.Address), new SqlParameter("@AddTime", orgEntity.AddTime), new SqlParameter("@Status", (int)orgEntity.Status) }; StringBuilder strSql = new StringBuilder(); strSql.AppendFormat("insert into Base_Org({0})", Fields.Org_FIELD_List); strSql.AppendFormat(" values ({0})", "@" + Fields.Org_FIELD_List.Replace(",", ",@")); object obj = DbHelper.ExecuteNonQuery(strSql.ToString(), parms, tran.Transaction); StringBuilder strbld = new StringBuilder(); string strdt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //构造新增组织用户信息的sql语句 strbld.AppendFormat(@"insert into Base_User([userId],[userName],[status],[Accounttype],[Account],[LoginPwd], [CardType],[CardNum],[OrgId],[PhoneNum],[TelNum],[Email],[LinkAdress],[sex],[OpenTime], [LastUpdateTime],[LastUpdateID],[Online],[UserType],[BindAccount]) values('{0}','{1}','{2}','{3}','{4}','{5}',", orgEntity.OrgID, string.IsNullOrEmpty(orgEntity.OrgName) ? string.Empty : orgEntity.OrgName, 1, 1, orgEntity.TelePhone, com.individual.helper.Des3.Des3EncodeCBC("123456")); strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}',", 1, string.IsNullOrEmpty(orgEntity.CardNum) ? string.Empty : orgEntity.CardNum, orgEntity.OrgID, orgEntity.PhoneNum, string.Empty, string.IsNullOrEmpty(orgEntity.Email) ? string.Empty : orgEntity.Email); strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}',{5},{6},'{7}')", string.IsNullOrEmpty(orgEntity.Address) ? string.Empty : orgEntity.Address, 1, strdt, strdt, string.Empty, 0, 2, string.Empty); obj = DbHelper.ExecuteNonQuery(strbld.ToString(), null, tran.Transaction); return(obj == null || obj == DBNull.Value ? 0 : Convert.ToInt32(obj)); }
public static async Task InitOrgInfo(this IServiceProvider app) { using var s = app.CreateScope(); var org_repo = s.ServiceProvider.Resolve_ <IOrgRepository>(); //如果组织为空就创建假数据 if (!org_repo.Exist(x => x.Id == default_org_uid)) { //创建组织 var org = new OrgEntity() { OrgName = "体验水司", UserUID = admin_uid, }.InitEntity(); org.SetId(default_org_uid); //新建默认租户 await org_repo.InsertAsync(org); } }
private void InitView() { _image = Properties.Resources.Request; _appList = _nsiService.Applications; _appList.Add(AppEntity.Create()); _orgList = _nsiService.Organizations; _orgList.Add(OrgEntity.Create()); _userList = _nsiService.Users; _userList.Add(UserEntity.Create()); _tagList = _nsiService.Tags; _tagList.Add(TagEntity.Create()); _dialogResult = null; _control = new RequestEditControl(this); SetCaption(); _eventMgr.GetEvent <RequestChangedEvent>().Subscribe(OnRequestChanged); }
public static IServiceProvider InitOrgInfo(this IServiceProvider app) { using (var s = app.CreateScope()) { var db = s.ServiceProvider.Resolve_ <IMSRepository <UserEntity> >().Database; var org_set = db.Set <OrgEntity>(); var org_member_set = db.Set <OrgMemberEntity>(); //如果组织为空就创建假数据 if (!org_set.Any(x => x.UID == default_org_uid)) { //创建组织 var org = new OrgEntity() { OrgName = "体验水司", UserUID = admin_uid, }.InitSelf(); org.UID = default_org_uid; org_set.Add(org); //新建默认租户 db.SaveChanges(); } if (!org_member_set.Any(x => x.OrgUID == default_org_uid && x.UserUID == admin_uid)) { var map = new OrgMemberEntity() { IsOwner = 1, OrgUID = default_org_uid, UserUID = admin_uid, MemberApproved = 1, Flag = (int)MemberRoleEnum.管理员 }.InitSelf("auto-mb"); org_member_set.Add(map); db.SaveChanges(); } } return(app); }
private bool Save() { if (!IsFieldValueValid()) { return(false); } bool success = false; try { OrgEntity editEntity = PrepareSave(); int ret = orgDal.Save(editEntity, isNew); if (ret == -1) { MsgBox.Warn("编号已存在,请改为其他的编号。"); } else if (ret == -2) { MsgBox.Warn("更新失败,该行已经被其他人删除。"); } else { success = true; if (DataSourceChanged != null) { DataSourceChanged(editEntity, null); } } } catch (Exception ex) { MsgBox.Err(ex.Message); } return(success); }
public virtual async Task <_ <OrgEntity> > AddOrg(OrgEntity model) { model.Should().NotBeNull(); model.OrgName.Should().NotBeNullOrEmpty(); var res = new _ <OrgEntity>(); model.InitEntity(); if (!model.IsValid(out var msg)) { res.SetErrorMsg(msg); return(res); } if (await this._orgRepo.ExistAsync(x => x.OrgName == model.OrgName)) { return(res.SetErrorMsg("名称已经存在")); } await this._orgRepo.InsertAsync(model); res.SetSuccessData(model); return(res); }
internal static OrgInfo ToOrgInfo(OrgEntity entity) { OrgInfo info = new OrgInfo(); info.OrgID = entity.OrgID; info.OrgName = entity.OrgName; info.Coperson = entity.Coperson; info.CardType = EnumConverter.ConverterCeritificateEnum(entity.CardType); info.CardNum = entity.CardNum; info.ParentOrgId = entity.ParentOrgId; info.ParentOrgName = entity.ParentOrgName; info.Reperson = entity.Reperson; info.PhoneNum = entity.PhoneNum; info.TelePhone = entity.TelePhone; info.Email = entity.Email; info.Address = entity.Address; info.AddTime = entity.AddTime; info.Status = entity.Status == Status.Enabled ? true : false;//Enabled=1,启用 禁用=0//禁用 return info; }
private StaffEntity CreateNewStaff(int staffIndex, OrgEntity org, AccountEntity account) { StaffEntity staff = new StaffEntity(); staff.Id = Guid.NewGuid(); staff.Account = account; staff.Org = org; staff.Name = account.Name; return staff; }
public static Organisation ToOrg(OrgEntity entity) { if (entity == null) return null; Organisation org = new Organisation(); org.Id = entity.Id; org.OrgName = entity.OrgName; org.email = entity.email; org.url = entity.url; org.twitter = entity.twitter; return org; }
internal static OrgEntity ToOrgEntity(OrgInfo info) { OrgEntity entity = new OrgEntity(); entity.OrgName = info.OrgName; entity.OrgID = info.OrgID; entity.Coperson = info.Coperson; entity.CardType = EnumConverter.ConverterIDType(info.CardType); entity.CardNum = info.CardNum; entity.ParentOrgId = info.ParentOrgId == null ? "" : info.ParentOrgId; entity.ParentOrgName = info.ParentOrgName == null ? "" : info.ParentOrgName; entity.Reperson = info.Reperson; entity.PhoneNum = info.PhoneNum; entity.TelePhone = info.TelePhone; entity.Email = info.Email; entity.Address = info.Address; entity.AddTime = info.AddTime; entity.Status = info.Status == true ? Status.Enabled : Status.Disable;//Enabled=1,启用 禁用=0//禁用 return entity; }
private OrgEntity CreateNewOrg(int orgIndex) { OrgEntity org = new OrgEntity(); org.Id = Guid.NewGuid(); org.Name = "Org-" + orgIndex; return org; }
/// <summary> /// This looks at the tasks type and starts or get the update of the task and updates the database /// </summary> /// <param name="task"></param> /// <param name="org"></param> /// <param name="taskList"></param> private void ExecuteTask(TaskEntity task, OrgEntity org, List <TaskEntity> taskList) { if (task == null) { return; } try { if (org == null) { throw new Exception($"Org {org.Id} not found"); } switch ((TaskType)task.TaskType) { case TaskType.CreateOrg: { var orgInfo = Mapper.Map <OrgInfo>(org); DB.UpdateTaskStatus(org.Id, (int)TaskType.CreateOrg, "Running"); var cloud_tenantId = this.CloudService.CreateOrg(orgInfo); //update the org with the tenant id created in cloud org.Cloud_TenantId = cloud_tenantId; DB.UpdateOrg(org); DB.UpdateTaskStatus(org.Id, (int)TaskType.CreateOrg, "Completed"); break; } case TaskType.EnableOrg: { DB.UpdateTaskStatus(org.Id, (int)TaskType.EnableOrg, "Running"); CloudService.EnableOrg(org.Cloud_TenantId); DB.UpdateTaskStatus(org.Id, (int)TaskType.EnableOrg, "Completed"); break; } case TaskType.CreateAdmin: { if (CanStartTask(task, taskList)) { DB.UpdateTaskStatus(org.Id, (int)TaskType.CreateAdmin, "Running"); var adminUserHref = CloudService.CreateAdminUser(org.Cloud_TenantId, org.EmailAddress, org.AdminName, org.AdminPassword); DB.UpdateTaskStatus(org.Id, (int)TaskType.CreateAdmin, "Completed"); } break; } case TaskType.CreateVDC: { //This is a long running task //Hence start the task only if it is not started. //Check for the status if it is not completed if (CanStartTask(task, taskList)) { var taskStatusUrl = CloudService.CreateVDC(org.Cloud_TenantId); task.StatusUrl = taskStatusUrl; task.Status = "Running"; DB.UpdateTask(task); } else if (task.Status != "Completed") { UpdateStatus(task); } break; } case TaskType.CreateCatalog: { if (CanStartTask(task, taskList)) { DB.UpdateTaskStatus(org.Id, (int)TaskType.CreateCatalog, "Running"); var adminUserHref = CloudService.CreateCatalog(org.Cloud_TenantId); DB.UpdateTaskStatus(org.Id, (int)TaskType.CreateCatalog, "Completed"); } break; } case TaskType.UpgradeGateWay: { //This is a long running task //Hence start the task only if it is not started. //Check for the status if it is not completed if (CanStartTask(task, taskList)) { var taskStatusUrl = CloudService.UpdateEdgeGateWayToAdvanced(org.Cloud_TenantId); task.StatusUrl = taskStatusUrl.Result; task.Status = "Running"; DB.UpdateTask(task); } else if (task.Status != "Completed") { UpdateStatus(task); } break; } case TaskType.SendNotification: { if (CanStartTask(task, taskList)) { DB.UpdateTaskStatus(org.Id, (int)TaskType.SendNotification, "Completed"); this.SendSuccessNotification(new SummaryInfo { Url = CloudService.GetServerUrl() + "/tenant/" + org.CompanyShortName, UserName = org.AdminName, SupportEmail = "*****@*****.**", SupportPhone = "817.590.9650" }, org.EmailAddress); } break; } default: break; } } catch (HttpException hex) { WriteError(hex); //This is mostly error from api , flag the status as error task.Status = "Error"; task.Notes = hex.Message; DB.UpdateTask(task); } catch (Exception ex) { WriteError(ex); throw; } }
public OrgNotExistsResult(bool isSucceed, String message, OrgEntity org) : base(isSucceed, message) { this.Org = org; }