/// <summary> /// 删除文件。 /// </summary> /// <param name="fileID">文件ID。</param> /// <returns>成功返回true,失败返回false。</returns> public bool DeleteFile(GUIDEx fileID) { bool result = false; try { const string sql = "exec spPlatformDeleteFileStorage '{0}'"; if (fileID.IsValid) { SqlCommand cmd = new SqlCommand(string.Format(sql, fileID), this.connection); this.connection.Open(); result = cmd.ExecuteNonQuery() > 0; this.connection.Close(); } } catch (Exception e) { throw e; } finally { if (this.connection != null && (this.connection.State != ConnectionState.Closed)) this.connection.Close(); } return result; }
void Download(HttpResponse resp, GUIDEx fileID) { lock (this) { if (resp != null) { string fullFileName = null, contentType = null; byte[] data = this.workDownloadService.Download(fileID, out fullFileName, out contentType); if (data != null && data.Length > 0) { resp.Buffer = true; resp.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fullFileName, System.Text.Encoding.UTF8)); resp.ContentEncoding = Encoding.GetEncoding("gb2312");//设置输出流为简体中文 resp.ContentType = contentType;//"application/OCTET-STREAM"; // resp.BufferOutput = true; resp.BinaryWrite(data); resp.Flush(); resp.End(); } else { resp.Write("文件不存在!" + fileID); } } } }
/// <summary> /// 构造函数。 /// </summary> /// <param name="dataPoxy"></param> /// <param name="syncName"></param> public SyncStudentsData(IDataSync dataPoxy,string syncName) : base(dataPoxy, syncName) { this.studentsEntity = new SFITStudentsEntity(); this.classStudentEntity = new SFITClassStudentsEntity(); this.roleEmployeeEntity = new SecurityRoleEmployeeEntity(); this.studentUserRoleID = ModuleConfiguration.ModuleConfig.StudentUserRoleID; }
/// <summary> /// 创建 /// </summary> /// <param name="rid"></param> /// <param name="position"></param> /// <param name="size"></param> public ResourceRequestMessage(Int32 rid, Int64 position, Int32 size) : base(new CommonHeader(TransferCommands.ResourceRequest, TimeEx.GetTimestamp(), rid)) { this.ContextId = GUIDEx.GetGUIDHashCode(); this.Position = position; this.Size = size; }
private ResoucesInfo(TransferDataType resoucesType, TransferPolicy policy, long postion, long length) : base(policy.MillisecondsTimeout) { this.Rid = GUIDEx.GetGUIDHashCode(); this.ResoucesType = resoucesType; this.Policy = policy; this.Postion = postion; this.Length = length; }
/// <summary> /// /// </summary> /// <param name="conf"></param> /// <param name="log"></param> /// <param name="source"></param> public SyncDataStu(SyncJobConfigurations conf, WinServiceLog log, IDataSync source) : base(conf, log, source) { this.unitsEntity = new UnitsEntity(this.Config.ModuleDefaultDatabase, this.Log); this.classesEntity = new ClassesEntity(this.Config.ModuleDefaultDatabase, this.Log); this.stusEntity = new StudentsEntity(this.Config.ModuleDefaultDatabase, this.Log); this.classStusEntity = new ClassStudentEntity(this.Config.ModuleDefaultDatabase, this.Log); this.roleEmpsEntity = new DbModuleEntity<SecurityRoleEmployee>(this.Config.ModuleDefaultDatabase, this.Log); this.roleId = this.Config.StudentUserRoleID; }
/// <summary> /// 验证系统授权。 /// </summary> /// <param name="systemID">系统ID。</param> /// <param name="authPassword">授权密码。</param> /// <param name="err">异常错误信息。</param> /// <returns>获得授权返回true,否则返回false。</returns> public bool AppAuthorization(GUIDEx systemID, string authPassword, out string err) { try { return this.sysMgrAppAuthorizationEntity.AppAuthorization(systemID, authPassword, out err); } catch (Exception e) { err = e.Message; } return false; }
public void LoadData(GUIDEx workID) { this.presenter.LoadReviewsData(workID, new EventHandler<EntityEventArgs<SFITeaReviewStudent>>(delegate(object sender, EntityEventArgs<SFITeaReviewStudent> e) { if (e.Entity != null) { this.txtReviewValue.Visible = !(this.ddlReviewValue.Visible = (e.Entity.EvaluateType == (int)EnumEvaluateType.Hierarchy)); if (this.txtReviewValue.Visible) this.txtReviewValue.Text = e.Entity.ReviewValue; else if (this.ddlReviewValue.Visible) this.ddlReviewValue.SelectedValue = e.Entity.ReviewValue; this.txtSubjectiveReviews.Text = e.Entity.SubjectiveReviews; this.txtTeacharName.Text = e.Entity.TeacharName; this.txtCreateEmployeeName.Text = e.Entity.CreateEmployeeName; this.txtCreateDateTime.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", e.Entity.CreateDateTime); } })); }
/// <summary> /// 下载附件数据。 /// </summary> /// <param name="fileID"></param> /// <param name="fullFileName"></param> /// <param name="contentType"></param> /// <returns></returns> public byte[] Download(GUIDEx fileID, out string fullFileName, out string contentType) { lock (this) { fullFileName = contentType = null; if (fileID.IsValid) { SFITAccessories entity = null; byte[] data = this.entity.LoadAccessories(fileID, out entity); if (data != null) { fullFileName = entity.AccessoriesName; contentType = entity.ContentType; return data; } } return null; } }
/// <summary> /// 创建日志。 /// </summary> /// <param name="systemID">系统ID。</param> /// <param name="systemName">系统名称。</param> /// <param name="createEmployeeID">创建日志用户ID。</param> /// <param name="createEmployeeName">创建日志用户名称。</param> /// <param name="relationTable">关联表名称。</param> /// <param name="log">日志内容。</param> public void CreateCommonLog(GUIDEx systemID, string systemName, GUIDEx createEmployeeID, string createEmployeeName, string relationTable, string log) { if (systemID.IsValid && createEmployeeID.IsValid && (!string.IsNullOrEmpty(relationTable) || !string.IsNullOrEmpty(log))) { IRMPCommonLog data = new IRMPCommonLog(); data.LogID = GUIDEx.New; data.SystemID = systemID; data.SystemName = systemName; data.CreateEmployeeID = createEmployeeID; data.CreateEmployeeName = createEmployeeName; data.RelationTable = this.ReplaceContent(relationTable); data.LogContext = this.ReplaceContent(log); data.CreateDate = DateTime.Now; this.iRMPCommonLogEntity.UpdateRecord(data); } }
public bool LoadData(GUIDEx workID) { SFITStudentWorks data = this.presenter.LoadEntityData(workID); if (data != null) { this.txtWorkName.Text = data.WorkName; this.txtCheckCode.Text = data.CheckCode; this.chkWorkStatus.CheckedValueToArray = EnumWorkStatusOperaTools.ToArray((EnumWorkStatus)data.WorkStatus); this.ddlWorkType.SelectedValue = data.WorkType.ToString(); this.txtWorkDescription.Text = data.WorkDescription; this.txtSchoolName.Text = data.SchoolName; this.txtGradeName.Text = data.GradeName; this.txtClassName.Text = data.ClassName; this.txtStudentName.Text = data.StudentName; this.txtCatalogName.Text = data.CatalogName; return true; } return false; }
/// <summary> /// 从数据库创建Process类。 /// </summary> /// <param name="processID">流程ID。</param> /// <returns>流程类。</returns> public static Process CreateProcess(GUIDEx processID) { lock (ModuleUtils.SynchronizedObject) { Process process = null; if (processID.IsValid) { #region 流程信息。 FlowProcessEntity flowProcessEntity = new FlowProcessEntity(); FlowStepEntity flowStepEntity = new FlowStepEntity(); FlowTransitionEntity flowTransitionEntity = new FlowTransitionEntity(); FlowProcess p = new FlowProcess(); p.ProcessID = processID; if (flowProcessEntity.LoadRecord(ref p)) { process = new Process(); process.ProcessID = p.ProcessID; process.ProcessName = p.ProcessName; process.ProcessSign = p.ProcessSign; process.BeginDate = p.BeginDate; process.EndDate = p.EndDate; process.ProcessDescription = p.ProcessDescription; #region 步骤信息。 process.Steps = flowStepEntity.LoadStepCollection(process.ProcessID); #endregion #region 变迁规则。 process.Transitions = flowTransitionEntity.LoadTransitionCollection(process.ProcessID); #endregion } #endregion } return process; } }
public bool SaveData(GUIDEx workID) { if (workID.IsValid) { SFITStudentWorks data = new SFITStudentWorks(); data.WorkID = workID; data.WorkName = this.txtWorkName.Text; data.WorkStatus = (int)EnumWorkStatusOperaTools.ToValue(this.chkWorkStatus.CheckedValueToArray); data.WorkType = int.Parse(this.ddlWorkType.SelectedValue); data.WorkDescription = this.txtWorkDescription.Text; return this.presenter.UpdateEntityData(data); } return false; }
/// <summary> /// /// </summary> /// <param name="workID"></param> /// <param name="w"></param> /// <param name="h"></param> /// <returns></returns> public Image LoadThumbnails(GUIDEx workID, int w, int h) { lock (this) { Image image = null; if (workID.IsValid) { #region 初始化宽高。 if (w <= 0) { w = 200; } if (h <= 10) { h = 133; } #endregion string path = string.Empty; try { path = this.LoadImageCachePath(workID, w, h); if (File.Exists(path)) { image = Image.FromFile(path); } else { #region 抽取缩略图。 string fileName, contentType; byte[] data = this.workDownloadService.Download(workID, out fileName, out contentType); if (data != null && data.Length > 0) { using (MemoryStream ms = new MemoryStream()) { ms.Write(data, 0, data.Length); ms.Position = 0; using (ZipFile zipFile = new ZipFile(ms)) { ZipEntry imageEntry = null; foreach (ZipEntry entry in zipFile) { if (entry.IsFile && DefaultThumbnailFormat.IsExistThumbnailFormat(entry.Name)) { imageEntry = entry; break; } } if (imageEntry != null) { using (Stream stream = zipFile.GetInputStream(imageEntry)) { if (stream != null) { image = ImageHelper.MakeThumbnail(stream, w, h); } } if (image != null) { image.Save(path, ImageFormat.Jpeg); } } } } } #endregion } } catch (Exception x) { #region 异常处理。 using (StreamWriter sw = new StreamWriter(string.Format("{0}\\WorkThumbnailsService_{1:yyyyMMdd}.log", AppDomain.CurrentDomain.BaseDirectory, DateTime.Now))) { sw.WriteLine(new String('*',60)); sw.WriteLine(String.Format("Path:{0}", path)); sw.WriteLine(string.Format("[{0:yyyy-MM-dd HH:mm:ss}]{1}", DateTime.Now, x.Message)); sw.WriteLine("Source:" + x.Source); sw.WriteLine("StackTrace:" + x.StackTrace); sw.WriteLine(new String('*', 60)); } #endregion } finally { #region 加载默认图片。 if (image == null && !string.IsNullOrEmpty(this.imageDefaultPath) && File.Exists(this.imageDefaultPath)) { image = Image.FromFile(this.imageDefaultPath); } #endregion } } return image; } }
/// <summary> /// /// </summary> /// <param name="work"></param> /// <param name="w"></param> /// <param name="h"></param> /// <returns></returns> private string LoadImageCachePath(GUIDEx workID, int w, int h) { return Path.GetFullPath(string.Format("{0}\\{1}_{2}_{3}.jpg", this.imageCacheRoot, workID, w, h)); }
/// <summary> /// /// </summary> /// <param name="data"></param> public void LoadData(DSIStaffInfo data) { if (data != null) { this.StaffID = data.StaffID; this.txtStaffCode.Text = data.StaffCode; this.ddlHardCategory.SelectedValue = data.HardCategory.ToString(); this.ddlTheidentity.SelectedValue = data.Theidentity.ToString(); this.txtStaffName.Text = data.StaffName; this.ddlPeople.SelectedValue = data.PeopleID; this.ddlGender.SelectedValue = data.Gender.ToString(); this.ddlPoliticalFace.SelectedValue = data.PoliticalFace.ToString(); this.ddlHealthStatus.SelectedValue = data.HealthStatus.ToString(); this.txtDisability.Text = data.Disability; this.txtIDCard.Text = data.IDCard; if (data.Birthday != DateTime.MinValue && data.Birthday != DateTime.MaxValue) this.txtBirthday.Text = string.Format("{0:yyyy-MM}", data.Birthday); else this.txtBirthday.Text = string.Empty; this.ddlHouseType.SelectedValue = data.HouseType.ToString(); this.txtBuildArea.Text = string.Format("{0:N2}", data.BuildArea); this.txtZipCode.Text = data.ZipCode; this.txtContact.Text = data.Contact; this.txtAddress.Text = data.Address; this.ddlMaritalstatus.SelectedValue = data.Maritalstatus.ToString(); if (data.TimeWorkStart != DateTime.MinValue && data.TimeWorkStart != DateTime.MaxValue) this.txtTimeWorkStart.Text = string.Format("{0:yyyy-MM}", data.TimeWorkStart); else this.txtTimeWorkStart.Text = string.Empty; this.ddlUnit.SelectedValue = data.UnitID; this.txtAvgIncome.Text = string.Format("{0:N2}", data.AvgIncome); this.txtFamilyIncome.Text = string.Format("{0:N2}", data.FamilyIncome); this.txtFamilyCount.Text = string.Format("{0}", data.FamilyCount); this.txtFamilyAvgIncome.Text = string.Format("{0:N2}", data.FamilyAvgIncome); this.rdSelfHelp.SelectedValue = data.SelfHelp.ToString(); this.ddlHardBecause.SelectedValue = data.HardBecause.ToString(); this.txtHardBecauseDesc.Text = data.HardBecauseDesc; this.uploadAttachments.DataSource = data.Attachments; this.uploadAttachments.BuildUploadView(); this.ucStaffFamily.FamilyMemberDataSource = data.FamilyMembers; this.ucStaffFamily.LoadData(); } }
bool CoreConditionsCalculated(Process process,Transition t,Step step, GUIDEx stepInstanceID, bool toWriteTask) { bool result = false; if (process != null && t != null && stepInstanceID.IsValid) { #region 条件计算。 EnumTransitionRule rule = t.TransitionRule; ConditionCollection collection = t.Conditions; if (collection != null && collection.Count > 0) { switch (rule) { case EnumTransitionRule.AND: bool bFlag = true; foreach (Condition c in collection) { FlowParameterInstance flowParameterInstance = new FlowParameterInstance(); flowParameterInstance.StepInstanceID = stepInstanceID; flowParameterInstance.ParameterID = c.ParameterID; if (bFlag &= this.flowParameterInstanceEntity.LoadRecord(ref flowParameterInstance)) { bFlag &= this.ConditionCompareSign(flowParameterInstance.ParameterValue, c.CompareValue, c.ConditionValue); } if (!bFlag) break; } result = bFlag; break; case EnumTransitionRule.OR: foreach (Condition c in collection) { FlowParameterInstance flowParameterInstance = new FlowParameterInstance(); flowParameterInstance.StepInstanceID = stepInstanceID; flowParameterInstance.ParameterID = c.ParameterID; if (this.flowParameterInstanceEntity.LoadRecord(ref flowParameterInstance)) { if (result = this.ConditionCompareSign(flowParameterInstance.ParameterValue, c.CompareValue, c.ConditionValue)) break; } else throw new Exception(string.Format("参数未传递![(stepInstanceID:{0},ParameterID:{1},)不存在!]", stepInstanceID, c.ParameterID)); } break; } } else result = true; #endregion t.IsComplete = result; #region 添加任务。 if (toWriteTask && result) { Step toStep = process.Steps[t.ToStepID]; if (toStep != null) { if ((toStep.StepType != EnumStepType.Last) && string.IsNullOrEmpty(toStep.EntryAction)) throw new Exception("未设置该步骤的入口方法或URL!"); StringBuilder query = new StringBuilder(); #region 参数相关。 List<string> toMapParameters = new List<string>(); //参数映射。 foreach (Parameter p in step.Parameters) { ParameterMap map = t.Maps[p.ParameterID]; if (map != null) { FlowParameterInstance flowParameterInstance = new FlowParameterInstance(); flowParameterInstance.StepInstanceID = stepInstanceID; flowParameterInstance.ParameterID = p.ParameterID; if (this.flowParameterInstanceEntity.LoadRecord(ref flowParameterInstance)) { Parameter mapP = toStep.Parameters[map.MapParameterID]; if (mapP != null) { toMapParameters.Add(mapP.ParameterID); //传值。 if (map.MapMode == EnumMapMode.Value) query.AppendFormat("&{0}={1}", mapP.ParameterName, Uri.EscapeDataString(flowParameterInstance.ParameterValue)); } } } } //查找未映射的参数。 foreach (Parameter p in toStep.Parameters) { if (!toMapParameters.Contains(p.ParameterID) && !string.IsNullOrEmpty(p.DefaultValue)) { query.AppendFormat("&{0}={1}", p.ParameterName, Uri.EscapeDataString(p.DefaultValue)); } } #endregion #region 待办。 if (!string.IsNullOrEmpty(toStep.EntryAction)) { //待办。 query.AppendFormat("&TaskCategory={0}", (int)EnumTaskCategory.Pending); Dictionary<GUIDEx, string> emps = this.flowStepInstanceDataEntity.GetStepInstanceToDoEmployees(stepInstanceID); if (emps == null || emps.Count == 0) { emps = new Dictionary<GUIDEx, string>(); #region StepEmployees。 if (toStep.StepEmployees != null && toStep.StepEmployees.Count > 0) { foreach (StepEmployee se in toStep.StepEmployees) { if (!emps.ContainsKey(se.EmployeeID)) emps.Add(se.EmployeeID, se.EmployeeName); } } #endregion IOrgFactory orgFactory = new ModuleConfiguration().OrgFactory; if (orgFactory != null) { List<GUIDEx> listPostID = new List<GUIDEx>(); #region StepRanks。 if (toStep.StepRanks != null && toStep.StepRanks.Count > 0) { //OrgPostCollection orgPostCollection = orgFactory.GetAllPost(); //foreach (StepRank sr in toStep.StepRanks) //{ // OrgPostCollection postCollection = orgPostCollection.FindByRank(sr.RankID); // if (postCollection != null && postCollection.Count > 0) // { // foreach (OrgPost p in postCollection) // { // if (!listPostID.Contains(p.PostID)) // listPostID.Add(p.PostID); // } // } //} } #endregion #region StepPost。 if (toStep.StepPosts != null && toStep.StepPosts.Count > 0) { foreach (StepPost sp in toStep.StepPosts) { if (!listPostID.Contains(sp.PostID)) listPostID.Add(sp.PostID); } } if (listPostID.Count > 0) { //OrgEmployeeCollection orgEmployeeCollection = orgFactory.GetAllEmployee(); //foreach (GUIDEx p in listPostID) //{ // OrgEmployeeCollection employeeCollection = orgEmployeeCollection.FindByPost(p.Value); // if (employeeCollection != null && employeeCollection.Count > 0) // { // foreach (OrgEmployee employee in employeeCollection) // { // if (!emps.ContainsKey(employee.EmployeeID)) // emps.Add(employee.EmployeeID, employee.EmployeeName); // } // } //} } #endregion } #region StepRoles。 if (toStep.StepRoles != null && toStep.StepRoles.Count > 0) { ISecurityFactory securityFactory = new ModuleConfiguration().SecurityFactory; if (securityFactory != null) { foreach (StepRole sp in toStep.StepRoles) { OrgEmployeeCollection employeeCollection = securityFactory.GetAllEmployeeByRole(sp.RoleID); if (employeeCollection != null && employeeCollection.Count > 0) { foreach (OrgEmployee employee in employeeCollection) { if (!emps.ContainsKey(employee.EmployeeID)) emps.Add(employee.EmployeeID, employee.EmployeeName); } } } } } #endregion } #region 处理用户 if (emps != null && emps.Count > 0) { foreach (KeyValuePair<GUIDEx, string> kv in emps) { if (kv.Key.IsValid) { Dictionary<string, string> authEmps = toStep.StepAuthorizes.FindTargetEmployeeID(kv.Key, DateTime.Now); if (authEmps != null && authEmps.Count > 0) { #region 授权。 foreach (KeyValuePair<string, string> kvp in authEmps) { FlowInstanceTask task = new FlowInstanceTask(); task.TaskID = GUIDEx.New; task.StepInstanceID = stepInstanceID; task.EmployeeID = kv.Key; task.EmployeeName = kv.Value; task.AuthorizeEmployeeID = kvp.Key; task.AuthorizeEmployeeName = kvp.Value; task.DoEmployeeID = GUIDEx.Null; task.DoEmployeeName = string.Empty; task.TaskCategory = (int)EnumTaskCategory.Pending; task.BeginDate = DateTime.Now; task.BeginMode = (int)EnumTaskBeginMode.None; task.URL = string.Format("{0}{1}TaskID={2}{3}", toStep.EntryAction, toStep.EntryAction.IndexOf('?') > -1 ? "&" : "?", task.TaskID, query.ToString()); result = this.flowInstanceTaskEntity.UpdateRecord(task); } #endregion } else { #region 非授权。 FlowInstanceTask task = new FlowInstanceTask(); task.TaskID = GUIDEx.New; task.StepInstanceID = stepInstanceID; task.EmployeeID = kv.Key; task.EmployeeName = kv.Value; task.AuthorizeEmployeeID = task.DoEmployeeID = GUIDEx.Null; task.AuthorizeEmployeeName = task.DoEmployeeName = string.Empty; task.TaskCategory = (int)EnumTaskCategory.Pending; task.BeginDate = DateTime.Now; task.BeginMode = (int)EnumTaskBeginMode.None; task.URL = string.Format("{0}{1}TaskID={2}{3}", toStep.EntryAction, toStep.EntryAction.IndexOf('?') > -1 ? "&" : "?", task.TaskID, query.ToString()); result = this.flowInstanceTaskEntity.UpdateRecord(task); #endregion } } } } else { throw new Exception("未配置任务推送的用户信息!"); } #endregion } #endregion #region 待阅。 if (!string.IsNullOrEmpty(toStep.EntryQuery)) { //待阅。 query.AppendFormat("&TaskCategory={0}", (int)EnumTaskCategory.BeRead); Dictionary<GUIDEx, string> emps = this.flowStepInstanceDataEntity.GetStepInstanceToViewEmployees(stepInstanceID); if (emps != null && emps.Count > 0) { foreach (KeyValuePair<GUIDEx, string> kv in emps) { if (kv.Key.IsValid) { Dictionary<string, string> authEmps = toStep.StepAuthorizes.FindTargetEmployeeID(kv.Key, DateTime.Now); if (authEmps != null && authEmps.Count > 0) { #region 授权。 foreach (KeyValuePair<string, string> kvp in authEmps) { FlowInstanceTask task = new FlowInstanceTask(); task.TaskID = GUIDEx.New; task.StepInstanceID = stepInstanceID; task.EmployeeID = kv.Key; task.EmployeeName = kv.Value; task.AuthorizeEmployeeID = kvp.Key; task.AuthorizeEmployeeName = kvp.Value; task.DoEmployeeID = GUIDEx.Null; task.DoEmployeeName = string.Empty; task.TaskCategory = (int)EnumTaskCategory.BeRead; task.BeginDate = DateTime.Now; task.BeginMode = (int)EnumTaskBeginMode.None; task.URL = string.Format("{0}{1}TaskID={2}{3}", toStep.EntryQuery, toStep.EntryQuery.IndexOf('?') > -1 ? "&" : "?", task.TaskID, query.ToString()); result = this.flowInstanceTaskEntity.UpdateRecord(task); } #endregion } else { #region 非授权。 FlowInstanceTask task = new FlowInstanceTask(); task.TaskID = GUIDEx.New; task.StepInstanceID = stepInstanceID; task.EmployeeID = kv.Key; task.EmployeeName = kv.Value; task.AuthorizeEmployeeID = task.DoEmployeeID = GUIDEx.Null; task.AuthorizeEmployeeName = task.DoEmployeeName = string.Empty; task.TaskCategory = (int)EnumTaskCategory.BeRead; task.BeginDate = DateTime.Now; task.BeginMode = (int)EnumTaskBeginMode.None; task.URL = string.Format("{0}{1}TaskID={2}{3}", toStep.EntryQuery, toStep.EntryQuery.IndexOf('?') > -1 ? "&" : "?", task.TaskID, query.ToString()); result = this.flowInstanceTaskEntity.UpdateRecord(task); #endregion } } } } } #endregion } } #endregion } return result; }
/// <summary> /// /// </summary> /// <param name="employeeID"></param> /// <param name="systemID"></param> /// <param name="clientIP"></param> /// <param name="err"></param> /// <returns></returns> public bool UserAuthorizationVerification(GUIDEx employeeID, GUIDEx systemID, string clientIP, out string err) { err = null; return true; }
protected void btnAdd_Click(object sender, EventArgs e) { try { EvaluateItem item = new EvaluateItem(); item.ItemID = this.ItemID.IsValid ? this.ItemID : GUIDEx.New; item.ItemName = this.txtItemName.Text; item.ItemValue = this.txtItemValue.Text; if (string.IsNullOrEmpty(item.ItemName)) throw new Exception(this.txtItemName.RequiredErrorMessage); else if (string.IsNullOrEmpty(item.ItemValue)) throw new Exception(this.txtItemValue.RequiredErrorMessage); EvaluateItems dataSource = this.EditDataSource; if (dataSource == null) dataSource = new EvaluateItems(); if (dataSource.Contains(item) || dataSource[item.ItemName] != null) throw new Exception("�õȼ��Ѵ��ڣ�"); else { dataSource.Add(item); this.EditDataSource = dataSource; this.ItemID = GUIDEx.Null; this.txtItemName.Text = this.txtItemValue.Text = string.Empty; this.dgfrmSFITEvaluateEdit.InvokeBuildDataSource(); } } catch (Exception ex) { this.ShowMessage(ex.Message); } }
public override void LoadData() { this.presenter.LoadEntityData(new EventHandler<EntityEventArgs<FlowParameterMap>>(delegate(object sender, EntityEventArgs<FlowParameterMap> e) { if (sender != null && e != null && e.Entity != null) { this.ddlProcess.SelectedValue = new GUIDEx(sender); this.presenter.ChangeProcess(); this.TransitionID = e.Entity.TransitionID; this.presenter.ChangeTransition(); this.ddlParameterID.SelectedValue = e.Entity.ParameterID; this.ddlMapParameterID.SelectedValue = e.Entity.MapParameterID; this.rdMapMode.SelectedValue = e.Entity.MapMode.ToString(); this.txtAssemblyName.Text = e.Entity.AssemblyName; this.txtClassName.Text = e.Entity.ClassName; this.txtEntryName.Text = e.Entity.EntryName; } })); }
/// <summary> /// 验证用户授权。 /// </summary> /// <param name="employeeID">用户ID。</param> /// <param name="systemID">系统ID。</param> /// <param name="clientIP">用户登录IP地址。</param> /// <param name="err">异常错误信息。</param> /// <returns>获得授权返回true,否则返回false。</returns> public bool UserAuthorizationVerification(GUIDEx employeeID, GUIDEx systemID, string clientIP, out string err) { try { return this.sysMgrEmployeeAuthorizationEntity.UserAuthorizationVerification(employeeID, systemID, clientIP, out err); } catch (Exception e) { err = e.Message; } return false; }
/// <summary> /// 收回流程的授权。 /// </summary> /// <param name="processSign">流程标识。</param> /// <param name="employeeID">进行回收的用户ID,只能回收自己的授权。</param> /// <param name="employeeName">进行回收的用户名称。</param> /// <param name="stepSigns">要回收的流程授权的步骤标识列表。</param> /// <param name="msgError">调用失败时的错误消息。</param> /// <returns>回收成功则返回true,否则返回false。</returns> public bool WithdrawFlow(string processSign, GUIDEx employeeID, string employeeName, string[] stepSigns, out string msgError) { bool result = false; msgError = null; try { if (!employeeID.IsValid) throw new ArgumentNullException("employeeID", "用户ID为空!"); result = this.poxy.WithdrawFlow(processSign, employeeID.Value, employeeName, stepSigns, out msgError); if (!result && !string.IsNullOrEmpty(msgError)) this.log.CreateWarningLog(msgError); } catch (Exception e) { msgError = e.Message; this.log.CreateErrorLog(e.Message); } return result; }
public void SetProcess(GUIDEx processID) { this.ddlProcess.SelectedValue = processID; this.ddlProcess_OnSelectedIndexChanged(null, null); this.ddlProcess.Enabled = !processID.IsValid; }
/// <summary> /// /// </summary> /// <param name="fileID"></param> protected bool DeleteFileRawToPage(GUIDEx fileID) { lock (this) { bool result = false; if (fileID.IsValid) { Dictionary<GUIDEx, Pair> dicRaws = this.UploadRaws; if (dicRaws.ContainsKey(fileID)) { dicRaws.Remove(fileID); this.UploadRaws = dicRaws; result = true; } } return result; } }
/// <summary> /// /// </summary> /// <param name="systemID"></param> /// <param name="authPassword"></param> /// <param name="err"></param> /// <returns></returns> public bool AppAuthorization(GUIDEx systemID, string authPassword, out string err) { err = null; return true; }
/// <summary> /// 设置学生角色权限。 /// </summary> /// <param name="data"></param> /// <param name="roleId"></param> private void SetStudentAccessRole(Entity.Student data,GUIDEx roleId) { try { SecurityRoleEmployee sre = new SecurityRoleEmployee(); sre.EmployeeID = data.StudentID; sre.EmployeeName = data.StudentName; sre.RoleID = roleId; if (this.roleEmpsEntity.UpdateRecord(sre)) { this.Log.ContentLog(string.Format("设置学生[{0}]访问角色({1})成功!", data, roleId)); } } catch (Exception e) { string err = string.Format("设置学生[{0}]访问角色({1})异常:{2}", data, roleId, e.Message); this.Log.ContentLog(err); this.Log.ErrorLog(new Exception(err, e)); } }
/// <summary> /// 构造函数。 /// </summary> /// <param name="projectId"></param> /// <param name="attachId"></param> public DSIProjectAttachment(GUIDEx projectId, GUIDEx attachId) { this.ProjectID = projectId; this.AttachID = attachId; }
/// <summary> /// 初始化流程实例。 /// </summary> /// <param name="processSign">流程标识。</param> /// <param name="processInstanceName">流程实例名称。</param> /// <param name="employeeID">进行操作的用户ID。</param> /// <param name="employeeName">进行操作的用户名称。</param> /// <param name="processInstanceID">初始化流程实例的唯一标识。</param> /// <param name="msgError">调用失败时的错误消息。</param> /// <returns>实例化成功则返回true,否则返回false。</returns> public bool InitFlow(string processSign, string processInstanceName, GUIDEx employeeID, string employeeName, out GUIDEx processInstanceID, out string msgError) { bool result = false; msgError = null; processInstanceID = GUIDEx.Null; try { if (!employeeID.IsValid) throw new ArgumentNullException("employeeID", "用户ID为空!"); string strProcessInstanceID = null; if (result = this.poxy.InitFlow(processSign, processInstanceName, employeeID.Value, employeeName, out strProcessInstanceID, out msgError)) processInstanceID = new GUIDEx(strProcessInstanceID); else if (!string.IsNullOrEmpty(msgError)) this.log.CreateWarningLog(msgError); } catch (Exception e) { msgError = e.Message; this.log.CreateErrorLog(e.Message); } return result; }
/// <summary> /// /// </summary> /// <param name="fileID"></param> /// <param name="contentType"></param> /// <param name="stream"></param> /// <returns></returns> protected void SaveFileRawToPage(GUIDEx fileID, string contentType, Stream stream) { lock (this) { if (fileID.IsValid && stream != null && stream.Length > 0) { string strData = null; using (MemoryStream ms = new MemoryStream()) { using (GZipStream zipStream = new GZipStream(ms, CompressionMode.Compress)) { byte[] buf = new byte[256]; int len = 0; while ((len = stream.Read(buf, 0, buf.Length)) > 0) { zipStream.Write(buf, 0, len); } zipStream.Close(); stream.Close(); } byte[] data = ms.ToArray(); ms.Close(); strData = iPower.Utility.HexParser.ToHexString(data); } if (!string.IsNullOrEmpty(strData)) { Dictionary<GUIDEx, Pair> dicRaws = this.UploadRaws; dicRaws.Add(fileID, new Pair(contentType, strData)); this.UploadRaws = dicRaws; } } } }
/// <summary> /// 对指定的步骤进行授权。 /// </summary> /// <param name="processSign">流程标识。</param> /// <param name="employeeID">进行授权的用户ID。</param> /// <param name="employeeName">进行授权的用户名称。</param> /// <param name="stepSigns">进行授权的步骤标识列表。</param> /// <param name="toEmployeeID">授权的目标用户ID。</param> /// <param name="fromDate">授权开始时间,为2010-01-11 15:00:00格式。</param> /// <param name="toDate">授权结束时间,为2010-01-11 15:00:00格式。</param> /// <param name="msgError">调用失败时的错误消息。</param> /// <returns>如果授权成功则返回true,否则返回false。</returns> public bool AuthorizeFlow(string processSign, GUIDEx employeeID, string employeeName, string[] stepSigns, GUIDEx toEmployeeID, DateTime fromDate, DateTime toDate, out string msgError) { bool result = false; msgError = null; try { if (!employeeID.IsValid) throw new ArgumentNullException("employeeID", "进行授权的用户ID为空!"); if (!toEmployeeID.IsValid) throw new ArgumentNullException("toEmployeeID", "授权的目标用户ID为空!"); result = this.poxy.AuthorizeFlow(processSign, employeeID.Value, employeeName, stepSigns, toEmployeeID.Value, fromDate, toDate, out msgError); if (!result && !string.IsNullOrEmpty(msgError)) this.log.CreateWarningLog(msgError); } catch (Exception e) { msgError = e.Message; this.log.CreateErrorLog(e.Message); } return result; }
protected void dgfrmSFITEvaluateEdit_OnRowSelecting(object sender, EventArgs e) { EvaluateItem data = sender as EvaluateItem; if (data != null) { this.ItemID = data.ItemID; this.txtItemName.Text = data.ItemName; this.txtItemValue.Text = data.ItemValue; } }
/// <summary> /// 获取流程履历。 /// </summary> /// <param name="processInstanceID">流程实例ID。</param> /// <param name="msgError">调用失败时的错误消息。</param> /// <returns></returns> public ProcessResumesCollection GetProcessResumes(GUIDEx processInstanceID, out string msgError) { msgError = null; ProcessResumesCollection collection = new ProcessResumesCollection(); if (processInstanceID.IsValid) { try { ProcessResumes[] prs = this.poxy.GetProcessResumes(processInstanceID, out msgError); if (prs != null && prs.Length > 0) { foreach (ProcessResumes pr in prs) { collection.Add(pr); } } } catch (Exception e) { msgError = e.Message; } } return collection; }