Example #1
0
        public ModelInvokeResult <SetSolutionPK> Update(string strSolutionId, SetSolution setSolution)
        {
            ModelInvokeResult <SetSolutionPK> result = new ModelInvokeResult <SetSolutionPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string _SolutionId = strSolutionId;
                setSolution.SolutionId = _SolutionId;
                /***********************begin 自定义代码*******************/
                setSolution.OperatedBy = NormalSession.UserId.ToGuid();
                setSolution.OperatedOn = DateTime.Now;

                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = setSolution.GetUpdateMethodName(), ParameterObject = setSolution.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new SetSolutionPK {
                    SolutionId = _SolutionId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
        /*备注
         * 集的容器为div(id="div_sets"),
         * 集自身为div(id="tab_"+SetId),
         */

        #region 集合页签(Tab)
        //生成EasyUI格式
        private string CreateHtml_Tab_EasyUI_Set(string solutionId)
        {
            StringBuilder str_html       = new StringBuilder();
            SetSolution   obj_setSoltion = BuilderFactory.DefaultBulder().Load <SetSolution, SetSolutionPK>(new SetSolutionPK {
                SolutionId = solutionId
            });
            //排序后的集合
            IList <Set> list_set = BuilderFactory.DefaultBulder().List <Set>(new { SolutionId = solutionId, OrderByClause = "OrderNo" }.ToStringObjectDictionary());

            str_html.Append("<div id=\"div_sets\" class=\"easyui-tabs\" >");
            for (int i = 0; i < list_set.Count; i++)
            {
                string str_widgetOption = string.Empty;
                string str_val          = string.Empty;
                string str_select       = string.Empty;

                str_select = list_set[i].SetId == obj_setSoltion.DefaultSetId ? "selected=true" : "";//默认选中Tab
                //if (HaveKey("href", item.WidgetOption, out str_val))
                //{
                //    str_widgetOption += " href=\"" + str_val + "\" ";
                //}
                //取键值条件可在此增加
                if (HaveKey("style", list_set[i].WidgetOption, out str_val))
                {
                    str_widgetOption += " style=\"" + str_val + "\" ";
                }
                str_html.AppendFormat("<div id=\"tab_{0}\" title=\"{1}\" {2} {3}>", list_set[i].SetId, list_set[i].SetName, str_select, str_widgetOption);
                str_html.Append(CreateHtml_EasyUI_Subset(list_set[i].SetId));
                str_html.Append("</div>");
            }
            str_html.Append("</div>");
            return(str_html.ToString());
        }
        public string GetHtml_Sets(SetSolution param)
        {
            string str_html = string.Empty;

            if (!string.IsNullOrEmpty(param.SolutionId))
            {
                str_html = CreateHtml_Tab_Set(param.SolutionId, UIType.EasyUI);//暂时只有EasyUI,有其他则添加其处理方法并扩展枚举
            }

            return(str_html);
        }
Example #4
0
 public void SetSolutionText(string Solution)
 {
     if (this.lblSolution.InvokeRequired)
     {
         SetSolution d = new SetSolution(SetSolutionText);
         this.lblSolution.Invoke(d, new object[] { Solution });
     }
     else
     {
         this.lblSolution.Text = Solution;
     }
 }
Example #5
0
        public InvokeResult NullifySelected(string strSolutionIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrSolutionIds = strSolutionIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrSolutionIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new SetSolution().GetUpdateMethodName();
                foreach (string strSolutionId in arrSolutionIds)
                {
                    SetSolution setSolution = new SetSolution {
                        SolutionId = strSolutionId, Status = 0
                    };
                    /***********************begin 自定义代码*******************/
                    setSolution.OperatedBy = NormalSession.UserId.ToGuid();
                    setSolution.OperatedOn = DateTime.Now;

                    /***********************end 自定义代码*********************/
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = setSolution.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                    });
                }
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Example #6
0
        public InvokeResult DeleteSelected(string strSolutionIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrSolutionIds = strSolutionIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrSolutionIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new SetSolution().GetDeleteMethodName();
                foreach (string strSolutionId in arrSolutionIds)
                {
                    SetSolutionPK pk = new SetSolutionPK {
                        SolutionId = strSolutionId
                    };
                    DeleteCascade(statements, pk);
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE
                    });
                }
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Example #7
0
        public ModelInvokeResult <SetSolutionPK> Create(SetSolution setSolution)
        {
            ModelInvokeResult <SetSolutionPK> result = new ModelInvokeResult <SetSolutionPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                if (setSolution.SolutionId == "自动生成")
                {
                    setSolution.SolutionId = GlobalManager.getPK(setSolution.GetMappingTableName(), "SolutionId");
                }
                /***********************begin 自定义代码*******************/
                setSolution.OperatedBy = NormalSession.UserId.ToGuid();
                setSolution.OperatedOn = DateTime.Now;

                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = setSolution.GetCreateMethodName(), ParameterObject = setSolution.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new SetSolutionPK {
                    SolutionId = setSolution.SolutionId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }