コード例 #1
0
        private void btSubmit_Click(object sender, EventArgs e)
        {
            WF_TaskVar wl = MainHelper.PlatformSqlMap.GetOne<WF_TaskVar>(" where TableName='LP_Record' and TableField='Status' "
                + " and WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"] + "'"
                );
            if (wl == null)
            {
                wl = new WF_TaskVar();
                wl.AccessType = "1";
                wl.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                wl.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                wl.TableName = "LP_Record";
                wl.TableField = "Status";
                wl.TaskVarId = Guid.NewGuid().ToString();
                wl.TableField = "Status";
                wl.VarName = "kind";
                wl.VarType = "string";
                wl.VarModule = "out";
                MainHelper.PlatformSqlMap.Create<WF_TaskVar>(wl);
            }
            string tmpStr = " where  StartTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"]
                + "' and WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"] + "'";
            IList<WF_WorkTaskLinkView> li = MainHelper.PlatformSqlMap.GetList<WF_WorkTaskLinkView>
                ("SelectWF_WorkTaskLinkViewList", tmpStr);
            foreach (WF_WorkTaskLinkView tl in li)
            {
               
                WF_WorkLink wlk = MainHelper.PlatformSqlMap.GetOneByKey<WF_WorkLink>
                (tl.WorkLinkId);
                if (wlk.Condition == "")
                {
                    wlk.Condition = "<%kind%>='" + tl.endTaskCaption + "'";
                    wlk.Description = tl.endTaskCaption;
                    MainHelper.PlatformSqlMap.Update<WF_WorkLink>(wlk);
                }
                else
                {
                    wlk.Condition = "<%kind%>='" + tl.endTaskCaption + "'";
                    wlk.Description = tl.endTaskCaption;
                    MainHelper.PlatformSqlMap.Update<WF_WorkLink>(wlk);
                }
            }
            string statustem = currRecord.Status;
            currRecord.Status = comboBoxEdit1.Text;
            if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0];
            if (currRecord.SignImg == null) currRecord.SignImg = new byte[0];
            MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
            string strmes = "";
            WF_WorkTaskCommands wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'");
            if (wt != null)
            {
                strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName);
            }
            else
            {
                strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交");
            }
            if (strmes.IndexOf("未提交至任何人") > -1)
            {
                MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!");
                currRecord.Status = statustem;

                currRecord.LastChangeTime = DateTime.Now.ToString();
                if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0];
                if (currRecord.SignImg == null) currRecord.SignImg = new byte[0];
                MainHelper.PlatformSqlMap.Update("UpdateLP_Record", CurrRecord);
                return;
            }
            //else
            //    MsgBox.ShowTipMessageBox(strmes);
            strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString());
            if (strmes == "结束节点1")
            {
                currRecord.Status = "存档";
            }
            else
            {
                currRecord.Status = strmes;
            }

            currRecord.LastChangeTime = DateTime.Now.ToString();
            MainHelper.PlatformSqlMap.Update("UpdateLP_Record", CurrRecord);
            //retWorkFlowData = WorkFlowData.Clone();
            DataTable dtall = RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID);
            retWorkFlowData = dtall.Clone();
            retWorkFlowData.Rows.Clear();
            foreach (DataRow dr in dtall.Rows)
            {
                if (WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() == dr["WorkFlowInsId"].ToString())
                {
                    DataRow dr2 = retWorkFlowData.NewRow();
                    foreach (DataColumn dc in dtall.Columns)
                    {
                        dr2[dc.ColumnName] = dr[dc.ColumnName];
                    }
                    retWorkFlowData.Rows.Add(dr2);
                    break;
                }
            }
            this.DialogResult = DialogResult.OK;
        }
