Ejemplo n.º 1
0
        //private void setParameter()
        //{
        //    sqlDataItem.ParameterList.Clear();
        //    sqlDataItem.AppendParameter("@OperatorId", this.OperatorId);
        //    sqlDataItem.AppendParameter("@WorkFlowId", this.WorkFlowId);
        //    sqlDataItem.AppendParameter("@WorkTaskId", this.WorkTaskId);
        //    sqlDataItem.AppendParameter("@OperType", this.OperType,typeof(int));
        //    sqlDataItem.AppendParameter("@OperContent", this.OperContent);
        //    sqlDataItem.AppendParameter("@Relation", this.Relation, typeof(int));
        //    sqlDataItem.AppendParameter("@Description", this.Description);
        //    sqlDataItem.AppendParameter("@InorExclude", this.InorExclude,typeof(bool));
        //    sqlDataItem.AppendParameter("@OperDisplay", this.OperDisplay);

        //}
        /// <summary>
        ///// 增加一个处理者的语句
        ///// </summary>
        //private void setInsertSql()
        //{
        //    string tmpValueList = "";
        //    string tmpFieldName = "";
        //    sqlString = "insert into " + tableName + "(";
        //    int tmpInt = this.fieldList.Length;
        //    for (int i = 0; i < tmpInt - 1; i++)
        //    {
        //        tmpFieldName = fieldList[i].ToString();
        //        sqlString = sqlString + tmpFieldName + ",";
        //        tmpValueList = tmpValueList + "@" + tmpFieldName + ",";

        //    }
        //    tmpFieldName = this.fieldList[tmpInt - 1].ToString();
        //    sqlString = sqlString + tmpFieldName;
        //    tmpValueList = tmpValueList + "@" + tmpFieldName;
        //    this.sqlString = sqlString + ")values(" + tmpValueList + ")";
        //    sqlDataItem.CommandText = sqlString;
        //}
        ///// <summary>
        ///// 修改当前处理者的语句
        ///// </summary>
        //private void setUpdateSql()
        //{
        //    string tmpFieldName = "";
        //    int tmpInt = this.fieldList.Length;
        //    sqlString = "update " + tableName + " set ";
        //    for (int i = 0; i < tmpInt - 1; i++)
        //    {
        //        tmpFieldName = this.fieldList[i].ToString();
        //        sqlString = sqlString + tmpFieldName + "=@" + tmpFieldName + ",";

        //    }
        //    tmpFieldName = fieldList[tmpInt - 1].ToString();
        //    sqlString = sqlString + tmpFieldName + "=@" + tmpFieldName;
        //    sqlString = sqlString + " where " + keyField + "=@" + this.keyField;
        //    sqlDataItem.CommandText = sqlString;
        //}
        /// <summary>
        ///增加处理者
        /// </summary>
        public void InsertOperator()
        {
            if (OperatorId.Trim().Length == 0 || OperatorId == null)
                throw new Exception("InsertOperator方法错误,OperatorId 不能为空!");
            try
            {
                //setInsertSql();//设定insert语句
                //setParameter();//设定参数
                //ClientDBAgent agent = new ClientDBAgent();
                //agent.ExecuteNonQuery(sqlDataItem);
                WF_Operator op = new WF_Operator();
                op.OperatorId=this.OperatorId;
                op.WorkFlowId=this.WorkFlowId;
                op.WorkTaskId=this.WorkTaskId;
                op.OperType=this.OperType;
                op.OperContent=this.OperContent;
                op.Relation=this.Relation;
                op.Description=this.Description;
                op.InorExclude = this.InorExclude;
                op.OperDisplay = this.OperDisplay;
                MainHelper.PlatformSqlMap.Create<WF_Operator>(op); 

            }
            catch (Exception ex)
            {
                throw ex;
            }


        }
Ejemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            InitColumns();//初始列
            InitData();//初始数据
            List<WF_Operator> wflist2 = new List<WF_Operator>();
            IList<WF_WorkFlow> list = MainHelper.PlatformSqlMap.GetList<WF_WorkFlow>("SelectWF_WorkFlowList", "where FlowCaption like '%分析%'");
            foreach (WF_WorkFlow wf in list)
            {
                IList<WF_WorkTask> list2 = MainHelper.PlatformSqlMap.GetList<WF_WorkTask>("SelectWF_WorkTaskList", "where WorkFlowId='" + wf.WorkFlowId + "' and  TaskTypeId!='2' order by TaskTypeId");
                foreach (WF_WorkTask wt in list2)
                {
                    WF_Operator wfop = (WF_Operator)MainHelper.PlatformSqlMap.GetObject("SelectWF_OperatorList", "where WorkFlowId='" + wt.WorkFlowId + "' and WorkTaskId='" + wt.WorkTaskId + "' and OperContent='all'");
                    if (wfop == null)
                    {
                        wfop = new WF_Operator();
                        wfop.OperatorId = Guid.NewGuid().ToString();
                        wfop.OperContent = "all";
                        wfop.Description = "所有人";
                        wfop.OperDisplay = "所有人";
                        wfop.WorkFlowId = wt.WorkFlowId;
                        wfop.WorkTaskId = wt.WorkTaskId;
                        wfop.OperType = 5;
                        wfop.InorExclude = true;
                        wflist2.Add(wfop);

                    }
                }
            
            }
            if (wflist2.Count > 0) 
            {
                 List<SqlQueryObject> list3 = new List<SqlQueryObject>();
                 SqlQueryObject wfobj3 = new SqlQueryObject(SqlQueryType.Insert, wflist2.ToArray());
                    list3.Add(wfobj3);
                MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3);
            }
            if (this.Site != null) return;
            btGdsList.Edit = DicTypeHelper.GdsDic;
            btGdsList.EditValueChanged += new EventHandler(btGdsList_EditValueChanged);
            if (MainHelper.UserOrg != null && MainHelper.UserOrg.OrgType == "1")
            {//如果是供电所人员,则锁定
                btGdsList.EditValue = MainHelper.UserOrg.OrgCode;
                btGdsList.Edit.ReadOnly = true;
            }

        }
Ejemplo n.º 3
0
        public bool Save() {
            bool flag = true;
            List<string> list = new List<string>();
            List<rRoleModul> list2 = new List<rRoleModul>();
            //List<string> wflist1 = new List<string>();
            List<WF_Operator> wflist2 = new List<WF_Operator>();

            this.getCheckList(this.treeList1.Nodes, list);
            foreach (string str in list) {
                rRoleModul function = new rRoleModul();
                function.RoleID = this.m_RoleID;
                function.Modu_ID = str;
                list2.Add(function);
                TreeListNode td = treeList1.FindNodeByKeyID(str);
                if (td["Description"].ToString () == "工作流")
                {
                    WF_WorkTask wt = MainHelper.PlatformSqlMap.GetOneByKey<WF_WorkTask>(str);
                    if (wt!= null)
                    {
                        mRole mrl = MainHelper.PlatformSqlMap.GetOneByKey<mRole>(RoleID);
                        WF_Operator wfop = new WF_Operator();
                        wfop.OperatorId = Guid.NewGuid().ToString(); 
                        wfop.OperContent = RoleID; 
                        wfop.Description = mrl.RoleName;
                        wfop.OperDisplay = mrl.RoleName;
                        wfop.WorkFlowId = wt.WorkFlowId;
                        wfop.WorkTaskId = wt.WorkTaskId;
                        wfop.OperType = 5;
                        wfop.InorExclude = true;
                        wflist2.Add(wfop);
                        
                    }
                    //wflist1.Add(" where WorkTaskId='" + str + "' and OperContent='" + RoleID + "'");
                }
            }



            SqlQueryObject item = new SqlQueryObject(SqlQueryType.Delete, "DeleterRoleModulByWhere", "where RoleID='" + this.m_RoleID + "'");
            SqlQueryObject item2 = new SqlQueryObject(SqlQueryType.Delete, "DeleteWF_OperatorInstanceByWhere", "where OperContent='" + this.m_RoleID + "'");


            SqlQueryObject wfitem = new SqlQueryObject(SqlQueryType.Delete, "DeleteWF_OperatorByWhere", "where OperContent='" + this.m_RoleID + "'");
           

            try {
                List<SqlQueryObject> list3 = new List<SqlQueryObject>();
                list3.Add(item);
                list3.Add(item2);
                if (list2.Count>0)
                {
                    SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Insert, list2.ToArray());
                    list3.Add(obj3);
                }
               

                list3.Add(wfitem);
                if (wflist2.Count > 0)
                {
                    SqlQueryObject wfobj3 = new SqlQueryObject(SqlQueryType.Insert, wflist2.ToArray());
                    list3.Add(wfobj3);
                }
                MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3);
            } catch (Exception exception) {
                MainHelper.ShowWarningMessageBox(exception.Message);
                flag = false;
            }
            return flag;
        }