Example #1
0
        private void btAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            PJ_ryda newobj = new PJ_ryda();
            if (parentID == null) return;
            newobj.OrgCode = parentObj.OrgCode;
            newobj.OrgName = parentObj.OrgName;
            if (parentID != null)
            {
                newobj.OrgCode = parentObj.OrgCode;
                newobj.OrgName = parentObj.OrgName;
            }
            newobj.CreateDate = DateTime.Now;
            Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin();
            newobj.CreateMan = m_UserBase.RealName;
            frmrsdaTemplate frm = new frmrsdaTemplate();
            frm.CurrRecord = newobj;
            frm.RowData = newobj;
            frm.Status = "add";
            if (frm.ShowDialog() == DialogResult.OK)
            {

                if (isWorkflowCall)
                {
                    WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                    mrwt.ModleRecordID = newobj.ID;
                    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 = newobj.GetType().ToString();
                    mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                    mrwt.CreatTime = DateTime.Now;
                    MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                    MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
                }
            }
            InitData();
        }
Example #2
0
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(PJ_ryda newobj)
 {
    if (parentID == null) return;
     newobj.OrgCode = parentID;
     newobj.OrgName = parentObj.OrgName;
     newobj.CreateDate = DateTime.Now;
     Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin();
     newobj.CreateMan = m_UserBase.RealName;
     try { frmLP.ReadTaskData(newobj, RecordWorkFlowData, ParentTemple, CurrRecord); } catch { }
 }
