public InvokeResult NullifySelected(string strPlanIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrPlanIds = strPlanIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrPlanIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new WorkPlan().GetUpdateMethodName();
                foreach (string strPlanId in arrPlanIds)
                {
                    WorkPlan workPlan = new WorkPlan {
                        PlanId = strPlanId.ToGuid(), Status = 0
                    };
                    /***********************begin 自定义代码*******************/
                    workPlan.OperatedBy = NormalSession.UserId.ToGuid();
                    workPlan.OperatedOn = DateTime.Now;
                    /***********************end 自定义代码*********************/
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = workPlan.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                    });
                }
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
        public bool NullifyWorkPlan(string strOldManId, string strUserId)
        {
            bool result = false;

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                Guid?_OldManId = strOldManId.ToGuid();
                Guid?_UserId   = strUserId.ToGuid();
                if (_UserId == null || _OldManId == null)
                {
                    result = false;
                    return(result);
                }
                WorkPlan workPlan = new WorkPlan();
                /***********************begin 自定义代码*******************/
                workPlan.Status     = 0;
                workPlan.OperatedBy = NormalSession.UserId.ToGuid();
                workPlan.OperatedOn = DateTime.Now;
                workPlan.UserId     = _UserId;
                workPlan.OldManId   = _OldManId;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = "NullifyWorkPlan_Update", ParameterObject = workPlan.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });

                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result = true;
                /***********************end 自定义代码*********************/
            }
            catch (Exception ex)
            {
                result = false;
            }
            return(result);
        }
        public ModelInvokeResult <WorkPlanPK> NullifyWorkPlan(WorkPlan workPlan)
        {
            ModelInvokeResult <WorkPlanPK> result = new ModelInvokeResult <WorkPlanPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                /***********************begin 自定义代码*******************/
                workPlan.Status     = 0;
                workPlan.OperatedBy = NormalSession.UserId.ToGuid();
                workPlan.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = "NullifyWorkPlan_Update", ParameterObject = workPlan.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                if (workPlan.UserId == null && workPlan.OldManId == null)
                {
                    result.Success      = false;
                    result.ErrorMessage = "操作对象不能为空,工作计划作废失败";
                }
                else
                {
                    BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                }
                /***********************end 自定义代码*********************/
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Esempio n. 4
0
        public ModelInvokeResult <WorkPlanPK> Nullify(string strPlanId)
        {
            ModelInvokeResult <WorkPlanPK> result = new ModelInvokeResult <WorkPlanPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                Guid?_PlanId = strPlanId.ToGuid();
                if (_PlanId == null)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                WorkPlan workPlan = new WorkPlan {
                    PlanId = _PlanId, Status = 0
                };
                /***********************begin 自定义代码*******************/
                workPlan.OperatedBy = NormalSession.UserId.ToGuid();
                workPlan.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = workPlan.GetUpdateMethodName(), ParameterObject = workPlan.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new WorkPlanPK {
                    PlanId = _PlanId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Esempio n. 5
0
        public ModelInvokeResult <WorkPlanPK> Create(WorkPlan workPlan)
        {
            ModelInvokeResult <WorkPlanPK> result = new ModelInvokeResult <WorkPlanPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                if (workPlan.PlanId == GlobalManager.GuidAsAutoGenerate)
                {
                    workPlan.PlanId = Guid.NewGuid();
                }
                /***********************begin 自定义代码*******************/
                workPlan.OperatedBy = NormalSession.UserId.ToGuid();
                workPlan.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = workPlan.GetCreateMethodName(), ParameterObject = workPlan.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new WorkPlanPK {
                    PlanId = workPlan.PlanId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
        public ModelInvokeResult <WorkPlanPK> CreateWorkPlanS(string oldManIds, WorkPlan workPlan)
        {
            ModelInvokeResult <WorkPlanPK> result = new ModelInvokeResult <WorkPlanPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                if (workPlan.PlanId == GlobalManager.GuidAsAutoGenerate)
                {
                    workPlan.PlanId = Guid.NewGuid();
                }
                /***********************begin 自定义代码*******************/
                workPlan.OperatedBy = NormalSession.UserId.ToGuid();
                workPlan.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                var arroldManIds = oldManIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arroldManIds.Length < 1)
                {
                    result.Success      = false;
                    result.ErrorMessage = "请选择老人";
                    return(result);
                }

                /***********************检查是否已经存在此项工作计划*********************/
                foreach (string arroldManId in arroldManIds)
                {
                    string sql = "";
                    //string sql = "select * from Pam_WorkPlan where OldManId='" + arroldManId + "' and UserId='" + workPlan.UserId + "' and WorkItem='" + workPlan.WorkItem + "' and PlanSchedule='" + workPlan.PlanSchedule + "'";
                    int i = BuilderFactory.DefaultBulder().ExecuteNativeSqlForCount(sql);
                    if (i > 0)
                    {
                        result.Success      = false;
                        result.ErrorMessage = "此项工作计划已经存在";
                        return(result);
                    }
                }
                /***********************检查是否已经存在此项工作计划*********************/

                foreach (string arroldManId in arroldManIds)
                {
                    workPlan.OldManId = arroldManId.ToGuid();
                    workPlan.PlanId   = Guid.NewGuid();
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = workPlan.GetCreateMethodName(), ParameterObject = workPlan.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                    });
                }
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new WorkPlanPK {
                    PlanId = workPlan.PlanId
                };
                if (result.Success)
                {
                    /***********************如果老人和服务人员没有建立关系,这里建立关系*********************/
                    OldManMappingServeManAdd(workPlan.UserId.ToString(), oldManIds);
                    /***********************如果老人和服务人员没有建立关系,这里建立关系*********************/
                    /***********************重新生成工作执行表*********************/
                    foreach (string arroldManId in arroldManIds)
                    {
                        SPParam spParam = new { }.ToSPParam();
                        spParam["OldManId"]  = arroldManId.ToGuid();
                        spParam["BatchFlag"] = 0;
                        BuilderFactory.DefaultBulder().ExecuteSPNoneQuery("SP_Pam_GenDailyWorkExcute", spParam);
                    }
                }
                /***********************重新生成工作执行表*********************/
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
        public ModelInvokeResult <WorkPlanPK> Update(string strPlanId, WorkPlan workPlan)
        {
            ModelInvokeResult <WorkPlanPK> result = new ModelInvokeResult <WorkPlanPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                Guid?_PlanId = strPlanId.ToGuid();
                if (_PlanId == null)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                workPlan.PlanId = _PlanId;
                /***********************begin 自定义代码*******************/
                workPlan.OperatedBy = NormalSession.UserId.ToGuid();
                workPlan.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = workPlan.GetUpdateMethodName(), ParameterObject = workPlan.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new WorkPlanPK {
                    PlanId = _PlanId
                };
                if (result.Success)
                {
                    SPParam spParam = new { }.ToSPParam();
                    spParam["OldManId"]  = workPlan.OldManId;
                    spParam["BatchFlag"] = 0;
                    BuilderFactory.DefaultBulder().ExecuteSPNoneQuery("SP_Pam_GenDailyWorkExcute", spParam);
                }
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }