Esempio n. 1
0
 private void bt_save_Click(object sender, EventArgs e)
 {
     if (module != null)
     {
         ModuleHelperClient.UpdateModuleSetting(module);
     }
     this.Close();
 }
Esempio n. 2
0
        private void TemperatureDialog_Load(object sender, EventArgs e)
        {
            FpSpread_Info.Rows.Count    = 0;
            FpSpread_Info.Columns.Count = 12;
            FpSpread_Info.ColumnHeader.Cells[0, 0].Text  = "ID";
            FpSpread_Info.ColumnHeader.Cells[0, 1].Text  = "项名称";
            FpSpread_Info.ColumnHeader.Cells[0, 2].Text  = "项类型";
            FpSpread_Info.ColumnHeader.Cells[0, 3].Text  = "权重";
            FpSpread_Info.ColumnHeader.Cells[0, 4].Text  = "中午温度";
            FpSpread_Info.ColumnHeader.Cells[0, 5].Text  = "傍晚温度";
            FpSpread_Info.ColumnHeader.Cells[0, 6].Text  = "平均温度";
            FpSpread_Info.ColumnHeader.Cells[0, 7].Text  = "备注";
            FpSpread_Info.ColumnHeader.Cells[0, 10].Text = "IsUpdated";


            FarPoint.Win.Spread.CellType.DateTimeCellType datetime = new FarPoint.Win.Spread.CellType.DateTimeCellType();
            datetime.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;
            FarPoint.Win.Spread.CellType.NumberCellType number = new FarPoint.Win.Spread.CellType.NumberCellType();
            FarPoint.Win.Spread.CellType.TextCellType   text   = new FarPoint.Win.Spread.CellType.TextCellType();
            //number
            FpSpread_Info.Columns[0].Visible  = false;
            FpSpread_Info.Columns[1].Visible  = false;
            FpSpread_Info.Columns[2].CellType = datetime;
            FpSpread_Info.Columns[2].Locked   = true;
            FpSpread_Info.Columns[3].CellType = number;
            FpSpread_Info.Columns[4].CellType = number;
            FpSpread_Info.Columns[5].CellType = number;
            FpSpread_Info.Columns[6].CellType = number;
            FpSpread_Info.Columns[6].Locked   = true;
            FpSpread_Info.Columns[7].CellType = text;
            FpSpread_Info.Columns[8].Visible  = false;
            FpSpread_Info.Columns[9].Visible  = false;
            FpSpread_Info.Columns[10].Visible = false;
            FpSpread_Info.Columns[11].Visible = false;

            int TemperatureType = 0;

            DataTable Data = ModuleHelperClient.GetTemperatureList("000", new DateTime(2014, 1, 2), new DateTime(2014, 1, 1), TemperatureType);

            FpSpread_Info.DataSource = Data;

            FpSpread_Info.Columns[2].Width = 100;
            FpSpread_Info.Columns[3].Width = 100;
            FpSpread_Info.Columns[4].Width = 100;
            FpSpread_Info.Columns[5].Width = 100;
            FpSpread_Info.Columns[6].Width = 100;
            FpSpread_Info.Columns[7].Width = 200;
        }
Esempio n. 3
0
        private void Button_Save_Click(object sender, EventArgs e)
        {
            //String TestRoomCode = Yqun.Common.ContextCache.ApplicationContext.Current.InTestRoom.Code;
            string UserName = Yqun.Common.ContextCache.ApplicationContext.Current.UserName;

            try
            {
                using (DataTable dt = FpSpread_Info.GetDataView(true).Table)
                {
                    int IsUpdated = 0;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        IsUpdated = int.Parse(dt.Rows[i][10].ToString());
                        if (IsUpdated == 0)
                        {
                            dt.Rows.Remove(dt.Rows[i]);
                            i--;
                        }
                    }
                    if (dt.Rows.Count > 0)
                    {
                        int TemperatureType = 0;
                        if (rbSDNei.Checked)
                        {
                            TemperatureType = 1;
                        }
                        if (bool.Parse(ModuleHelperClient.SaveTemperatures(TestRoomCode, UserName, dt, TemperatureType)))// FpSpread_Info.GetDataView(true).Table
                        {
                            MessageBox.Show("实验记录保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("实验记录保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show("没有更改任何数据,不需要保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    BindDayList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 4
0
        private void SearchUnusedTestData(string strWTBH)
        {
            DataTable Data = CaiJiHelperClient.GetUnusedTestData(strWTBH);

            if (Data != null)
            {
                FpSpread_Info.Columns[0].Width  = 80;
                FpSpread_Info.Columns[1].Width  = 80;
                FpSpread_Info.Columns[2].Width  = 120;
                FpSpread_Info.Columns[3].Width  = 100;
                FpSpread_Info.Columns[4].Width  = 100;
                FpSpread_Info.Columns[5].Width  = 40;
                FpSpread_Info.Columns[6].Width  = 80;
                FpSpread_Info.Columns[7].Width  = 400;
                FpSpread_Info.Columns[8].Width  = 100;
                FpSpread_Info.Columns[9].Width  = 100;
                FpSpread_Info.Columns[10].Width = 100;
                FpSpread_Info.Columns[11].Width = 120;

                FpSpread_Info.Rows.Count = Data.Rows.Count;

                int    i, j;
                string strModuleIDs = string.Empty;

                foreach (DataRow Row in Data.Rows)
                {
                    strModuleIDs += "'" + Row["ModuleID"].ToString() + "',";
                }
                if (strModuleIDs.Length > 0)
                {
                    strModuleIDs = strModuleIDs.Substring(0, strModuleIDs.Length - 1);
                }
                DataTable dtSheet = ModuleHelperClient.GetSheetIDAndName(strModuleIDs);
                foreach (System.Data.DataColumn Column in Data.Columns)
                {
                    i = Data.Columns.IndexOf(Column);

                    FpSpread_Info.Columns[i].VerticalAlignment = CellVerticalAlignment.Center;
                    FpSpread_Info.Columns[i].Label             = Column.ColumnName;

                    foreach (DataRow Row in Data.Rows)
                    {
                        j = Data.Rows.IndexOf(Row);
                        if (i == 7)//解析试验结果
                        {
                            string        strTestData     = Row[Column.ColumnName].ToString();
                            StringBuilder strTestDataName = new StringBuilder();
                            try
                            {
                                List <JZTestCell> lstJZTC      = Newtonsoft.Json.JsonConvert.DeserializeObject <List <JZTestCell> >(strTestData);
                                string            strSheetName = string.Empty;
                                bool bHaveSheet = false;;
                                foreach (JZTestCell tcItem in lstJZTC)
                                {
                                    if (bHaveSheet == false)
                                    {
                                        bHaveSheet   = true;
                                        strSheetName = GetSheetName(dtSheet, tcItem.SheetID.ToString());
                                        if (string.IsNullOrEmpty(strSheetName))
                                        {
                                            strTestDataName.Append(tcItem.SheetID + "|");
                                        }
                                        else
                                        {
                                            strTestDataName.Append(strSheetName + "|");
                                        }
                                    }
                                    switch (tcItem.Name)
                                    {
                                    case JZTestEnum.DHBJ:
                                        strTestDataName.Append("断后标距:" + tcItem.Value);
                                        break;

                                    case JZTestEnum.LDZDL:
                                        strTestDataName.Append("拉断最大力:" + tcItem.Value);
                                        break;

                                    case JZTestEnum.PHHZ:
                                        strTestDataName.Append("破坏荷载:" + tcItem.Value);
                                        break;

                                    case JZTestEnum.QFL:
                                        strTestDataName.Append("屈服力:" + tcItem.Value);
                                        break;

                                    default:
                                        break;
                                    }
                                    strTestDataName.Append(";");
                                }
                            }
                            catch (Exception ex)
                            {
                                //logger.Error(string.Format("解析Json出错,TestData:{0},Exception:{1}", strTestData, ex.Message));
                                strTestDataName.Append(strTestData);
                                //continue;
                            }
                            FpSpread_Info.Cells[j, i].Value = strTestDataName.ToString();
                        }
                        else
                        {
                            FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center;
                            FpSpread_Info.Cells[j, i].Value           = Row[Column.ColumnName].ToString();
                        }
                        FpSpread_Info.Rows[j].Tag = Row["ID"];
                    }
                }
            }
        }
Esempio n. 5
0
 private void ModelFieldSettingDialog_Load(object sender, EventArgs e)
 {
     this.fpSpread1_Sheet1.OperationMode = OperationMode.ReadOnly;
     module = ModuleHelperClient.GetModuleBaseInfoByID(moduleID);
     BindQualifySetting();
 }
Esempio n. 6
0
        public static void InitModuleCatlog(TreeView View)
        {
            View.Nodes.Clear();
            TreeNode TopNode = new TreeNode();

            TopNode.Name = "";
            TopNode.Text = "模板列表";
            TopNode.SelectedImageIndex = 1;
            TopNode.ImageIndex         = 0;
            View.Nodes.Add(TopNode);
            DataSet   ds      = ModuleHelperClient.GetModuleCategoryAndModule();
            DataTable dt      = ds.Tables["dbo.sys_biz_ModuleCatlog"];
            DataTable sheetDT = ds.Tables["dbo.sys_module"];

            string strDeniedModuleIDs = "";
            //Yqun.Common.ContextCache.ApplicationContext.Current.DeniedModuleIDs;
            List <string> lstDeniedModuleIDs;

            if (!string.IsNullOrEmpty(strDeniedModuleIDs))
            {
                lstDeniedModuleIDs = new List <string>(strDeniedModuleIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
            }
            else
            {
                lstDeniedModuleIDs = new List <string>();
            }
            bool isDenied = false;

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    TreeNode node = new TreeNode();
                    node.Name = row["CatlogCode"].ToString();
                    node.Text = row["CatlogName"].ToString();
                    node.SelectedImageIndex = 1;
                    node.ImageIndex         = 0;
                    node.Tag = false;
                    TopNode.Nodes.Add(node);
                    DataRow[] sheetRows = sheetDT.Select("CatlogCode like '" + row["CatlogCode"] + "%' ", "Name asc");
                    if (sheetRows != null && sheetRows.Length > 0)
                    {
                        foreach (DataRow r1 in sheetRows)
                        {
                            TreeNode n = new TreeNode();
                            n.Name = r1["ID"].ToString();
                            n.Text = r1["Name"].ToString();
                            n.SelectedImageIndex = 2;
                            n.ImageIndex         = 2;
                            n.Tag = true;
                            if (lstDeniedModuleIDs.Count > 0)
                            {
                                isDenied = false;
                                foreach (string item in lstDeniedModuleIDs)
                                {
                                    if (item == n.Name)
                                    {
                                        isDenied = true;
                                        break;
                                    }
                                }
                            }
                            if (isDenied == true)
                            {
                                continue;
                            }
                            else
                            {
                                node.Nodes.Add(n);
                            }
                        }
                    }
                }
            }
            View.ExpandAll();
        }
Esempio n. 7
0
        private void DataDialog_Load(object sender, EventArgs e)
        {
            ProgressScreen.Current.ShowSplashScreen();
            this.AddOwnedForm(ProgressScreen.Current);

            Dictionary <Guid, SheetView> SheetCollection = new Dictionary <Guid, SheetView>();
            JZDocument           document               = DocumentHelperClient.GetDocumentByID(DataID);
            JZDocument           defaultDocument        = ModuleHelperClient.GetDefaultDocument(ModuleID);
            List <JZFormulaData> CrossSheetFormulaInfos = ModuleHelperClient.GetLineFormulaByModuleIndex(ModuleID);

            FpSpread.Sheets.Clear();
            LoadSpread(FpSpread, ModuleID);
            #region 初始化表单
            foreach (JZSheet sheet in defaultDocument.Sheets)
            {
                SheetView SheetView = GetSheet(sheet.ID);
                foreach (JZCell dataCellDefault in sheet.Cells)
                {
                    Cell    cell     = SheetView.Cells[dataCellDefault.Name];
                    Object  value    = JZCommonHelper.GetCellValue(document, sheet.ID, dataCellDefault.Name);
                    Boolean hasValue = true;
                    if (value == null || value.ToString() == "")
                    {
                        hasValue = false;
                    }
                    if (cell != null)
                    {
                        #region 处理单元格
                        cell.Locked = false;
                        cell.Font   = defaultFont;
                        if (cell.CellType is DownListCellType)
                        {
                            DownListCellType CellType = cell.CellType as DownListCellType;
                            CellType.DropDownButton = false;
                            CellType.DesignMode     = false;
                            cell.Value = value;
                        }
                        else if (cell.CellType is TextCellType)
                        {
                            TextCellType CellType = cell.CellType as TextCellType;
                            if (CellType.FieldType.Description == FieldType.Text.Description)
                            {
                                CellType.Multiline = true;
                                CellType.WordWrap  = true;
                            }
                            CellType.MaxLength = CellType.FieldType.Length;
                            if (hasValue)
                            {
                                cell.Value = value.ToString().Trim('\r', '\n');;
                            }
                            else
                            {
                                cell.Value = value;
                            }
                        }
                        else if (cell.CellType is LongTextCellType)
                        {
                            LongTextCellType CellType = cell.CellType as LongTextCellType;
                            if (CellType.FieldType.Description == FieldType.LongText.Description)
                            {
                                CellType.Multiline = true;
                                CellType.WordWrap  = true;
                            }
                            CellType.MaxLength = CellType.FieldType.Length;
                            if (hasValue)
                            {
                                cell.Value = value.ToString().Trim('\r', '\n');;
                            }
                            else
                            {
                                cell.Value = value;
                            }
                        }
                        else if (cell.CellType is DateTimeCellType)
                        {
                            DateTimeCellType CellType = cell.CellType as DateTimeCellType;
                            CellType.MinimumDate = new DateTime(1753, 1, 1);
                            CellType.MaximumDate = new DateTime(9999, 12, 31);
                            cell.Value           = value;
                        }
                        else if (cell.CellType is RichTextCellType)
                        {
                            RichTextCellType CellType = cell.CellType as RichTextCellType;
                            CellType.Multiline = false;
                            CellType.WordWrap  = false;
                            CellType.MaxLength = CellType.FieldType.Length;
                            if (hasValue)
                            {
                                cell.Value = value.ToString().Trim('\r', '\n');
                            }
                            else
                            {
                                cell.Value = value;
                            }
                        }
                        else if (cell.CellType is DeleteLineCellType)
                        {//删除线
                            DeleteLineCellType CellType = cell.CellType as DeleteLineCellType;
                            CellType.Multiline = true;
                            CellType.WordWrap  = true;
                            CellType.MaxLength = CellType.FieldType.Length;
                            cell.CellType      = CellType;
                            object objOld = cell.Text;
                            if (hasValue)
                            {
                                cell.Value = new System.Text.RegularExpressions.Regex("'+").Replace(value.ToString(), "'"); //value.ToString();
                                if (string.IsNullOrEmpty(cell.Text))
                                {
                                    RichTextBox rt = new RichTextBox();
                                    rt.Text    = objOld == null ? "" : objOld.ToString();
                                    rt.Font    = new Font("宋体", 10.5f, FontStyle.Regular);
                                    cell.Value = rt.Rtf;
                                }
                            }
                            else
                            {
                                RichTextBox rt = new RichTextBox();
                                rt.Text    = objOld == null ? "" : objOld.ToString();
                                rt.Font    = new Font("宋体", 10.5f, FontStyle.Regular);
                                cell.Value = rt.Rtf;
                            }
                        }
                        else if (cell.CellType is NumberCellType)
                        {
                            NumberCellType CellType = cell.CellType as NumberCellType;
                            CellType.MaximumValue = 999999999.9999;
                            CellType.MinimumValue = -999999999.9999;
                            cell.Value            = value;
                        }
                        else if (cell.CellType is MaskCellType)
                        {
                            MaskCellType CellType = cell.CellType as MaskCellType;
                            for (int i = CellType.Mask.Length; i < CellType.FieldType.Length; i++)
                            {
                                CellType.Mask += "0";
                            }


                            if (CellType.CustomMaskCharacters != null && CellType.CustomMaskCharacters.Length > 0)
                            {
                                CellType.CustomMaskCharacters[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-()ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ()复检";
                            }
                            if (value == null || value.ToString().Trim() == "")
                            {
                                cell.Value = null;
                            }
                            else
                            {
                                cell.Value = value.ToString().Trim();
                            }
                        }
                        else if (cell.CellType is ImageCellType)
                        {
                            if (value != null)
                            {
                                cell.Value = JZCommonHelper.StringToBitmap(value.ToString());
                            }
                            else
                            {
                                cell.Value = null;
                            }
                        }
                        else if (cell.CellType is HyperLinkCellType)
                        {
                            if (value != null)
                            {
                                List <string>     lstLink  = new List <string>();
                                HyperLinkCellType hlnkCell = new HyperLinkCellType();
                                try
                                {
                                    lstLink       = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string> >(value.ToString());
                                    hlnkCell.Text = lstLink[0];
                                    hlnkCell.Link = lstLink[1];
                                }
                                catch
                                {
                                    hlnkCell.Text = value.ToString();
                                    hlnkCell.Link = "";
                                }

                                cell.CellType = hlnkCell;
                                //cell.Value = value;
                            }
                            else
                            {
                                HyperLinkCellType hlnkCell = new HyperLinkCellType();
                                cell.CellType = hlnkCell;
                            }
                        }
                        else
                        {
                            cell.Value = value;
                        }
                        #endregion
                        JZCellProperty p = cell.Tag as JZCellProperty;
                        #region 处理单元格属性
                        if (p != null)
                        {
                            cell.Locked = false;
                        }
                        else
                        {
                            //  logger.Error("未能设置数据区信息:单元格" + dataCellDefault.Name + ",表单:" + sheet.Name);
                        }
                        #endregion
                    }
                }
                #region 线路单元格样式
                DataTable dtCellStyle = ModuleHelperClient.GetCellStyleBySheetID(sheet.ID);
                for (int i = 0; i < dtCellStyle.Rows.Count; i++)
                {
                    if (dtCellStyle.Rows[i]["CellStyle"] != null)
                    {
                        JZCellStyle CurrentCellStyle = Newtonsoft.Json.JsonConvert.DeserializeObject <JZCellStyle>(dtCellStyle.Rows[i]["CellStyle"].ToString());
                        if (CurrentCellStyle != null)
                        {
                            string strCellName = dtCellStyle.Rows[i]["CellName"].ToString();
                            Cell   cell        = SheetView.Cells[strCellName];
                            cell.ForeColor = CurrentCellStyle.ForColor;
                            cell.BackColor = CurrentCellStyle.BackColor;
                            cell.Font      = new Font(CurrentCellStyle.FamilyName, CurrentCellStyle.FontSize, CurrentCellStyle.FontStyle);
                        }
                    }
                }
                #endregion
            }
            #endregion

            UpdateChart();
            UpdateEquation();

            //设置只读模式
            if (ReadOnly)
            {
                foreach (SheetView sheet in FpSpread.Sheets)
                {
                    sheet.OperationMode = OperationMode.ReadOnly;
                }
            }
        }
Esempio n. 8
0
        private FpSpread LoadSpread(FpSpread spread, Guid moduleID)
        {
            try
            {
                ProgressScreen.Current.ShowSplashScreen();
                ProgressScreen.Current.SetStatus = "正在打开模板...";
                //增加水印、图章
                //spread.Watermark = ModuleHelperClient.GetWatermarkByModuleID(moduleID);
                Dictionary <Guid, SheetView>            SheetCollection = new Dictionary <Guid, SheetView>();
                List <FarPoint.CalcEngine.FunctionInfo> Infos           = FunctionItemInfoUtil.getFunctionItemInfos();
                JZDocument           defaultDocument            = ModuleHelperClient.GetDefaultDocument(moduleID);
                List <JZFormulaData> CrossSheetLineFormulaInfos = ModuleHelperClient.GetLineFormulaByModuleIndex(moduleID);

                foreach (JZSheet sheet in defaultDocument.Sheets)
                {
                    ProgressScreen.Current.SetStatus = "正在初始化表单‘" + sheet.Name + "’";
                    String    sheetXML  = ModuleHelperClient.GetSheetXMLByID(sheet.ID);
                    SheetView SheetView = Serializer.LoadObjectXml(typeof(SheetView), sheetXML, "SheetView") as SheetView;
                    SheetView.Tag               = sheet.ID;
                    SheetView.SheetName         = sheet.Name;
                    SheetView.Cells[0, 0].Value = "";
                    SheetView.Protect           = true;
                    FpSpread.Sheets.Add(SheetView);

                    DataTable dtCellStyle = ModuleHelperClient.GetCellStyleBySheetID(sheet.ID);
                    for (int i = 0; i < dtCellStyle.Rows.Count; i++)
                    {
                        if (dtCellStyle.Rows[i]["CellStyle"] != null)
                        {
                            JZCellStyle CurrentCellStyle = Newtonsoft.Json.JsonConvert.DeserializeObject <JZCellStyle>(dtCellStyle.Rows[i]["CellStyle"].ToString());
                            if (CurrentCellStyle != null)
                            {
                                string strCellName = dtCellStyle.Rows[i]["CellName"].ToString();
                                Cell   cell        = SheetView.Cells[strCellName];
                                cell.ForeColor = CurrentCellStyle.ForColor;
                                cell.BackColor = CurrentCellStyle.BackColor;
                                cell.Font      = new Font(CurrentCellStyle.FamilyName, CurrentCellStyle.FontSize, CurrentCellStyle.FontStyle);
                            }
                        }
                    }

                    SheetCollection.Add(sheet.ID, SheetView);
                    foreach (FarPoint.CalcEngine.FunctionInfo Info in Infos)
                    {
                        SheetView.AddCustomFunction(Info);
                    }
                }
                ProgressScreen.Current.SetStatus = "正在初始化跨表公式...";
                spread.LoadFormulas(false);
                foreach (JZFormulaData formula in CrossSheetLineFormulaInfos)
                {
                    if (!SheetCollection.ContainsKey(formula.SheetIndex))
                    {
                        continue;
                    }
                    SheetView Sheet = SheetCollection[formula.SheetIndex];

                    Cell cell = Sheet.Cells[formula.RowIndex, formula.ColumnIndex];
                    if (cell != null)
                    {
                        try
                        {
                            if (formula.Formula.ToUpper().Trim() == "NA()")
                            {
                                cell.Formula = "";
                            }
                            else
                            {
                                cell.Formula = formula.Formula;
                            }
                        }
                        catch
                        {
                        }
                    }
                }

                spread.LoadFormulas(true);
                ProgressScreen.Current.SetStatus = "正在显示资料...";

                return(spread);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                try
                {
                    //this.RemoveOwnedForm(ProgressScreen.Current);
                    ProgressScreen.Current.CloseSplashScreen();
                }
                catch
                {
                }
            }

            return(null);
        }
Esempio n. 9
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            Dictionary <Guid, String> lineIDs   = new Dictionary <Guid, String>();
            List <String>             moduleIDs = new List <String>();
            string strModuleIDs = string.Empty;
            Dictionary <Guid, String> dModuleIDs = new Dictionary <Guid, String>();

            foreach (TreeNode node in treeLines.Nodes[0].Nodes)
            {
                if (node.Checked)
                {
                    lineIDs.Add(new Guid(node.Name), node.Text);
                }
            }

            foreach (TreeNode node in treeModule.Nodes[0].Nodes)
            {
                foreach (TreeNode n in node.Nodes)
                {
                    if (n.Checked)
                    {
                        moduleIDs.Add(n.Name);
                        strModuleIDs += string.Format("'{0}',", n.Name);
                        dModuleIDs.Add(new Guid(n.Name), n.Text);
                    }
                }
            }
            if (moduleIDs.Count == 0 || lineIDs.Count == 0)
            {
                MessageBox.Show("请至少选则一条线路或一个模板!");
                return;
            }
            strModuleIDs = strModuleIDs.Substring(0, strModuleIDs.Length - 1);

            string strFMsg = string.Empty;

            using (DataTable dtForbidLines = ModuleHelperClient.GetForbidLinesByModuleIDs(strModuleIDs, isModule ? 1 : 0))
            {
                foreach (KeyValuePair <Guid, string> pair in lineIDs)
                {
                    DataRow[] drModuleIDs = dtForbidLines.Select(string.Format("LineID='{0}'", pair.Key));
                    if (drModuleIDs != null && drModuleIDs.Length > 0)
                    {
                        bool bHasForbidModule = false;
                        for (int j = 0; j < drModuleIDs.Length; j++)
                        {
                            string strFModuleID = drModuleIDs[j]["ModuleID"].ToString();
                            foreach (string moduleID in moduleIDs)
                            {
                                if (strFModuleID == moduleID)
                                {//禁止发布
                                    bHasForbidModule = true;
                                    if (string.IsNullOrEmpty(strFMsg))
                                    {
                                        strFMsg = isModule ? "模板" : "表单";
                                    }
                                    strFMsg += string.Format("<{0}>", dModuleIDs[new Guid(moduleID)]);
                                }
                            }
                        }
                        if (bHasForbidModule)
                        {
                            strFMsg += string.Format("已经设置不能发布到线路【{0}】", pair.Value);
                            strFMsg += "\n";
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(strFMsg))
            {
                MessageBox.Show(strFMsg);
                return;
            }


            Boolean          flag   = true;
            String           msg    = "";
            BackgroundWorker worker = sender as BackgroundWorker;
            int i = 0;

            foreach (KeyValuePair <Guid, string> pair in lineIDs)
            {
                try
                {
                    i = i + 1;
                    ProgressScreen.Current.SetStatus = string.Format("正在发布线路:{0}...", pair.Value);
                    worker.ReportProgress((int)(((float)i / (float)lineIDs.Count) * 100));
                    Boolean subFlag = LineHelperClient.SyncLineAndModule(moduleIDs, new List <Guid>()
                    {
                        pair.Key
                    }, isModule, isRelationSheet);
                    flag = flag & subFlag;
                    if (!subFlag)
                    {
                        msg += "[" + pair.Value + "] ";
                    }
                }
                catch
                {
                    flag = false;
                }
            }

            String str = flag ? "全部更新成功" : "线路" + msg + "更新失败";

            MessageBox.Show(str);
        }