public virtual void UnSubscribe(HttpContext context) { YZRequest request = new YZRequest(context); string clientid = request.GetString("clientid"); JArray jPost = request.GetPostData <JArray>(); BPMObjectNameCollection channels = jPost.ToObject <BPMObjectNameCollection>(); Client client = ClientManager.Instance.TryGetByID(clientid); if (client != null) { client.UnSubscribeTo(channels); } }
public virtual void DeleteObjects(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string folder = request.GetString("folder", ""); JArray jPost = request.GetPostData <JArray>(); StoreObjectIdentityCollection objects = jPost.ToObject <StoreObjectIdentityCollection>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); cn.DeleteObjects(zone, folder, objects); } }
public virtual string RenameFolder(HttpContext context) { YZRequest request = new YZRequest(context); int folderid = request.GetInt32("folderid"); string newName = request.GetString("newName"); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { return(DirectoryManager.RenameFolder(provider, cn, folderid, newName)); } } }
public virtual void SaveFolder(HttpContext context) { YZRequest request = new YZRequest(context); SecurityResType securityResType = request.GetEnum <SecurityResType>("securityResType"); string path = request.GetString("path", ""); JObject post = request.GetPostData <JObject>(); ACL acl = post["acl"].ToObject <ACL>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); SecurityManager.SaveACL(cn, securityResType, path, null, acl); } }
public virtual object GetGridViewDefine(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path"); string viewName = request.GetString("viewName"); Report report; ReportGridView reportView; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); report = Report.Open(cn, path); reportView = Report.GetView(cn, path, viewName) as ReportGridView; } return(new { reportName = report.Name, columnInfos = report.ReportColumnInfos, view = reportView }); }
public virtual void DeleteDevice(HttpContext context) { YZRequest request = new YZRequest(context); string uuid = request.GetString("uuid"); string uid = YZAuthHelper.LoginUserAccount; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { DeviceManager.DeleteDevice(provider, cn, uid, uuid); } } }
public virtual void InitScreenLock(HttpContext context) { YZRequest request = new YZRequest(context); string password = request.GetString("password"); string uid = YZAuthHelper.LoginUserAccount; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User.SetScreenLockPassword(cn, uid, "", password); User.SetScreenLock(cn, uid, true); User.SetTouchUnlock(cn, uid, true); } }
public virtual DataTable GetDataNoPaged(HttpContext context) { YZRequest request = new YZRequest(context); String tableName = request.GetString("TableName", null); String procedureName = request.GetString("ProcedureName", null); String esb = request.GetString("ESB", null); String query = request.GetString("Query", null); if (!String.IsNullOrEmpty(tableName)) { return(this.GetTableDataNoPaged(context)); } else if (!String.IsNullOrEmpty(procedureName)) { return(this.GetProcedureDataNoPaged(context)); } if (!String.IsNullOrEmpty(esb)) { return(this.GetESBDataNoPaged(context)); } throw new Exception(Resources.YZStrings.Aspx_Invalid_Paramaters); }
public virtual JObject GetTableSchemas(HttpContext context) { YZRequest request = new YZRequest(context); string serverName = request.GetString("ServerName", null); TableIdentityCollection tables = request.GetPostData <JArray>().ToObject <TableIdentityCollection>(); FlowDataSet dataSet; using (BPMConnection cn = new BPMConnection()) { this.OpenConnection(cn, serverName); dataSet = DataSourceManager.LoadDataSetSchema(cn, tables); return(YZJsonHelper.SerializeSchema(dataSet)); } }
public virtual void GetHeadshot(HttpContext context) { YZRequest request = new YZRequest(context); string account = request.GetString("account", null); string empty = request.GetString("empty", "Empty-Headshot.png"); string filePath; if (!String.IsNullOrEmpty(account)) { string userPath = this.GetUserPath(context, account); string imagePath = Path.Combine(userPath, "Headshot"); FileInfo fileSrc = this.FindFile(imagePath, "Headshot.*"); if (fileSrc == null) { fileSrc = new FileInfo(Path.Combine(imagePath, "Headshot")); } string thumbnail = context.Request.Params["thumbnail"]; filePath = this.GetOutputFile(fileSrc, thumbnail, ".png"); } else { filePath = null; } if (String.IsNullOrEmpty(filePath) || !File.Exists(filePath)) { filePath = context.Server.MapPath("~/YZSoft/Attachment/img/" + empty); } string fileName = Path.GetFileName(filePath); this.ProcessResponseHeader(context, fileName, true); context.Response.TransmitFile(filePath); }
public virtual JArray GetFieldModifies(HttpContext context) { YZRequest request = new YZRequest(context); string DataSource = request.GetString("DataSource", ""); string TableName = request.GetString("TableName"); string ColumnName = request.GetString("ColumnName"); string CKeyName = request.GetString("CKeyName", ""); string CKeyValue = request.GetString("CKeyValue"); JArray rv = new JArray(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); ModifyRecordCollection modifies = SpoorService.GetFieldSpoor(cn, DataSource, TableName, ColumnName, CKeyValue); foreach (ModifyRecord modify in modifies) { JObject item = new JObject(); rv.Add(item); string userName = modify.Account; User user = User.TryGetUser(cn, modify.Account); if (user != null) { userName = YZStringHelper.GetUserShortName(user.Account, user.DisplayName); } item["Account"] = userName; item["UserSortName"] = userName; item["Value"] = modify.Value; item["ModifyDate"] = YZStringHelper.DateToStringM(modify.ModifyDate); } } return(rv); }
public virtual void ExportBPAProcessAsPdf(HttpContext context) { YZRequest request = new YZRequest(context); string filename = request.GetString("fileName"); string ext = request.GetString("ext", null); JObject jProcess = JObject.Parse(Encoding.UTF8.GetString(Convert.FromBase64String(request.GetString("process", null)))); JObject jChart = JObject.Parse(Encoding.UTF8.GetString(Convert.FromBase64String(request.GetString("chart", null)))); this.ProcessResponseHeader(context, filename + ".pdf", true); using (Bitmap image = this.DecodeCanvasChart(jChart)) { float mmx; float mmy; using (Graphics g = Graphics.FromImage(image)) { mmx = (float)(image.Width * 25.4 / g.DpiX); mmy = (float)(image.Height * 25.4 / g.DpiY); } float pointsx = iTextSharp.text.Utilities.MillimetersToPoints(mmx); float pointsy = iTextSharp.text.Utilities.MillimetersToPoints(mmy); iTextSharp.text.Rectangle pageSize = new iTextSharp.text.Rectangle(pointsx + 20, pointsy + 20); using (iTextSharp.text.Document doc = new iTextSharp.text.Document(pageSize, 10, 10, 10, 10)) { PdfWriter.GetInstance(doc, context.Response.OutputStream); doc.Open(); iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(image, ImageFormat.Png); pic.ScaleAbsolute(pointsx, pointsy); doc.Add(pic); } } }
public virtual JObject GetOUObjects(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path", null); //获得数据 using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); RoleCollection roles; MemberCollection members; OU ou = null; if (String.IsNullOrEmpty(path)) { ou = new OU(); roles = new RoleCollection(); members = new MemberCollection(); } else { ou = OU.FromFullName(cn, path); roles = OU.GetRoles(cn, path); members = OU.GetMembers(cn, path); } //将数据转化为Json集合 JObject rv = new JObject(); rv[YZJsonProperty.total] = roles.Count + members.Count; JArray children = new JArray(); rv[YZJsonProperty.children] = children; rv["Editable"] = ou.HasPermision(BPMObjectPermision.Edit); rv["NewRole"] = ou.HasPermision(BPMObjectPermision.NewRole); foreach (Role role in roles) { children.Add(this.SerializeOUObject(role)); } foreach (Member member in members) { children.Add(this.SerializeOUObject(cn, member)); } return(rv); } }
public virtual object GetUsersFromAccounts(HttpContext context) { YZRequest request = new YZRequest(context); UserCollection users = new UserCollection(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); int count = request.GetInt32("Count", 0); for (int i = 0; i < count; i++) { string account = request.GetString("Account" + i.ToString()); User user = User.TryGetUser(cn, account); if (user != null) { users.Add(user); } } } //将数据转化为Json集合 JObject rv = new JObject(); JArray children = new JArray(); rv[YZJsonProperty.children] = children; for (int i = 0; i < users.Count; i++) { User user = users[i]; //已删除和禁用的用户不显示 if (user == null || user.Disabled) { continue; } Member member = new Member(); member.UserAccount = user.Account; children.Add(this.JObjectFromMember(member, user)); } //输出数据 return(rv); }
public virtual object Reply(HttpContext context) { YZRequest request = new YZRequest(context); string clientid = request.GetString("clientid", null); int messageid = request.GetInt32("messageid"); JObject jPost = request.GetPostData <JObject>(); string msg = (string)jPost["message"]; YZMessage parentMessage; YZMessage message = new YZMessage(); YZMessageCollection replies; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { parentMessage = SocialManager.GetMessageByID(provider, cn, messageid); message.resType = parentMessage.resType; message.resId = parentMessage.resId; message.uid = YZAuthHelper.LoginUserAccount; message.date = DateTime.Now; message.message = msg; message.replyto = parentMessage.id; SocialManager.Insert(provider, cn, message); replies = SocialManager.GetMessageReplies(provider, cn, parentMessage.id); parentMessage["Replies"] = replies; parentMessage["Praised"] = SocialManager.GetVotePraisedCount(provider, cn, parentMessage.id); } } using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); this.PostProcessMessage(cn, parentMessage); foreach (YZMessage replyMessage in replies) { this.PostProcessMessage(cn, replyMessage); } } YZSoft.Web.Push.MessageBus.Instance.onPostComments(clientid, message); return(parentMessage); }
public virtual object GetEmployeeInfo(HttpContext context) { YZRequest request = new YZRequest(context); string account = request.GetString("account"); bool includeDisabledUser = request.GetBool("includeDisabledUser", false); User user; List <object> rvPositions = new List <object>(); List <object> supervisors = new List <object>(); List <object> directXSs = new List <object>(); List <object> roles = new List <object>(); object[] groups; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); user = User.FromAccount(cn, account); MemberCollection positions = OrgSvr.GetUserPositions(cn, account); foreach (Member member in positions) { rvPositions.Add( new { ou = member.GetParentOU(cn).GetFriendlyFullName(cn), LeaderTitle = member.LeaderTitle, Level = member.Level } ); supervisors.AddRange(OrgManager.GetSupervisors(cn, member.FullName, includeDisabledUser)); directXSs.AddRange(OrgManager.GetDirectXSs(cn, member.FullName, includeDisabledUser)); roles.AddRange(OrgManager.GetRoles(cn, member.FullName)); } groups = OrgManager.GetGroups(cn, account); } return(new { user = user, positions = rvPositions, supervisors = supervisors, directxss = directXSs, roles = roles, groups = groups }); }
public virtual void SaveMobileFormSetting(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); JObject post = request.GetPostData <JObject>(); MobileFormSetting mobileFormSetting = post.ToObject <MobileFormSetting>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcess.SaveMobileFormSetting(cn, processName, version, mobileFormSetting); } }
public virtual void Delete(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int taskid = request.GetInt32("TaskID"); string comments = request.GetString("Comments", null); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMTask.Delete(cn, taskid, comments); } }
public virtual object GetNewMesssageCount(HttpContext context) { YZRequest request = new YZRequest(context); YZResourceType resType = request.GetEnum <YZResourceType>("resType"); string resId = request.GetString("resId"); string uid = YZAuthHelper.LoginUserAccount; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { return(YZSoft.Web.Social.SocialManager.GetNewMessageCount(provider, cn, resType, resId, uid)); } } }
public virtual object GetFormTemplate(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); return(new { text = Convert.ToBase64String(cn.GetFormTemplate(path)) }); } }
public virtual JObject GetWorkList(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path", null); string processName = request.GetString("processName", null); string uid = YZAuthHelper.LoginUserAccount; //过滤 string filter = null; if (!String.IsNullOrEmpty(processName)) { using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { filter = String.Format("ProcessName=N'{0}'", provider.EncodeText(processName)); } } //获得数据 BPMTaskListCollection tasks = new BPMTaskListCollection(); int rowcount; JObject rv = new JObject(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); tasks = cn.GetTaskList(path, uid, filter, "StepID DESC", request.Start, request.Limit, out rowcount); rv = this.Serialize(cn, tasks, rowcount); } return(rv); }
public virtual void SaveSecurityGroup(HttpContext context) { YZRequest request = new YZRequest(context); string mode = request.GetString("mode"); string groupName = request.GetString("GroupName", mode == "new", null); JsonSerializer serializer = new JsonSerializer(); StreamReader reader = new StreamReader(context.Request.InputStream); using (JsonTextReader streamReader = new JsonTextReader(reader)) { JArray @params = serializer.Deserialize(streamReader) as JArray; SecurityGroup group = @params[0].ToObject <SecurityGroup>(serializer); SIDPairCollection sids = @params[1].ToObject <SIDPairCollection>(serializer); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (mode == "edit") { if (groupName != group.GroupName) { GroupManager.RenameSecurityGroup(cn, groupName, group.GroupName); } GroupManager.UpdateSecutiryGroup(cn, group.GroupName, sids); } else { GroupManager.AddSecutiryGroup(cn, group.GroupName, sids); } } } }
public virtual void GetProcessThumbnail(HttpContext context) { YZRequest request = new YZRequest(context); string fileid = request.GetString("fileid"); string filePath = AttachmentInfo.FileIDToPath(fileid, AttachmentManager.AttachmentRootPath); string thumbnailPath = AttachmentManager.GetThumbnailPath(filePath, "thumbnail", "png"); if (String.IsNullOrEmpty(thumbnailPath) || !File.Exists(thumbnailPath)) { thumbnailPath = context.Server.MapPath("~/YZSoft/Attachment/img/Empty-ProcessThumbnail.png"); } this.ProcessResponseHeader(context, Path.GetFileName(thumbnailPath), true); context.Response.TransmitFile(thumbnailPath); }
public virtual object GetQueryData(HttpContext context) { YZRequest request = new YZRequest(context); String datasourceName = request.GetString("DataSource", null); String query = request.GetString("Query"); QueryParameterCollection queryParams = JArray.Parse(request.GetString("QueryParams")).ToObject <QueryParameterCollection>(); YZClientParamCollection @params = JArray.Parse(Encoding.UTF8.GetString(Convert.FromBase64String(request.GetString("params", YZJsonHelper.Base64EmptyJArray)))).ToObject <YZClientParamCollection>(); bool clientCursor = request.GetBool("clientCursor", false); //应用查询条件 BPMDBParameterCollection finallyParams = queryParams.CreateNullDBParameters(); foreach (BPMDBParameter @param in finallyParams) { YZClientParam clientParam = @params.TryGetItem(@param.Name); if (clientParam != null && clientParam.value != null) { @param.Value = clientParam.value; } } FlowDataTable table = new FlowDataTable(); int rowcount; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); table.Load(cn, BPMCommandType.Query, query, finallyParams, clientCursor, request.Start, request.Limit, out rowcount); } return(new { total = rowcount, children = table.ToDataTable() }); }
public virtual void DeleteObjects(HttpContext context) { YZRequest request = new YZRequest(context); string parentou = request.GetString("parentou"); JObject post = request.GetPostData <JObject>(); BPMObjectNameCollection roles = post["roles"].ToObject <BPMObjectNameCollection>(); BPMObjectNameCollection members = post["members"].ToObject <BPMObjectNameCollection>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); OU.DeleteRoleAndMembers(cn, parentou, roles, members); } }
public virtual void SaveFTPServer(HttpContext context) { YZRequest request = new YZRequest(context); string mode = request.GetString("mode"); string path = request.GetString("path", null); string serverName = request.GetString("serverName", mode == "new", null); JsonSerializer serializer = new JsonSerializer(); StreamReader reader = new StreamReader(context.Request.InputStream); using (JsonTextReader streamReader = new JsonTextReader(reader)) { JArray @params = serializer.Deserialize(streamReader) as JArray; FTPServer server = @params[0].ToObject <FTPServer>(serializer); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (mode == "edit") { if (serverName != server.Name) { ExtServer.Rename(cn, path, serverName, server.Name); } server.Save(cn, path, true); } else { server.Save(cn, path, false); } } } }
public virtual void UpdateImageFile(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid"); string imageid = request.GetString("imageid"); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { Group.Group group = GroupManager.GetGroup(provider, cn, groupid); group.ImageFileID = imageid; GroupManager.Update(provider, cn, group); } } }
protected override void AuthCheck(HttpContext context) { YZRequest request = new YZRequest(context); string method = request.GetString("method"); if (NameCompare.EquName(method, "Login") || NameCompare.EquName(method, "LoginTrial") || NameCompare.EquName(method, "SendLoginValidationCode") || NameCompare.EquName(method, "GetPublicKey") || NameCompare.EquName(method, "DingTalkLogin")) { return; } YZAuthHelper.AshxAuthCheck(); }
public virtual BPMObjectNameCollection AddGroupMembers(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid"); string role = request.GetString("role"); JArray jPost = request.GetPostData <JArray>(); BPMObjectNameCollection uids = jPost.ToObject <BPMObjectNameCollection>(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { return(GroupManager.AddGroupMembers(provider, cn, groupid, uids, role)); } } }
public virtual TimeSheet GetTimeSheetDefine(HttpContext context) { YZRequest request = new YZRequest(context); string sheetName = request.GetString("sheetName"); TimeSheet timesheet; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); timesheet = TimeSheet.Load(cn, sheetName); timesheet.Data.Clear(); } return(timesheet); }