Пример #1
0
        private void SendMessage(HttpContext ctx)
        {
            try
            {
                CiMessageEntity message       = new CiMessageEntity();
                string          AddresseeJson = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("AddresseeJson"));
                message.MSGContent = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("MSGContent"));
                message.Title      = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("Title"));
                RDIFramework.Utilities.UserInfo curUser = Utils.UserInfo;

                List <CiMessageEntity> AddresseeList = JsonHelper.JonsToList <CiMessageEntity>(AddresseeJson);
                message.FunctionCode = MessageFunction.UserMessage.ToDescription();
                string reciveIds = string.Empty;
                if (AddresseeList != null && AddresseeList.Count > 0)
                {
                    foreach (CiMessageEntity entity in AddresseeList)
                    {
                        reciveIds += entity.Id + ",";
                    }
                    reciveIds = reciveIds.TrimEnd(',');
                }
                if (curUser != null)
                {
                    message.ModifiedBy     = curUser.RealName;
                    message.ModifiedUserId = curUser.Id;
                }

                int returnValue = 0;
                if (!string.IsNullOrEmpty(reciveIds))
                {
                    returnValue = RDIFrameworkService.Instance.MessageService.BatchSend(curUser, reciveIds.Split(new char[] { ',' }), null, null, message);
                }

                ctx.Response.Write(returnValue > 0
                    ? new JsonMessage {
                    Success = true, Data = "1", Message = "发送成功。"
                }.ToString()
                    : new JsonMessage {
                    Success = true, Data = "0", Message = "发送失败。"
                }.ToString());
            }
            catch (Exception ex)
            {
                ctx.Response.Write(new JsonMessage {
                    Success = true, Data = "-1", Message = "发送失败,错误:" + ex.Message
                }.ToString());
            }
        }
