예제 #1
0
        /// <summary>
        /// 获取功能模块确定的GridScheme
        /// </summary>
        /// <param name="handle"></param>
        /// <param name="entryParam"></param>
        /// <returns></returns>
        public override LibGridScheme GetDefinedGridScheme(LibHandle handle, LibEntryParam entryParam)
        {
            LibGridScheme gridScheme = null;
            StringBuilder builder    = new StringBuilder();

            if (entryParam != null)
            {
                foreach (var item in entryParam.ParamStore)
                {
                    builder.AppendFormat("{0}", item.Value);
                }
            }
            string           schemeName    = string.Format("{0}{1}List.bin", "dm.Directory", builder.ToString());
            LibDisplayScheme displayScheme = null;
            string           path          = Path.Combine(EnvProvider.Default.MainPath, "Scheme", "ShowScheme", schemeName);

            if (File.Exists(path))
            {
                LibBinaryFormatter formatter = new LibBinaryFormatter();
                using (FileStream fs = new FileStream(path, FileMode.Open))
                {
                    displayScheme = (LibDisplayScheme)formatter.Deserialize(fs);
                }
            }
            if (displayScheme != null)
            {
                gridScheme = displayScheme.GridScheme[0];
            }
            return(gridScheme);
        }
예제 #2
0
        /// <summary>
        /// 直接创建目录
        /// </summary>
        /// <param name="dirId"></param>
        /// <param name="dirName"></param>
        /// <returns></returns>
        protected bool AddDirDirectly(ref string dirId, string dirName, DirTypeEnum dirType, string parentDirId)
        {
            if (string.IsNullOrEmpty(dirName))
            {
                return(false);
            }
            if (parentDirId == null)
            {
                parentDirId = string.Empty;
            }

            Dictionary <string, LibChangeRecord> dicChanges       = new Dictionary <string, LibChangeRecord>();
            Dictionary <string, object>          dicChangeColumns = new Dictionary <string, object>();

            LibEntryParam entryParam = new LibEntryParam();

            entryParam.ParamStore.Add("ParentDirId", parentDirId);
            entryParam.ParamStore.Add("ParentDirType", (int)dirType);

            this.DataSet.Clear();

            this.AddNew(entryParam);
            if (this.ManagerMessage.IsThrow)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(dirId))
            {
                dirId = LibSysUtils.ToString(this.DataSet.Tables[0].Rows[0]["DIRID"]);
            }

            object[] pks = new object[] { dirId };
            //因对于Add的对象Save方法中会检查Add的第一条记录数据并做相关处理,因此需要模拟生成前端传递来的change数据
            LibChangeRecord record = new LibChangeRecord();

            foreach (DataColumn col in this.DataSet.Tables[0].Columns)
            {
                dicChangeColumns.Add(col.ColumnName, this.DataSet.Tables[0].Rows[0][col.ColumnName]);//将文档主表的第一行数据变成change数据
            }
            dicChangeColumns["DIRID"]       = dirId;
            dicChangeColumns["DIRNAME"]     = dirName;
            dicChangeColumns["DIRTYPE"]     = (dirType == DirTypeEnum.Public) ? 0 : 1;
            dicChangeColumns["PARENTDIRID"] = parentDirId;

            record.Add.Add(dicChangeColumns);
            dicChanges.Add("DMDIRECTORY", record);

            this.DataSet.Clear();//将通过addNew添加的数据全清空,以免和通过change数据添加的重复了。

            this.Save(BillAction.AddNew, pks, dicChanges, null);
            if (this.ManagerMessage.IsThrow)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #3