Example #3
0
        private void GetFileList(DSOFramerControl ds1, string strCurDir)
        {

            DirectoryInfo dir;
            ///针对当前目录建立目录引用对象
            DirectoryInfo dirInfo = new DirectoryInfo(strCurDir);
            foreach (FileSystemInfo fsi in dirInfo.GetFileSystemInfos())
            {
                if (fsi is FileInfo)
                {

                    if (fsi.Extension.IndexOf(".xls") < 0) continue;
                    string filename = fsi.FullName;
                    ds1.FileOpen(filename);
                    IList<LP_Temple> templeList = new List<LP_Temple>();
                    LP_Temple parentTemple = MainHelper.PlatformSqlMap.GetOne<LP_Temple>("where ParentID not in (select LPID from LP_Temple where 1=1 and  CtrlSize!='目录') and  CellName like '%安规电子档案%'");
                    if (parentTemple != null) templeList = MainHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList",
                        "where ParentID ='" + parentTemple.LPID + "' order by SortID");
                    Excel.Worksheet xx = null;
                    Excel.Workbook wb = ds1.AxFramerControl.ActiveDocument as Excel.Workbook;
                    Excel.Worksheet sheet = wb.Application.Sheets[1] as Excel.Worksheet;
                    PJ_ryda currRecord = new PJ_ryda();
                    currRecord.CreateDate = DateTime.Now;
                    currRecord.BigData = ds1.FileDataGzip;
                    Excel.Range range;
                    WF_TableFieldValue wfv;
                    int i = 0;

                    foreach (LP_Temple lp in templeList)
                    {
                        string[] arrCellPos = lp.CellPos.Split('|');
                        arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|');
                        if (lp.CtrlType.Contains("uc_gridcontrol"))
                        {
                            if (lp.CellName.IndexOf("培训情况") > -1)
                            {
                                for (i = 0; i < 6; i++)
                                {
                                    range = sheet.get_Range(sheet.Cells[11 + i, 1], sheet.Cells[11 + i, 1]);//坐标
                                    if (range.Value2 != null && range.Value2.ToString() != "")
                                    {
                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[0])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[0])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "培训时间1";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        if (wfv.ControlValue != "" && wfv.FieldName.IndexOf("时间") > 0)
                                        {
                                            wfv.ControlValue = range.Value2.ToString().Replace(".", "-");
                                            DateTime dt = Convert.ToDateTime(wfv.ControlValue);
                                            wfv.ControlValue = dt.ToString("yyyy年MM月dd日");
                                        }
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);

                                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                                        range = sheet.get_Range(sheet.Cells[11 + i, 2], sheet.Cells[11 + i, 2]);//坐标
                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[1])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[1])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "培训类别1";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);
                                    }

                                    Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                                    range = sheet.get_Range(sheet.Cells[11 + i, 3], sheet.Cells[11 + i, 3]);//坐标
                                    if (range.Value2 != null && range.Value2.ToString() != "")
                                    {
                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[2])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[2])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "培训时间2";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        if (wfv.ControlValue != "" && wfv.FieldName.IndexOf("时间") > 0)
                                        {
                                            wfv.ControlValue = range.Value2.ToString().Replace(".", "-");
                                            DateTime dt = Convert.ToDateTime(wfv.ControlValue);
                                            wfv.ControlValue = dt.ToString("yyyy年MM月dd日");
                                        }

                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);
                                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                                        range = sheet.get_Range(sheet.Cells[11 + i, 4], sheet.Cells[11 + i, 4]);//坐标
                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[3])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[3])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "培训类别2";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);
                                    }
                                }
                            }
                            else if (lp.CellName.IndexOf("考试情况") > -1)
                            {
                                for (i = 0; i < 12; i++)
                                {
                                    range = sheet.get_Range(sheet.Cells[19 + i, 1], sheet.Cells[19 + i, 1]);//坐标
                                    if (range.Value2 != null && range.Value2.ToString() != "")
                                    {

                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[0])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[0])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "考试时间";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        if (wfv.ControlValue != "" && wfv.FieldName.IndexOf("时间") > 0)
                                        {
                                            wfv.ControlValue = range.Value2.ToString().Replace(".", "-");
                                            DateTime dt = Convert.ToDateTime(wfv.ControlValue);
                                            wfv.ControlValue = dt.ToString("yyyy年MM月dd日");
                                        }
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);
                                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                                        range = sheet.get_Range(sheet.Cells[19 + i, 2], sheet.Cells[19 + i, 2]);//坐标
                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[1])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[1])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "考试类别";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);


                                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                                        range = sheet.get_Range(sheet.Cells[19 + i, 3], sheet.Cells[19 + i, 3]);//坐标

                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[2])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[2])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "考试成绩";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);

                                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                                        range = sheet.get_Range(sheet.Cells[19 + i, 4], sheet.Cells[19 + i, 4]);//坐标
                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[3])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[3])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "考试评价";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);

                                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                                        range = sheet.get_Range(sheet.Cells[19 + i, 5], sheet.Cells[19 + i, 5]);//坐标
                                        wfv = new WF_TableFieldValue();
                                        wfv.ID = wfv.CreateID();
                                        wfv.RecordId = currRecord.ID;
                                        wfv.WorkFlowId = currRecord.ID;
                                        wfv.WorkFlowInsId = currRecord.wdmc;
                                        wfv.WorkTaskId = "安规电子档案";
                                        wfv.WorkTaskInsId = "安规电子档案";
                                        wfv.UserControlId = parentTemple.LPID;
                                        wfv.XExcelPos = GetCellPos(arrCellPos[4])[0];
                                        wfv.YExcelPos = GetCellPos(arrCellPos[4])[1];
                                        wfv.FieldId = lp.LPID;
                                        wfv.FieldName = lp.CellName + "-" + "年检情况";
                                        wfv.ExcelSheetName = lp.KindTable;
                                        if (range.Value2 != null)
                                            wfv.ControlValue = range.Value2.ToString();
                                        MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);
                                    }

                                }
                            }
                        }
                        else
                        {
                            range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[0])[0], GetCellPos(arrCellPos[0])[1]], sheet.Cells[GetCellPos(arrCellPos[0])[0], GetCellPos(arrCellPos[0])[1]]);//坐标
                            wfv = new WF_TableFieldValue();
                            wfv.ID = wfv.CreateID();
                            wfv.RecordId = currRecord.ID;
                            wfv.WorkFlowId = currRecord.ID;
                            wfv.WorkFlowInsId = currRecord.wdmc;
                            wfv.WorkTaskId = "安规电子档案";
                            wfv.WorkTaskInsId = "安规电子档案";
                            wfv.UserControlId = parentTemple.LPID;
                            wfv.XExcelPos = GetCellPos(arrCellPos[0])[0];
                            wfv.YExcelPos = GetCellPos(arrCellPos[0])[1];
                            wfv.FieldId = lp.LPID;
                            wfv.FieldName = lp.CellName;
                            wfv.ExcelSheetName = lp.KindTable;
                            if (range.Value2 != null)
                                wfv.ControlValue = range.Value2.ToString();
                            if (wfv.ControlValue != "" && lp.CellName == "出生年月日")
                            {
                                wfv.ControlValue = range.Value2.ToString().Replace(".", "-");
                                DateTime dt = Convert.ToDateTime(wfv.ControlValue);
                                wfv.ControlValue = dt.ToString("yyyy年MM月dd日");
                            }
                            if (wfv.ControlValue != "" && lp.CellName == "参加工作时间")
                            {
                                try
                                {
                                    wfv.ControlValue = range.Value2.ToString().Replace(".", "-");
                                    DateTime dt = Convert.ToDateTime(wfv.ControlValue);

                                    wfv.ControlValue = dt.ToString("yyyy年MM月dd日");
                                }
                                catch
                                {
                                    DateTime dt = new DateTime(Convert.ToInt32(wfv.ControlValue));

                                    wfv.ControlValue = dt.ToString("yyyy年MM月dd日");
                                }
                            }
                            if (lp.CellName == "姓名")
                            {
                                currRecord.wdmc = wfv.ControlValue;
                            }
                            else if (lp.CellName == "职务")
                            {
                                currRecord.wdlx = wfv.ControlValue;
                            }
                            else if (lp.CellName == "所在单位")
                            {
                                currRecord.OrgName = wfv.ControlValue.Replace(MainHelper.UserCompany, "");
                                mOrg org = MainHelper.PlatformSqlMap.GetOne<mOrg>("where OrgName='" + currRecord.OrgName + "'");
                                if (org != null)
                                {
                                    currRecord.OrgCode = org.OrgCode;
                                }
                            }
                            wfv.WorkFlowInsId = currRecord.wdmc;
                            MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);
                            Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                        }
                    }
                    currRecord.CreateMan = MainHelper.User.UserName;
                    MainHelper.PlatformSqlMap.Create<PJ_ryda>(currRecord);
                    ds1.FileSave();
                    ds1.FileClose();
                }
                else
                {
                    dir = (DirectoryInfo)fsi;






                    //获取文件夹路径
                    GetFileList(ds1, strCurDir + "\\" + dir.Name);


                }
            }
        }