コード例 #2
0
 private void simpleButton3_Click(object sender, EventArgs e) {
     DataRow dr = dt.NewRow();
     frmTaskRecordEditSet ftes = new frmTaskRecordEditSet();
     dr["WorkFlowId"] = strWorkFlowID;
     ftes.RowData = dr;
     ftes.strType = "add";
     if (ftes.ShowDialog() == DialogResult.OK) {
         WF_TaskVar wtv = new WF_TaskVar();
         wtv.WorkTaskId = dr["WorkTaskId"].ToString();
         wtv.WorkFlowId = dr["WorkFlowId"].ToString();
         wtv.TableName = dr["TableName"].ToString();
         wtv.InitValue = dr["InitValue"].ToString();
         wtv.VarName = dr["VarName"].ToString();
         wtv.VarType = dr["VarType"].ToString();
         wtv.TableField = dr["TableField"].ToString();
         wtv.VarModule = dr["VarModule"].ToString();
         wtv.AccessType = "生成记录";
         MainHelper.PlatformSqlMap.Create<WF_TaskVar>(wtv);
         refreshData();
     }
 }
コード例 #3
0
ファイル: frmLP.cs プロジェクト: s7loves/mypowerscgl
        public IList ExTaskRecordCtrlSQL(string sqlSentence, WF_TaskVar wtt)
        {



            /*
             * 
             * SELECT   cellname,  SqlSentence,SqlColName
                FROM         LP_Temple
                where SqlSentence !=''
             * 
             * */
            IList li = new ArrayList();
            Regex r1 = null;
            if (sqlSentence.IndexOf("Excel:") == 0)
            {
                int index1 = sqlSentence.LastIndexOf(":");
                string tablename = sqlSentence.Substring(6, index1 - 6);
                string cellpos = sqlSentence.Substring(index1 + 1);
                string[] arrCellPos = cellpos.Split('|');
                arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|');
                string strcellvalue = "";
                Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
                ExcelAccess ea = new ExcelAccess();
                ea.MyWorkBook = wb;
                ea.MyExcel = wb.Application;
                Excel.Worksheet sheet;
                sheet = wb.Application.Sheets[tablename] as Excel.Worksheet;

                for (int i = 0; i < arrCellPos.Length; i++)
                {
                    Excel.Range range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]], sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]]);//坐标
                    strcellvalue += range.Value2;
                }
                li.Add(strcellvalue);
            }
            else if (sqlSentence != "")
            {
                if (sqlSentence.IndexOf("{recordparentid}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{recordparentid}", currRecord.ParentID);
                }
                if (sqlSentence.IndexOf("{recordid}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{recordid}", currRecord.ID);
                }
                if (sqlSentence.IndexOf("{orgcode}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{orgcode}", MainHelper.User.OrgCode);
                }
                if (sqlSentence.IndexOf("{userid}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{userid}", MainHelper.User.UserID);
                }
                if (sqlSentence.IndexOf("{orgname}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{orgname}", MainHelper.User.OrgName);
                }
                if (sqlSentence.IndexOf("{username}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{username}", MainHelper.User.UserName);
                }
                if (sqlSentence.IndexOf("'{datetime}'") > -1)
                {
                    sqlSentence = sqlSentence.Replace("'{datetime}'", "getdate()");
                }
                try
                {
                    sqlSentence = sqlSentence.Replace("\r\n", " ");
                    Hashtable value = Client.ClientHelper.PlatformSqlMap.GetObject("Select", sqlSentence) as Hashtable;
                    if (value != null && value.Count > 0)
                    {
                        foreach (object obj in value.Values)
                        {
                            li.Add(obj); break;
                        }
                    }

                }
                catch (Exception ex)
                {
                    if (sqlSentence.Contains("{datetime}"))
                        li.Add(DateTime.Now);
                    else
                        li.Add("出错:" + ex.Message);
                }
            }
            return li;
        }
コード例 #4
0
 private void btSubmit_Click(object sender, EventArgs e)
 {
     WF_TaskVar wl = MainHelper.PlatformSqlMap.GetOne<WF_TaskVar>(" where TableName='LP_Record' and TableField='Status' "
         + " and WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"] + "'"
         );
     if (wl == null)
     {
         wl = new WF_TaskVar();
         wl.AccessType = "1";
         wl.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
         wl.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
         wl.TableName = "LP_Record";
         wl.TableField = "Status";
         wl.TaskVarId = Guid.NewGuid().ToString();
         wl.TableField = "Status";
         wl.VarName = "kind";
         wl.VarType = "string";
         wl.VarModule = "out";
         MainHelper.PlatformSqlMap.Create<WF_TaskVar>(wl);
     }
     string tmpStr = " where  StartTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"]
         + "' and WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"] + "'";
     IList<WF_WorkTaskLinkView> li = MainHelper.PlatformSqlMap.GetList<WF_WorkTaskLinkView>
         ("SelectWF_WorkTaskLinkViewList", tmpStr);
     foreach (WF_WorkTaskLinkView tl in li)
     {
        
         WF_WorkLink wlk = MainHelper.PlatformSqlMap.GetOneByKey<WF_WorkLink>
         (tl.WorkLinkId);
         if (wlk.Condition == "")
         {
             wlk.Condition = "<%kind%>='" + tl.endTaskCaption + "'";
             wlk.Description = tl.endTaskCaption;
             MainHelper.PlatformSqlMap.Update<WF_WorkLink>(wlk);
         }
     }
     string statustem = currRecord.Status;
     currRecord.Status=comboBoxEdit1.Text;
     MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
     string strmes = "";
     WF_WorkTaskCommands wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'");
     if (wt != null)
     {
         strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName);
     }
     else
     {
         strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交");
     }
     if (strmes.IndexOf("未提交至任何人") > -1)
     {
         MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!");
         currRecord.Status = statustem;
         MainHelper.PlatformSqlMap.Update("UpdateLP_Record", CurrRecord);
         return;
     }
     else
         MsgBox.ShowTipMessageBox(strmes);
     strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString());
     if (strmes == "结束节点1")
     {
         currRecord.Status = "存档";
     }
     else
     {
         currRecord.Status = strmes;
     }
     MainHelper.PlatformSqlMap.Update("UpdateLP_Record", CurrRecord);
     this.DialogResult = DialogResult.OK;
 }
コード例 #5
0
ファイル: frmLP.cs プロジェクト: s7loves/mypowerscgl
 private static void RunTaskRecordCtrlData(string p, WF_TaskVar wtt, DataTable wf)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
ファイル: frmLP.cs プロジェクト: s7loves/mypowerscgl
        public void RunTaskRecordCtrlData(string sqlSentence, WF_TaskVar wtt)
        {
            IList li = MainHelper.PlatformSqlMap.GetList("GetTableColumns", wtt.VarName);
            Hashtable hs = new Hashtable();
            Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "Ebada.Scgl.Model.dll");
            Type tpe = assembly.GetType("Ebada.Scgl.Model." + wtt.VarName);

            for (int i = 0; i < li.Count; i++)
            {
                Regex r1 = new Regex(@"(?<=\[" + (li[i] as WF_WorkFlow).Name + ":).*?(?=\\])");
                if (r1.Match(sqlSentence.Replace("\r\n", " ")).Value != "")
                {

                    IList sli = ExTaskRecordCtrlSQL(r1.Match(sqlSentence.Replace("\r\n", " ")).Value, wtt);
                    if (hs.Contains((li[i] as WF_WorkFlow).Name) == false) hs.Add((li[i] as WF_WorkFlow).Name, "");
                    if (sli.Count > 0)
                    {

                        if (GetDisplayName(tpe, (li[i] as WF_WorkFlow).Name).IndexOf("时间") > 0)
                        {
                            if (sli[0].ToString().IndexOf("年") > -1)
                                hs[(li[i] as WF_WorkFlow).Name] = sli[1];
                            else
                                hs[(li[i] as WF_WorkFlow).Name] = sli[0];

                        }
                        else
                        {
                            hs[(li[i] as WF_WorkFlow).Name] = sli[0];
                        }

                    }
                }


            }
            ArrayList akeys = new ArrayList(hs.Keys);
            string strsql = "";
            IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select   COLUMN_NAME   from   INFORMATION_SCHEMA.KEY_COLUMN_USAGE  where   TABLE_NAME   =   '" + wtt.VarName + "'");
            strsql = " INSERT INTO " + wtt.VarName;

            foreach (string strv in list)
            {
                if (strv == list[0].ToString())
                {
                    strsql = strsql + " ( " + strv;
                }
                else
                {
                    strsql = strsql + "," + strv;
                }
            }
            for (int i = 0; i < akeys.Count; i++)
            {
                if (list[0].ToString() != akeys[i].ToString())
                {
                    strsql += "," + akeys[i];
                }
            }
            string strid = DateTime.Now.ToString("yyyyMMddHHmmssffffff");
            strsql += " )  values (";
            foreach (string strv in list)
            {
                if (strv == list[0].ToString())
                {
                    if (hs.Contains(strv))
                        strsql = strsql + "  '" + hs[strv] + "'";
                    else
                        strsql = strsql + "  '" + strid + "'";

                }
                else
                {

                    if (hs.Contains(strv))
                        strsql = strsql + ",'" + hs[strv] + "'";
                    else
                        strsql = strsql + ",'" + strid + "'";
                }
            }
            //strsql += "'" + strid + "' ";
            for (int i = 0; i < akeys.Count; i++)
            {

                if (list[0].ToString() != akeys[i].ToString())
                {
                    if (tpe.GetMember(akeys[i].ToString())[0].ToString().IndexOf("System.Int") > 0
                        || tpe.GetMember(akeys[i].ToString())[0].ToString().IndexOf("System.Double") > 0
                        )
                        strsql += " , " + hs[akeys[i]] + " ";
                    else
                        strsql += " , '" + hs[akeys[i]] + "' ";
                }
            }
            strsql += " )  ";
            MainHelper.PlatformSqlMap.Update("Update", strsql);
            WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
            mrwt.ModleRecordID = strid;
            mrwt.RecordID = currRecord.ID;
            mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
            mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
            mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
            mrwt.ModleTableName = wtt.VarName;
            mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
            mrwt.CreatTime = DateTime.Now;
            MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
        }
コード例 #7
0
ファイル: RecordWorkTask.cs プロジェクト: s7loves/mypowerscgl
        /// <summary>
        /// 返回工作日志变量对应的值,不存在则为空
        /// </summary>
        /// <param name="tv">工作日志变量</param>
        /// <param name="sheet">工作日志变量对应的工作表</param>
        /// <param name="recordID">记录ID</param>
        /// <param name="modlecord">模块记录</param>
        /// <returns>返回工作日志变量对应的值,不存在则为空</returns>
        public static string GetTaskVarRiZhiValue(WF_TaskVar tv, Excel.Worksheet sheet, string recordID, object modlecord)
        {
            string strvalue = "";
            string sqlSentence = tv.InitValue;
            IList li = new ArrayList();
            Regex r1;
            int i = 0;
            if (sqlSentence.IndexOf("Excel:") == 0)
            {
                int index1 = sqlSentence.LastIndexOf(":");
                string tablename = sqlSentence.Substring(6, index1 - 6);
                string cellpos = sqlSentence.Substring(index1 + 1);
                string[] arrCellPos = cellpos.Split('|');
                arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|');




                for (i = 0; i < arrCellPos.Length; i++)
                {
                    Excel.Range range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]], sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]]);//坐标
                    strvalue += range.Value2;
                }
                li.Add(strvalue);
            }
            else if (sqlSentence != "")
            {
                if (sqlSentence.IndexOf("{recordid}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{recordid}", recordID);
                }
                if (sqlSentence.IndexOf("{orgcode}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{orgcode}", MainHelper.User.OrgCode);
                }
                if (sqlSentence.IndexOf("{userid}") > -1)
                {
                    sqlSentence = sqlSentence.Replace("{userid}", MainHelper.User.UserID);
                }


                try
                {
                    sqlSentence = sqlSentence.Replace("\r\n", " ");
                    li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", sqlSentence);
                    if (sqlSentence.IndexOf("where 9=9") > -1)
                    {
                        string strtemp = li[0].ToString();
                        li.Clear();
                        r1 = new Regex(@"[0-9]+\+[0-9]+");
                        if (r1.Match(strtemp).Value != "")
                        {
                            int istart = 1;
                            int ilen = 10;
                            r1 = new Regex(@"[0-9]+(?=\+)");
                            if (r1.Match(strtemp).Value != "")
                            {
                                istart = Convert.ToInt32(r1.Match(strtemp).Value);
                            }
                            r1 = new Regex(@"(?<=\+)[0-9]+");
                            if (r1.Match(strtemp).Value != "")
                            {
                                ilen = Convert.ToInt32(r1.Match(strtemp).Value); ;
                            }
                            for (i = istart; i <= ilen; i++)
                            {
                                li.Add(string.Format("{0}", i));
                            }
                        }
                        else
                        {
                            string[] strli = SelectorHelper.ToDBC(strtemp).Split(',');
                            foreach (string ss in strli)
                            {
                                li.Add(ss);
                            }

                        }

                    }
                }
                catch (Exception ex)
                {
                    li.Add("出错:" + ex.Message);
                }
            }
            i = 1;
            strvalue = "";
            List<string> list2 = new List<string>();
            foreach (string strvaluetemp in li)
            {

                if (tv.VarName.IndexOf("参加人员") > 0)
                {
                    if (i > 2)
                    {
                        strvalue += "等" + li.Count.ToString() + "人";
                        break;
                    }
                }
                if (list2.Contains(strvaluetemp)) continue;
                if (strvalue == "")
                    strvalue += strvaluetemp;
                else
                    strvalue += "、" + strvaluetemp;
                i++;
                list2.Add(strvaluetemp);
            }

            return strvalue;
        }