0
        public static Result ExceptionTrack(string personId, string BillNo, DateTime PlanEndTime, string Solution, int DealwithState, string userId)
        {
            Result        res      = new Result();
            LibBcfData    bcfData  = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("com.AbnormalTrace");
            LibEntryParam param    = new LibEntryParam();
            DataSet       dataSet  = bcfData.AddNew(param);
            DataTable     masterDt = dataSet.Tables[0];

            masterDt.BeginLoadData();
            DataRow masterRow = masterDt.Rows[0];

            try
            {
                masterRow.BeginEdit();
                try
                {
                    masterRow["TYPEID"]           = "P001";
                    masterRow["FROMBILLNO"]       = BillNo;
                    masterRow["PLANENDTIME"]      = LibDateUtils.DateTimeToLibDateTime(PlanEndTime);
                    masterRow["SOLUTION"]         = Solution;
                    masterRow["DEALWITHSTATE"]    = DealwithState;
                    masterRow["DEALWITHPERSONID"] = personId;
                }
                catch
                {
                    throw;
                }
                finally
                {
                    masterRow.EndEdit();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                masterDt.EndLoadData();
            }
            bcfData.InnerSave(BillAction.AddNew, null, dataSet);
            if (bcfData.ManagerMessage.IsThrow)
            {
                res.Message     = "数据有误";
                res.ReturnValue = false;
            }
            else
            {
                res.ReturnValue = true;
                //Service.PushMessage(userId, PushType.Message);
            }
            return(res);
        }
예제 #4
0
        protected override bool CheckAddNew(LibEntryParam entryParam)
        {
            //使用入口参数传递检查权限需要的参数
            string parentDirId   = "";
            int    parentDirType = -1;

            if (entryParam != null && entryParam.ParamStore.Count >= 2 &&
                entryParam.ParamStore.ContainsKey("ParentDirId") &&
                entryParam.ParamStore.ContainsKey("ParentDirType"))
            {
                parentDirId = entryParam.ParamStore["ParentDirId"].ToString();
                int.TryParse(entryParam.ParamStore["ParentDirType"].ToString(), out parentDirType);
                //用完后置空
                entryParam.ParamStore.Remove("ParentDirId");
                entryParam.ParamStore.Remove("ParentDirType");
            }
            else
            {
                this.ManagerMessage.AddMessage(LibMessageKind.Error, "缺少检查权限需要的参数。");
                return(false);
            }

            if (parentDirType == (int)DirTypeEnum.Private || parentDirType == (int)DirTypeEnum.PrivateRoot)
            {
                return(true);//个人目录不做控制
            }
            if (parentDirType == (int)DirTypeEnum.PublicRoot)
            {
                if (this.Handle.UserId.Equals("admin") == false)
                {
                    this.ManagerMessage.AddMessage(LibMessageKind.Error, "公共文档根目录下只能由超级管理员才能新增目录。");
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            return(CheckPermission(parentDirId, DMFuncPermissionEnum.Add));
        }
예제 #5
0
        // 视图模型
        public virtual LibViewTemplate GetViewTemplate(LibEntryParam entryParam = null)
        {
            if (entryParam != null)
            {
                this.DataSet.ExtendedProperties.Add("entryParam", entryParam);
            }
            LibViewTemplate template = this.Template.GetViewTemplate(this.DataSet);

            template.ProgId      = this.Template.ProgId;
            template.DisplayText = this.Template.DisplayText;
            template.BillType    = this.Template.BillType;
            StringBuilder builder = new StringBuilder();

            if (entryParam != null)
            {
                foreach (var item in entryParam.ParamStore)
                {
                    builder.AppendFormat("{0}", item.Value);
                }
            }
            template.Layout.SchemeName = Path.Combine(this.Handle.UserId, string.Format("{0}{1}.bin", this.ProgId, builder.ToString()));
            return(template);
        }
예제 #6
0
        /// <summary>
        /// 对主表的列表数据增加处理
        /// 设置获取目录下的文档简要信息、目录/文档的的“目录链接”虚字段等
        /// </summary>
        /// <param name="dataTable"></param>
        public override void AfterFillList(LibHandle libHandle, DataTable table, object listingQuery, LibEntryParam entryParam)
        {
            base.AfterFillList(libHandle, table, listingQuery, entryParam);
            if (libHandle == null || table == null || listingQuery == null)
            {
                return;
            }

            BillListingQuery queryinfo = listingQuery as BillListingQuery;

            if (queryinfo == null || queryinfo.Condition == null ||
                queryinfo.Condition.QueryFields == null ||
                queryinfo.Condition.QueryFields.Count == 0)
            {
                return;
            }
            string belongDirID = "";

            //查询获得父目录编码
            belongDirID = (from item in queryinfo.Condition.QueryFields
                           where item.Name.Equals("PARENTDIRID") && item.QueryChar.Equals(LibQueryChar.Equal) &&
                           item.Value.Count == 1
                           select item.Value[0]).FirstOrDefault().ToString();

            int dirType = 0;

            if (int.TryParse((from item in queryinfo.Condition.QueryFields
                              where item.Name.Equals("DIRTYPE") && item.QueryChar.Equals(LibQueryChar.Equal) &&
                              item.Value.Count == 1
                              select item.Value[0]).FirstOrDefault().ToString(), out dirType) == false)
            {
                return;
            }

            DataTable dtDir = table;

            #region 公共目录则还需要再根据权限筛选一次
            if (libHandle.UserId != "admin" && dirType == (int)DirTypeEnum.Public)
            {
                //公共目录则还需要再根据权限筛选一次
                List <string> dirIdList = new List <string>();
                foreach (DataRow row in dtDir.Rows)
                {
                    dirIdList.Add(LibSysUtils.ToString(row["DIRID"]));
                }
                dirIdList = DMPermissionControl.Default.FilterDirIds(libHandle, DMFuncPermissionEnum.Browse, dirIdList);//筛选具有浏览权限的目录标识号
                List <DataRow> toDeleteList = new List <DataRow>();
                foreach (DataRow row in dtDir.Rows)
                {
                    if (dirIdList.Contains(LibSysUtils.ToString(row["DIRID"])) == false)
                    {
                        toDeleteList.Add(row);
                    }
                }
                foreach (DataRow row in toDeleteList)
                {
                    dtDir.Rows.Remove(row);
                }
                dtDir.AcceptChanges();
            }
            #endregion


            string dirLinkAddress = "";
            if (belongDirID.Equals(""))
            {
                dirLinkAddress = "";//如果父目录编码为空则目录链接的路径也为空
            }
            else
            {
                DirLinkAddress dirLink = new DirLinkAddress(belongDirID, this.DataAccess);
                dirLinkAddress = dirLink.DirNameLink;//获取目录链接虚字段
            }

            foreach (DataRow row in dtDir.Rows)
            {
                //设置目录数据行的信息
                row["ISDIR"]          = true;
                row["DOCTYPE"]        = "目录";
                row["DIRLINKADDRESS"] = dirLinkAddress;//设置目录的目录链接虚字段

                row["DOCNAME"] = row["DIRNAME"];
            }

            //获取目录下的文档数据行并设置简要信息虚字段
            #region 获取目录下的文档数据行并设置简要信息虚字段
            DmDocumentBcf docBcf = new DmDocumentBcf();
            DataTable     dtDoc  = docBcf.GetDocOfDir(libHandle, belongDirID, (DirTypeEnum)dirType);
            if (dtDoc != null && dtDoc.Rows.Count > 0)
            {
                DataRow newRow = null;
                foreach (DataRow rowDoc in dtDoc.Rows)
                {
                    newRow                   = dtDir.NewRow();
                    newRow["DIRID"]          = Guid.NewGuid().ToString().Substring(0, 20);//设置一个不重复的值作为编号
                    newRow["DIRNAME"]        = "无意义";
                    newRow["DOCCOUNT"]       = 0;
                    newRow["PARENTDIRID"]    = rowDoc["DIRID"];
                    newRow["DIRTYPE"]        = 0;
                    rowDoc["DIRLINKADDRESS"] = dirLinkAddress; //设置目录的目录链接虚字段
                    newRow["SORTORDER"]      = int.MaxValue;   //实现文档在目录的下面

                    //文档虚字段
                    newRow["DOCID"]     = rowDoc["DOCID"];
                    newRow["DOCNAME"]   = rowDoc["DOCNAME"];
                    newRow["ISDIR"]     = false;
                    newRow["DOCTYPE"]   = rowDoc["DOCTYPE"];
                    newRow["LOCKSTATE"] = rowDoc["LOCKSTATE"];
                    newRow["DOCSIZE"]   = rowDoc["DOCSIZE"];
                    newRow["SAVEPATH"]  = rowDoc["SAVEPATH"];

                    newRow["LASTUPDATETIME"] = rowDoc["LASTUPDATETIME"];
                    newRow["CREATORNAME"]    = rowDoc["CREATORNAME"];

                    newRow["SORTORDER"] = rowDoc["SORTORDER"];

                    dtDir.Rows.Add(newRow);
                }
            }
            #endregion

            //对目录按照SortOrder从小到大排序 ,文档目录在上
            #region 对目录按照SortOrder从小到大排序 ,文档目录在上
            table.DefaultView.Sort = "ISDIR desc,SORTORDER asc";
            DataTable copyTable = table.DefaultView.ToTable();
            table.Rows.Clear();
            for (int i = 0; i < copyTable.Rows.Count; i++)
            {
                table.Rows.Add(copyTable.Rows[i].ItemArray);
            }
            #endregion

            if (table.DataSet != null)
            {
                table.DataSet.AcceptChanges();
            }
        }
예제 #7
0
        /// <summary>
        /// 根据权限设置返回不同的视图模板
        /// </summary>
        /// <param name="checkDirType"></param>
        /// <param name="checkDirId"></param>
        /// <param name="entryParam"></param>
        /// <returns></returns>
        public LibViewTemplate GetViewTemplateOfPermission(int checkDirType, string checkDirId, LibEntryParam entryParam = null)
        {
            LibBillTpl tpl = (LibBillTpl)base.GetViewTemplate(entryParam);
            bool       isRemoveManageView = true;

            if (checkDirType == (int)DirTypeEnum.Private || checkDirType == (int)DirTypeEnum.PrivateRoot)
            {
                isRemoveManageView = false;
            }
            else
            {
                if (DMPermissionControl.Default.HasPermission(this.Handle, checkDirId, string.Empty, DMFuncPermissionEnum.Manage))
                {
                    isRemoveManageView = false;
                }
            }
            if (isRemoveManageView)
            {
                //移除目录权限面板
                LibBillLayout layout = tpl.Layout as LibBillLayout;
                layout.TabRange.RemoveAt(0); //目录权限
                layout.SubBill.Remove(2);    //目录操作细项
            }
            return(tpl);
        }
예제 #8
0
        public override void BeforeFillList(LibHandle libHandle, DataTable table, object listingQuery, LibEntryParam entryParam)
        {
            base.BeforeFillList(libHandle, table, listingQuery, entryParam);
            if (libHandle == null || table == null || listingQuery == null)
            {
                return;
            }
            BillListingQuery queryinfo = listingQuery as BillListingQuery;

            if (queryinfo == null)
            {
                return;
            }
            int dirType = 0;

            if (int.TryParse((from item in queryinfo.Condition.QueryFields
                              where item.Name.Equals("DIRTYPE") && item.QueryChar.Equals(LibQueryChar.Equal) &&
                              item.Value.Count == 1
                              select item.Value[0]).FirstOrDefault().ToString(), out dirType) == false)
            {
                return;
            }
            if (dirType == (int)DirTypeEnum.Private)
            {
                //私有目录,根据创建人进行标识
                AxCRL.Core.Comm.LibQueryField libQueryField = new AxCRL.Core.Comm.LibQueryField();
                libQueryField.Name      = "CREATORID";
                libQueryField.QueryChar = LibQueryChar.Equal;
                libQueryField.Value.Add(libHandle.PersonId);
                queryinfo.Condition.QueryFields.Add(libQueryField);
            }
            //公共目录,在Fill后在根据目录权限设置
        }
예제 #9
0
        public UpLoadFileResult UpLoadFile1(HttpPostedFile file, string progId = "")
        {
            UpLoadFileResult upLoadFileResult = new UpLoadFileResult();

            bool isLocalHost = true;

            string fileName = LibDateUtils.Now().Ticks.ToString();

            fileName = file.FileName.Replace(file.FileName.Substring(0, file.FileName.LastIndexOf('.')), fileName);
            string filePath = Path.Combine(EnvProvider.Default.RuningPath, "TempData", "ImportData", fileName);
            string url      = Path.Combine("\\TempData", "ImportData", fileName);

            #region 对应实体图片路径
            if (!string.IsNullOrEmpty(progId))
            {
                string  sql     = string.Format(" SELECT Url,LocalHost FROM ComImagePath WHERE Progid='{0}' ", progId);
                DataSet dataSet = new LibDataAccess().ExecuteDataSet(sql);
                if (dataSet != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = dataSet.Tables[0].Rows[0];
                    isLocalHost = LibSysUtils.ToBoolean(dr["LocalHost"]);
                    url         = LibSysUtils.Combine(LibSysUtils.ToString(dr["Url"]), fileName);
                    filePath    = LibSysUtils.Combine(EnvProvider.Default.RuningPath, url);
                }
            }
            #endregion

            #region 新增图片实体
            LibEntryParam entryParam = new LibEntryParam();

            DataSet    dataset = null;
            LibBcfData bcfData = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("KanTime.Picture");
            dataset = bcfData.AddNew(entryParam);

            #region 填充数据
            dataset.EnforceConstraints = false;
            try
            {
                #region  表头
                DataRow masterRow = dataset.Tables[0].Rows[0];
                masterRow.BeginEdit();
                masterRow["Name"] = fileName;
                masterRow["Url"]  = url;
                masterRow.EndEdit();
                #endregion

                #region 明细
                //dataset.Tables[1].BeginLoadData();
                //dataset.Tables[1].EndLoadData();
                #endregion
            }
            finally
            {
                dataset.EnforceConstraints = true;
            }
            dataset = bcfData.InnerSave(BillAction.AddNew, null, dataset);
            if (bcfData.ManagerMessage.IsThrow)
            {
                StringBuilder strMsg = new StringBuilder();
                foreach (var item in bcfData.ManagerMessage.MessageList)
                {
                    strMsg.AppendFormat("{0}", item.Message);
                }
                throw new Exception(strMsg.ToString());
            }
            #endregion

            #endregion

            file.SaveAs(filePath);

            #region 返回本机或外网地址
            if (isLocalHost)
            {
                upLoadFileResult.FileName = url;
            }
            else
            {
                upLoadFileResult.FileName = LibSysUtils.Combine(EnvProvider.Default.UploadHostName, url);
            }
            #endregion

            upLoadFileResult.success = true;
            return(upLoadFileResult);
        }