Example #1
0
 /// <summary>
 /// 单元格的值是否唯一,返回不唯一的模板名
 /// </summary>
 /// <param name="cell"></param>
 /// <param name="sheetID"></param>
 /// <param name="moduleID"></param>
 /// <returns></returns>
 public static DataTable IsUniqueAndReturnDT(JZCellProperty property, JZCell cell, Guid sheetID, Guid moduleID, String testRoomCode, Guid documentID)
 {
     return(Agent.CallService("Yqun.BO.BusinessManager.dll", "IsUniqueAndReturnDT", new object[] { property, cell, sheetID, moduleID, testRoomCode, documentID }) as DataTable);
 }
Example #2
0
        /// <summary>
        /// 保存表单样式
        /// </summary>
        private void SaveSheetStyle()
        {
            try
            {
                Sys_Sheet sheet = new Sys_Sheet();
                sheet.ID       = sheetID;
                sheet.Name     = SheetName;
                sheet.SheetXML = JZCommonHelper.GZipCompressString(Editor.GetActiveSheetXml());
                List <JZCell>        cells            = new List <JZCell>();
                List <CellLogic>     cellLogicList    = new List <CellLogic>();
                List <JZFormulaData> cellFormulasList = new List <JZFormulaData>();
                //bool bIsKeyDescEmpty = false;
                #region CellLogic
                foreach (Cell cell in dataCells)
                {
                    if (cell == null)
                    {
                        continue;
                    }

                    JZCell c = new JZCell();
                    c.Name  = cell.Column.Label + cell.Row.Label;
                    c.Value = cell.Value;
                    bool bHasExist = false;
                    foreach (JZCell cc in cells)
                    {
                        if (cc.Name == c.Name)
                        {
                            bHasExist = true;
                            break;
                        }
                    }
                    if (bHasExist == true)
                    {
                        continue;
                    }
                    cells.Add(c);

                    CellLogic cl = new CellLogic();
                    cl.Name = c.Name;
                    JZCellProperty p = cell.Tag as JZCellProperty;
                    if (p != null)
                    {
                        cl.Description = p.Description;
                        cl.IsKey       = p.IsKey;
                        cl.IsNotCopy   = p.IsNotCopy;
                        cl.IsNotNull   = p.IsNotNull;
                        cl.IsPingxing  = p.IsPingxing;
                        cl.IsReadOnly  = p.IsReadOnly;
                        cl.IsUnique    = p.IsUnique;
                        if (cl.IsKey == true && string.IsNullOrEmpty(cl.Description))
                        {
                            //bIsKeyDescEmpty = true;
                            MessageBox.Show(string.Format("单元格{0}的描述不能为空", c.Name));
                            return;
                        }
                    }
                    cellLogicList.Add(cl);
                }
                #endregion
                #region Formulas
                if (FpSpread.Sheets[0] != null)
                {
                    for (int j = 0; j < FpSpread.Sheets[0].ColumnCount; j++)
                    {
                        for (int m = 0; m < FpSpread.Sheets[0].RowCount; m++)
                        {
                            Cell          c  = FpSpread.Sheets[0].Cells[m, j];
                            JZFormulaData cl = new JZFormulaData();
                            if (c != null)
                            {
                                if (!string.IsNullOrEmpty(c.Formula))
                                {
                                    //logger.Error(string.Format("Name:{0} ColumnIndex:{1} RowIndex:{2} Formula:{3} ", ((char)('A' + c.Column.Index)).ToString() + (c.Row.Index + 1).ToString(), c.Column.Index, c.Row.Index, c.Formula));
                                    cl.ColumnIndex = c.Column.Index;
                                    cl.RowIndex    = c.Row.Index;
                                    cl.Formula     = c.Formula;
                                    cellFormulasList.Add(cl);
                                }
                            }
                        }
                    }
                }
                #endregion
                sheet.SheetData = Newtonsoft.Json.JsonConvert.SerializeObject(cells);
                sheet.CellLogic = JZCommonHelper.GZipCompressString(Newtonsoft.Json.JsonConvert.SerializeObject(cellLogicList));
                sheet.Formulas  = JZCommonHelper.GZipCompressString(Newtonsoft.Json.JsonConvert.SerializeObject(cellFormulasList));

                if (ModuleHelperClient.SaveSheet(sheet))
                {
                    MessageBox.Show("保存成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("保存失败。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败。" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #3
0
 /// <summary>
 /// 未保存单元格数据值,此单元格所在模板与表单
 /// </summary>
 /// <param name="cell"></param>
 /// <param name="sheetID"></param>
 /// <param name="moduleID"></param>
 /// <returns></returns>
 public static Boolean IsUnique(JZCellProperty property, JZCell cell, Guid sheetID, Guid moduleID, String testRoomCode, Guid documentID)
 {
     return(Convert.ToBoolean(Agent.CallService("Yqun.BO.BusinessManager.dll", "IsUnique", new object[] { property, cell, sheetID, moduleID, testRoomCode, documentID })));
 }