コード例 #8
0
ファイル: TaskAlterFm.cs プロジェクト: s7loves/mypowerscgl
        private void iniRiZhiData()
        {
            int i = 0;
            memoEdit1.Text = "说明 SQL语句支持中的特殊代码\r\n 固定值中 数字+数字:{1+10}表示1到10用于序号 {sortid}:当前表单的序号为sortid的字段\r\n{recordid}:票LP_Record的ID\r\n{orgcode}:用户单位编号\r\n{userid}:用户编号\r\n";
            this.memoEdit1.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(this.memoEdit1_EditValueChanging);

            if (rizdt == null)
            {
                rizdt = new DataTable();
                rizdt.Columns.Add("name", typeof(string));
                rizdt.Columns.Add("sql", typeof(string));
                gridControl1.DataSource = rizdt;
                gridView1.Columns["name"].Caption = "列名";
                gridView1.Columns["name"].OptionsColumn.AllowEdit = false;
                gridView1.Columns["name"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                gridView1.Columns["name"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                gridView1.Columns["sql"].Caption = "SQL语句";
                gridView1.Columns["sql"].OptionsColumn.AllowEdit = true;
                gridView1.Columns["sql"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                gridView1.Columns["sql"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            }
            rizdt.Rows.Clear();
            IList li = MainHelper.PlatformSqlMap.GetList("SelectLP_TempleList", " where ( ParentID not in (select LPID from LP_Temple where 1=1 and  CtrlSize!='目录') and  CtrlSize!='目录' ) order by cellname ");
            DataTable dt = ConvertHelper.ToDataTable(li);
            WinFormFun.LoadComboBox(cbxWorkDataTable, dt, "LPID", "CellName");
            li = MainHelper.PlatformSqlMap.GetList("SelectOneStr", "select name as 'name' from sysobjects where xtype='U'  or xtype='V' order by xtype ,name");

            dt = new DataTable();
            dt.Columns.Add("name", typeof(string));

            for (i = 0; i < li.Count; i++)
            {
                DataRow dr2 = dt.NewRow();
                dr2["name"] = li[i];
                dt.Rows.Add(dr2);
            }
            WinFormFun.LoadComboBox(cbxWorkDbTable, dt, "name", "name");

            WF_TaskVar tv = WorkFlowTask.GetTaskRiZhiVar(NowTask.TaskId, "工作地点");
            if (tv == null) tv = new WF_TaskVar();
            DataRow dr = rizdt.NewRow();
            dr["name"] = "工作地点";
            dr["sql"] = tv.InitValue;
            rizdt.Rows.Add(dr);

            tv = WorkFlowTask.GetTaskRiZhiVar(NowTask.TaskId, "项目");
            if (tv == null) tv = new WF_TaskVar();
            dr = rizdt.NewRow();
            dr["name"] = "项目";
            dr["sql"] = tv.InitValue;
            rizdt.Rows.Add(dr);

            tv = WorkFlowTask.GetTaskRiZhiVar(NowTask.TaskId, "负责人");
            if (tv == null) tv = new WF_TaskVar();
            dr = rizdt.NewRow();
            dr["name"] = "负责人";
            dr["sql"] = tv.InitValue;
            rizdt.Rows.Add(dr);

            tv = WorkFlowTask.GetTaskRiZhiVar(NowTask.TaskId, "参加人员");
            if (tv == null) tv = new WF_TaskVar();
            dr = rizdt.NewRow();
            dr["name"] = "参加人员";
            dr["sql"] = tv.InitValue;
            rizdt.Rows.Add(dr);


            WinFormFun.LoadComboBox(columnBox, rizdt, "sql", "name");
        }
コード例 #9
0
ファイル: RecordWorkTask.cs プロジェクト: s7loves/mypowerscgl
 /// <summary>
 /// 读取工作日志变量对应的值
 /// </summary>
 /// <param name="tv">工作日志变量</param>
 /// <param name="sheet">工作日志变量对应的工作表</param>
 /// <param name="recordID">记录ID</param>
 /// <returns>返回工作日志变量对应的值,不存在则为空</returns>
 public static string GetTaskVarRiZhiValue(WF_TaskVar tv, Excel.Worksheet sheet, string recordID)
 {
     return GetTaskVarRiZhiValue(tv, sheet, recordID, null);
 }
コード例 #10
0
ファイル: RecordWorkTask.cs プロジェクト: s7loves/mypowerscgl
        /// <summary>
        /// 读取工作日志变量对应的值
        /// </summary>
        /// <param name="tv">工作日志变量</param>
        /// <param name="dsoFramerWordControl1">Excel控件</param>
        /// <param name="recordID">记录ID</param>
        /// <param name="modlecord">模块记录</param>
        /// <returns>返回工作日志变量对应的值,不存在则为空</returns>
        public static string GetTaskVarRiZhiValue(WF_TaskVar tv, DSOFramerControl dsoFramerWordControl1, string recordID, object modlecord)
        {

            Excel.Worksheet xx = null;
            if (tv.TableName != "" && dsoFramerWordControl1 != null && tv.VarModule == "Excel")
            {
                Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
                for (int i = 1; i < wb.Application.Sheets.Count; i++)
                {
                    Excel.Worksheet sheet = wb.Application.Sheets[i] as Excel.Worksheet;
                    if (sheet.Name == tv.TableName)
                    {
                        xx = sheet;
                        break;
                    }
                }
            }
            return GetTaskVarRiZhiValue(tv, xx, recordID, modlecord);
        }
コード例 #11
0
ファイル: RecordWorkTask.cs プロジェクト: s7loves/mypowerscgl
        /// <summary>
        /// 找到工作日志关联的记录
        /// </summary>
        /// <param name="tv">日志任务变量</param>
        /// <param name="modleRecordlist">模块相关记录集</param>
        /// <returns>返回工作日志关联的记录</returns>
        public static object GetModleRecordObj(WF_TaskVar tv, object[] modleRecordlist)
        {
            object obj = null;
            for (int i = 0; i < modleRecordlist.Length && tv.TableName != "" && tv.VarModule == "数据库"; i++)
            {
                if (modleRecordlist[i].GetType().ToString().IndexOf(tv.TableName) > -1)
                {
                    obj = modleRecordlist[i];
                    break;
                }
            }

            return obj;
        }
コード例 #12
0
ファイル: RecordWorkTask.cs プロジェクト: s7loves/mypowerscgl
        private static void CreateJL(WF_TaskVar task, DSOFramerControl dsoFramerWordControl1, string recordID, params   object[] modlecordlist)
        {
            Type t = Type.GetType("Ebada.Scgl.Model." + task.VarName, false, true);
            if (t == null) return;
            object newobj = Activator.CreateInstance(t);
            PropertyInfo[] pts = t.GetProperties();
            foreach (PropertyInfo p in pts)
            {
                string name = p.Name;
                Regex r1 = new Regex(@"(?<=\[" + name + ":).*?(?=\\])");
                WF_TaskVar var = new WF_TaskVar();

                if (r1.Match(task.InitValue.Replace("\r\n", " ")).Value != "")
                {
                    var.InitValue = r1.Match(task.InitValue.Replace("\r\n", " ")).Value;
                }
                r1 = new Regex(@"(?<=\[" + name + "VarModule:).*?(?=\\])");
                if (r1.Match(task.InitValue.Replace("\r\n", " ")).Value != "")
                {
                    var.VarModule = r1.Match(task.InitValue.Replace("\r\n", " ")).Value;
                }
                else
                {
                    continue;
                }
                r1 = new Regex(@"(?<=\[" + name + "TableField:).*?(?=\\])");
                if (r1.Match(task.InitValue.Replace("\r\n", " ")).Value != "")
                {
                    var.TableField = r1.Match(task.InitValue.Replace("\r\n", " ")).Value;
                }
                try
                {
                    p.SetValue(newobj, GetTaskVarRiZhiValue(var, dsoFramerWordControl1, recordID, null), null);
                }
                catch { }
            }
            Client.ClientHelper.PlatformSqlMap.Create("Insert" + task.VarName, newobj);
        }
コード例 #13
0
ファイル: TaskVar.cs プロジェクト: s7loves/mypowerscgl
        //private void setParameter()
        //{
        //    sqlDataItem.ParameterList.Clear();
        //    sqlDataItem.AppendParameter("@TaskVarId", this.TaskVarId);
        //    sqlDataItem.AppendParameter("@WorkFlowId", this.WorkFlowId);
        //    sqlDataItem.AppendParameter("@WorkTaskId", this.WorkTaskId);
        //    sqlDataItem.AppendParameter("@VarName", this.VarName);
        //    sqlDataItem.AppendParameter("@VarType", this.VarType);
        //    sqlDataItem.AppendParameter("@VarModule", this.VarModule);
        //    sqlDataItem.AppendParameter("@DataBaseName", this.DataBaseName);
        //    sqlDataItem.AppendParameter("@TableName", this.TableName);
        //    sqlDataItem.AppendParameter("@TableField", this.TableField);
        //    sqlDataItem.AppendParameter("@InitValue", this.InitValue);
        //    sqlDataItem.AppendParameter("@AccessType", this.AccessType);
            

        //}
        ///// <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 InsertTaskVar()
        {
            //if (TaskVarId.Trim().Length == 0 || TaskVarId == null)
                //throw new Exception("InsertTaskVar方法错误,TaskVarId 不能为空!");
            try
            {
                //setInsertSql();//设定insert语句
                //setParameter();//设定参数
                //ClientDBAgent agent = new ClientDBAgent();
                //agent.ExecuteNonQuery(sqlDataItem);
                WF_TaskVar tv = MainHelper.PlatformSqlMap.GetOneByKey<WF_TaskVar>(TaskVarId);
                if (tv==null) tv = new WF_TaskVar();
                //tv.TaskVarId=this.TaskVarId;
                tv.TaskVarId = tv.CreateID();
                tv.WorkFlowId=this.WorkFlowId;
                tv.WorkTaskId=this.WorkTaskId;
                tv.VarName=this.VarName;
                tv.VarType=this.VarType;
                tv.VarModule=this.VarModule;
                tv.DataBaseName=this.DataBaseName;
                tv.TableName=this.TableName;
                tv.TableField=this.TableField;
                tv.InitValue=this.InitValue;
                tv.AccessType = this.AccessType;
                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                if(MainHelper.PlatformSqlMap.GetOneByKey <WF_TaskVar>(tv)==null)
                MainHelper.PlatformSqlMap.Create<WF_TaskVar>(tv);
                else
                    MainHelper.PlatformSqlMap.Update<WF_TaskVar>(tv);
            }
            catch (Exception ex)
            {
                throw ex;
            }


        }