Пример #2
0
        private void SubmitForm(HttpContext context)
        {
            try
            {
                int    IsOk    = 1;
                var    key     = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("key"));
                var    json    = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("json"));
                string Message = key == "" ? "新增成功。" : "修改成功。";
                RDIFramework.Utilities.UserInfo curUser = Utils.UserInfo;
                QueryEngineDefineEntity         entity  = JsonHelper.JSONToObject <QueryEngineDefineEntity>(json);
                if (string.IsNullOrEmpty(key))
                {
                    //增加
                    entity.CreateBy     = curUser.RealName;
                    entity.CreateUserId = curUser.Id;
                    string statusCode, statusMessage, returnKey;
                    returnKey = RDIFrameworkService.Instance.QueryEngineService.AddQueryEngineDefine(curUser, entity, out statusCode, out statusMessage);
                    context.Response.Write(statusCode == RDIFramework.Utilities.StatusCode.OKAdd.ToString()
                        ? new JsonMessage {
                        Success = true, Data = returnKey, Message = statusMessage
                    }.ToString()
                        : new JsonMessage {
                        Success = false, Data = "0", Message = statusMessage
                    }.ToString());
                }
                else
                {
                    var updateEntity = RDIFrameworkService.Instance.QueryEngineService.GetQueryEngineDefineEntity(curUser, key);
                    if (updateEntity != null)
                    {
                        updateEntity.QueryEngineId    = entity.QueryEngineId;
                        updateEntity.Code             = entity.Code;
                        updateEntity.FullName         = entity.FullName;
                        updateEntity.DataBaseLinkName = entity.DataBaseLinkName;
                        updateEntity.DataSourceType   = entity.DataSourceType;
                        updateEntity.DataSourceName   = entity.DataSourceName;
                        updateEntity.QueryStringKey   = entity.QueryStringKey;
                        updateEntity.QueryString      = entity.QueryString;
                        updateEntity.SelectedField    = entity.SelectedField;
                        updateEntity.OrderByField     = entity.OrderByField;
                        updateEntity.Enabled          = entity.Enabled;
                        updateEntity.AllowEdit        = entity.AllowEdit;
                        updateEntity.AllowDelete      = entity.AllowDelete;
                        updateEntity.Description      = entity.Description;
                    }

                    if (curUser != null)
                    {
                        updateEntity.ModifiedBy     = curUser.RealName;
                        updateEntity.ModifiedUserId = curUser.Id;
                    }
                    string statusCode;
                    string statusMessage;
                    RDIFrameworkService.Instance.QueryEngineService.UpdateQueryEngineDefine(curUser, updateEntity, out statusCode, out statusMessage);
                    context.Response.Write(statusCode == RDIFramework.Utilities.StatusCode.OKUpdate.ToString()
                        ? new JsonMessage {
                        Success = true, Data = IsOk.ToString(), Message = statusMessage
                    }.ToString()
                        : new JsonMessage {
                        Success = false, Data = "0", Message = statusMessage
                    }.ToString());
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(new JsonMessage {
                    Success = false, Data = "0", Message = "操作失败:" + ex.Message
                }.ToString());
            }
        }
        private void SubmitForm(HttpContext context)
        {
            try
            {
                int    IsOk    = 1;
                var    key     = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("key"));
                var    json    = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("json"));
                string Message = key == "" ? "新增成功。" : "修改成功。";
                RDIFramework.Utilities.UserInfo curUser = Utils.UserInfo;
                PiOrganizeEntity entity = JsonHelper.JSONToObject <PiOrganizeEntity>(json);
                if (string.IsNullOrEmpty(key))
                {
                    //增加
                    if (!string.IsNullOrEmpty(entity.ManagerId))
                    {
                        entity.Manager = RDIFrameworkService.Instance.UserService.GetEntity(curUser, entity.ManagerId).RealName;
                    }
                    if (!string.IsNullOrEmpty(entity.AssistantManagerId))
                    {
                        entity.AssistantManager = RDIFrameworkService.Instance.UserService.GetEntity(curUser, entity.AssistantManagerId).RealName;
                    }
                    entity.CreateBy     = curUser.RealName;
                    entity.CreateUserId = curUser.Id;
                    string statusCode, statusMessage, returnKey;
                    returnKey = RDIFrameworkService.Instance.OrganizeService.Add(curUser, entity, out statusCode, out statusMessage);
                    context.Response.Write(statusCode == RDIFramework.Utilities.StatusCode.OKAdd.ToString()
                        ? new JsonMessage {
                        Success = true, Data = returnKey, Message = statusMessage
                    }.ToString()
                        : new JsonMessage {
                        Success = false, Data = "0", Message = statusMessage
                    }.ToString());
                }
                else
                {
                    var updateEntity = RDIFrameworkService.Instance.OrganizeService.GetEntity(curUser, key);
                    if (updateEntity != null)
                    {
                        updateEntity.ParentId           = entity.ParentId;
                        updateEntity.FullName           = entity.FullName;
                        updateEntity.ShortName          = entity.ShortName;
                        updateEntity.Code               = entity.Code;
                        updateEntity.Category           = entity.Category;
                        updateEntity.ManagerId          = entity.ManagerId;
                        updateEntity.AssistantManagerId = entity.AssistantManagerId;
                        if (!string.IsNullOrEmpty(updateEntity.ManagerId))
                        {
                            updateEntity.Manager = RDIFrameworkService.Instance.UserService.GetEntity(curUser, updateEntity.ManagerId).RealName;
                        }
                        if (!string.IsNullOrEmpty(updateEntity.AssistantManagerId))
                        {
                            updateEntity.AssistantManager = RDIFrameworkService.Instance.UserService.GetEntity(curUser, updateEntity.AssistantManagerId).RealName;
                        }
                        updateEntity.OuterPhone      = entity.OuterPhone;
                        updateEntity.InnerPhone      = entity.InnerPhone;
                        updateEntity.Fax             = entity.Fax;
                        updateEntity.Postalcode      = entity.Postalcode;
                        updateEntity.Web             = entity.Web;
                        updateEntity.Address         = entity.Address;
                        updateEntity.Enabled         = entity.Enabled;
                        updateEntity.IsInnerOrganize = entity.IsInnerOrganize;
                        updateEntity.Description     = entity.Description;
                    }

                    if (curUser != null)
                    {
                        updateEntity.ModifiedBy     = curUser.RealName;
                        updateEntity.ModifiedUserId = curUser.Id;
                    }
                    string statusCode;
                    string statusMessage;
                    var    returnValue = RDIFrameworkService.Instance.OrganizeService.Update(curUser, updateEntity, out statusMessage);
                    context.Response.Write(returnValue > 0
                        ? new JsonMessage {
                        Success = true, Data = IsOk.ToString(), Message = statusMessage
                    }.ToString()
                        : new JsonMessage {
                        Success = false, Data = "0", Message = statusMessage
                    }.ToString());
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(new JsonMessage {
                    Success = false, Data = "0", Message = "操作失败:" + ex.Message
                }.ToString());
            }
        }