Example #4
0
 void gridViewOperation_AfterAdd(PJ_ryda newobj)
 {
     if (isWorkflowCall)
     {
         WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
         mrwt.ModleRecordID = newobj.ID;
         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 = newobj.GetType().ToString();
         mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
         mrwt.CreatTime = DateTime.Now;
         MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
         currRecord.DocContent = newobj.BigData;
         MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
     }
 }
Example #5
0
 void gridViewOperation_AfterDelete(PJ_ryda newobj)
 {
     MainHelper.PlatformSqlMap.DeleteByWhere <WF_TableFieldValue>(" where    1=1 "
                         + " and   RecordId='" + newobj.ID  + "'"
                         + " and   WorkFlowId='" + newobj.ID + "'"
                         + " and   WorkFlowInsId='" + newobj.wdmc + "'"
                         + " and   WorkTaskId='安规电子档案'"
                         + " and WorkTaskInsId='安规电子档案'");
 }
Example #6
0
        void btn_Submit_Click(object sender, EventArgs e)
        {
            Excel.Workbook wb;
            Excel.Worksheet sheet;
            dsoFramerWordControl1.FileSave();
            currRecord.BigData = this.dsoFramerWordControl1.FileDataGzip;
            wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
            if (activeSheetName != "")
            {
                sheet = wb.Application.Sheets[activeSheetName] as Excel.Worksheet;
            }
            else
            {
                sheet = wb.Application.Sheets[1] as Excel.Worksheet;
            }
            activeSheetIndex = sheet.Index;
            
            for (int i = 1; i <= wb.Application.Sheets.Count; i++)
            {
                if (i != activeSheetIndex)
                {
                    Excel.Worksheet tmpSheet = (Excel.Worksheet)wb.Application.Sheets.get_Item(i);
                    try
                    {
                        if (tmpSheet != null) tmpSheet.Visible = Excel.XlSheetVisibility.xlSheetVisible ;
                    }
                    catch { }

                }
            }
            unLockExcel(wb,sheet);
            for (int i = 1; sheet.Protection.AllowEditRanges.Count > 0; )
            {
                Excel.AllowEditRange editRange = sheet.Protection.AllowEditRanges.get_Item(i);
                editRange.Delete();
            }
            LockExcel(wb, sheet);
            byte[] bt = new byte[0];
            string strmes = "";
            WF_WorkTaskCommands wt;
            LP_Temple lp = MainHelper.PlatformSqlMap.GetOne<LP_Temple>("where ParentID='" + parentTemple.LPID + "' and  CellName like '%姓名%'");
            Control ctl = FindCtrl(lp.LPID);
            if (ctl != null)
            {
                currRecord.wdmc = ctl.Text;
            }
            lp = MainHelper.PlatformSqlMap.GetOne<LP_Temple>("where ParentID='" + parentTemple.LPID + "' and  CellName like '%职务%'");
             ctl = FindCtrl(lp.LPID);
            if (ctl != null)
            {
                currRecord.wdlx = ctl.Text;
            }
            //rowData = null;
            ArrayList akeys = new ArrayList(valuehs.Keys);
            List<object> list = new List<object>();
            for (int i = 0; i < akeys.Count; i++)
            {
                WF_TableFieldValue wfv = valuehs[akeys[i]] as WF_TableFieldValue;
                wfv.ID = wfv.CreateID();
                wfv.RecordId = currRecord.ID;
                wfv.WorkFlowId = currRecord.ID ;
                wfv.WorkFlowInsId = currRecord.wdmc ;
                wfv.WorkTaskId = "安规电子档案";
                wfv.WorkTaskInsId = "安规电子档案";
                wfv.UserControlId = parentTemple.LPID;
                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                list.Add(wfv);
                if (wfv.FieldName == "所在单位")
                {

                    rowData.OrgName = wfv.ControlValue.Replace(MainHelper.UserCompany, "");
                    mOrg org = MainHelper.PlatformSqlMap.GetOne<mOrg>("where OrgName='" + rowData.OrgName + "'");
                    if (org != null)
                    {
                        rowData.OrgCode = org.OrgCode;
                    }
                }
                for (int j = 0; j < templeList.Count; j++)
                {
                    if (templeList[j].LPID == wfv.FieldId)
                    {
                        templeList.RemoveAt(j);
                        break;
                    }
                }
            }
            Control ct=null;
            for (int i = 0; i < templeList.Count; i++)
            {
                WF_TableFieldValue wfv = new  WF_TableFieldValue();
                wfv.ExcelSheetName = templeList[i].KindTable;
                if (templeList[i].CellPos != "")
                {
                    wfv.XExcelPos = GetCellPos(templeList[i].CellPos)[0];
                    wfv.YExcelPos = GetCellPos(templeList[i].CellPos)[1];
                }
                else
                {

                    wfv.XExcelPos = -1;
                    wfv.YExcelPos = -1;
                }
                wfv.FieldId = templeList[i].LPID;
                wfv.FieldName = templeList[i].CellName;
                ct = FindCtrl( templeList[i].LPID);
                if(ct!=null)
                wfv.ControlValue=ct.Text;

                wfv.ID = wfv.CreateID();
                wfv.RecordId = currRecord.ID;
                wfv.WorkFlowId = currRecord.ID;
                wfv.WorkFlowInsId = currRecord.wdmc;
                wfv.WorkTaskId = "安规电子档案";
                wfv.WorkTaskInsId = "安规电子档案";
                wfv.UserControlId = parentTemple.LPID;
                wfv.UserControlId = parentTemple.LPID;
                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                list.Add(wfv);
               
            }
            
            switch (status)
            {
                case "add":

                    if (list.Count > 0)
                    {
                        Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(list, null, null);
                    }
                    if (currRecord.BigData == null)
                    {
                        currRecord.BigData = new byte[0];
                    }
                     Client.ClientHelper.PlatformSqlMap.Create<PJ_ryda >(currRecord);
                    break;

                case "edit":

                    if (list.Count > 0)
                    {
                        foreach (WF_TableFieldValue wfv in list)
                        {
                           WF_TableFieldValue wtfvtemp= Client.ClientHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(" where  UserControlId='" + parentTemple.LPID + "'"
                                + " and   WorkflowId='" + wfv.WorkFlowId + "'"
                                + " and   RecordId='" + wfv.RecordId + "'"
                                + " and   UserControlId='" + wfv.UserControlId + "'"
                                + " and   WorkFlowInsId='" + wfv.WorkFlowInsId + "'"
                                + " and   fieldname='" + wfv.FieldName  + "'"
                                + " and   FieldId='" + wfv.FieldId + "'"
                                + " and   XExcelPos='" + wfv.XExcelPos + "'"
                                + " and   YExcelPos='" + wfv.YExcelPos + "'"
                                + " and WorkTaskInsId='安规电子档案'");
                           if (wtfvtemp != null)
                               wfv.ID = wtfvtemp.ID;
                           else
                           {
                               Client.ClientHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv);
                           }
                        }
                        Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, list, null);
                    }
                    if (currRecord.BigData == null)
                    {
                        currRecord.BigData = new byte[0];
                    }
                    Client.ClientHelper.PlatformSqlMap.Update<PJ_ryda>(currRecord);
                    break;
            }

            dsoFramerWordControl1.FileSave();
            //dsoFramerWordControl1.FileClose();
            rowData = currRecord;
            this.DialogResult = DialogResult.OK;
        }
Example #7
0
        private void LPFrm_Load(object sender, EventArgs e)
        {
            if (tempCtrlList==null)
            {
                tempCtrlList = new List<Control>();
            }
            //this.Text = "安规电子档案";
            //InitializeComponent();
            if (valuehs == null)
                valuehs = new Hashtable();
            Excel.Workbook wb;
            Excel.Worksheet sheet;
            ExcelAccess ea = new ExcelAccess();
            parentTemple = MainHelper.PlatformSqlMap.GetOne<LP_Temple>("where ParentID not in (select LPID from LP_Temple where 1=1 and  CtrlSize!='目录') and  CellName like '%安规电子档案%'");
            currRecord = rowData;
            if (parentTemple == null)
            {
                MsgBox.ShowWarningMessageBox("没有找到安规电子档案!");
                return;
            }
            if (currRecord.BigData == null || currRecord.BigData.Length == 0)
            {
                
                this.dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent;
            }
            else
            {
                
                this.dsoFramerWordControl1.FileDataGzip = currRecord.BigData;
            }
                InitIndex();
                InitContorl();
                InitData();
            
                if (_type == "")
                { 
                    wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
                    Excel.Worksheet xx;
                    wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
                    ea.MyWorkBook = wb;
                    ea.MyExcel = wb.Application;
                    string activeSheetName = "";
                    xx = wb.Application.Sheets[1] as Excel.Worksheet;
                    LockExcel(wb,xx);
                }
                if (status == "edit")
                {
                    IList<WF_TableFieldValue> tfvli = MainHelper.PlatformSqlMap.GetList<WF_TableFieldValue>("SelectWF_TableFieldValueList",
                     " where RecordId='" + currRecord.ID + "' and UserControlId='" + parentTemple.LPID + "' and   WorkflowId='" + currRecord.ID + "' and WorkFlowInsId='" + currRecord.wdmc + "' ");
                   
                    Excel.Worksheet xx;
                    wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
                    ea.MyWorkBook = wb;
                    ea.MyExcel = wb.Application;
                    string activeSheetName = "";
                    xx = wb.Application.Sheets[1] as Excel.Worksheet;
                    int i = 0;
                    
                    for (i = 0; i < tfvli.Count; i++)
                    {
                      
                        Control ctl= FindCtrl(tfvli[i].FieldId);
                        if (ctl != null)
                        {
                            ctl.Text = tfvli[i].ControlValue;
                            ctl.Focus();
                        }
                       

                    }
                    dsoFramerWordControl1.FileSave();
                }

                if (_type == "")
                {
                    this.dockPanel1.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden  ;
                }
              
        }
Example #8
0
        private void frmLP_FormClosed(object sender, FormClosedEventArgs e)
        {
           
            try
            { 
                //base.Close();
                currRecord = null;

                dsoFramerWordControl1.FileSave();
                dsoFramerWordControl1.FileClose();
                dsoFramerWordControl1.Dispose();
                dockPanel1.ControlContainer.Controls.Clear();
                templeList.Clear();
                    //if (filecontrol != null)
                    //{

                    //    if (filecontrol.upThread != null && filecontrol.upThread.ThreadState == ThreadState.Running)
                    //    {
                            
                    //            filecontrol.upThread.IsBackground = true;
                    //            filecontrol.upThread.Abort();
                           
                    //    }
                    //    if (filecontrol.Isdownfile)
                    //    {

                    //        if (filecontrol.webClient!=null) filecontrol.webClient.CancelAsync();

                    //    }
                    //}
            }
            catch { }
        }