Exemple #1
0
        /// <summary>
        /// 获取单个附件
        /// </summary>
        /// <param name="itemId">关联编号</param>
        /// <param name="itemType">关联类型</param>
        /// <returns>附件实体</returns>
        public MComAttach GetModel(string itemId, EyouSoft.Model.EnumType.ComStructure.AttachItemType itemType)
        {
            MComAttach item = null;

            if (!string.IsNullOrEmpty(itemId))
            {
                item = dal.GetModel(itemId, itemType);
            }
            return(item);
        }
Exemple #2
0
        /// <summary>
        /// 删除附件并添加到待删除附件列表
        /// </summary>
        /// <param name="item">附件实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Delete(MComAttach item)
        {
            bool result = false;

            if (item != null)
            {
                result = dal.Delete(item);
            }
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 添加附件
        /// </summary>
        /// <param name="item">附件实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Add(MComAttach item)
        {
            bool result = false;

            if (item != null)
            {
                result = dal.Add(item);
            }
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 删除附件并添加到待删除附件列表
        /// </summary>
        /// <param name="item">附件实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Delete(MComAttach item)
        {
            DbCommand comm = this._db.GetStoredProcCommand("proc_ComAttach_Delete");

            this._db.AddInParameter(comm, "@ItemType", DbType.Byte, (int)item.ItemType);
            this._db.AddInParameter(comm, "@ItemId", DbType.AnsiStringFixedLength, item.ItemId);

            int reuslt = DbHelper.ExecuteSql(comm, this._db);

            return(reuslt > 0 ? true : false);
        }
Exemple #5
0
        private void NewGetAttach(MGovFile Model)
        {
            //之前上传的照片
            string stroldphoto = Utils.GetFormValue("hideFileInfo_photo");

            if (!string.IsNullOrEmpty(stroldphoto))
            {
                Model.StaffPhoto = stroldphoto;
            }
            //新上传的照片
            string[] photo = Utils.GetFormValue(this.SingleFileUpload2.ClientHideID).Split('|');
            if (photo != null && photo.Length > 1)
            {
                Model.StaffPhoto = photo[1];
            }
            //之前上传的附件
            string             stroldupload = Utils.GetFormValue("hideFileInfo");
            IList <MComAttach> lst          = new List <MComAttach>();

            if (!string.IsNullOrEmpty(stroldupload))
            {
                string[] oldupload = stroldupload.Split(',');
                if (oldupload != null && oldupload.Length > 0)
                {
                    for (int i = 0; i < oldupload.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(oldupload[i]))
                        {
                            string[]   uploaditem = oldupload[i].Split('|');
                            MComAttach attModel   = new MComAttach();
                            attModel.Name     = uploaditem[0];
                            attModel.FilePath = uploaditem[1];
                            lst.Add(attModel);
                        }
                    }
                }
            }
            //新上传附件
            string[] upload = Utils.GetFormValues(this.SingleFileUpload1.ClientHideID);
            for (int i = 0; i < upload.Length; i++)
            {
                string[] newupload = upload[i].Split('|');
                if (newupload != null && newupload.Length > 1)
                {
                    MComAttach attModel = new MComAttach();
                    attModel.FilePath = newupload[1];
                    attModel.Name     = newupload[0];
                    lst.Add(attModel);
                }
            }
            Model.ComAttachList = lst;
        }
Exemple #6
0
        /// <summary>
        /// 添加附件
        /// </summary>
        /// <param name="item">附件实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Add(MComAttach item)
        {
            string    sql  = "INSERT INTO tbl_ComAttach(ItemType,ItemId,[Name],FilePath,Size) VALUES(@ItemType,@ItemId,@Name,@FilePath,@Size)";
            DbCommand comm = this._db.GetSqlStringCommand(sql);

            this._db.AddInParameter(comm, "@ItemType", DbType.Byte, (int)item.ItemType);
            this._db.AddInParameter(comm, "@ItemId", DbType.AnsiStringFixedLength, item.ItemId);
            this._db.AddInParameter(comm, "@Name", DbType.String, item.Name);
            this._db.AddInParameter(comm, "@FilePath", DbType.String, item.FilePath);
            this._db.AddInParameter(comm, "@Size", DbType.Int32, item.Size);

            int reuslt = DbHelper.ExecuteSql(comm, this._db);

            return(reuslt > 0 ? true : false);
        }
Exemple #7
0
        private IList <MComAttach> NewGetAttach()
        {
            //之前上传的附件
            string             stroldupload = Utils.GetFormValue("hideFileInfo");
            IList <MComAttach> lst          = new List <MComAttach>();

            if (!string.IsNullOrEmpty(stroldupload))
            {
                string[] oldupload = stroldupload.Split(',');
                if (oldupload != null && oldupload.Length > 0)
                {
                    for (int i = 0; i < oldupload.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(oldupload[i]))
                        {
                            string[]   uploaditem = oldupload[i].Split('|');
                            MComAttach attModel   = new MComAttach();
                            attModel.Name     = uploaditem[0];
                            attModel.FilePath = uploaditem[1];
                            lst.Add(attModel);
                        }
                    }
                }
            }
            //新上传附件
            string[] upload = Utils.GetFormValues(this.SingleFileUpload1.ClientHideID);
            for (int i = 0; i < upload.Length; i++)
            {
                string[] newupload = upload[i].Split('|');
                if (newupload != null && newupload.Length > 1)
                {
                    MComAttach attModel = new MComAttach();
                    attModel.FilePath = newupload[1];
                    attModel.Name     = newupload[0];
                    lst.Add(attModel);
                }
            }
            return(lst);
        }
Exemple #8
0
        private IList <MComAttach> NewGetAttach()
        {
            //之前上传的培训通知 noticename|path|download,noticename|path|download
            IList <MComAttach> lst        = new List <MComAttach>();
            string             hideNotice = Utils.GetFormValue("hideNotice");

            if (!string.IsNullOrEmpty(hideNotice))
            {
                string[] arrNotice = hideNotice.Split(',');
                if (arrNotice.Length > 0 && arrNotice != null)
                {
                    for (int i = 0; i < arrNotice.Length; i++)
                    {
                        MComAttach model = new MComAttach();
                        if (!string.IsNullOrEmpty(arrNotice[i]))
                        {
                            string[] arry = arrNotice[i].Split('|');
                            if (arry.Length > 1)
                            {
                                model.Name     = arry[0].Insert(0, "TZ_");
                                model.FilePath = arry[1];
                                lst.Add(model);
                            }
                        }
                    }
                }
            }
            //新上传的培训通知
            string[] upNotice = Utils.GetFormValues(this.SingleFileUpload1.ClientHideID);
            for (int i = 0; i < upNotice.Length; i++)
            {
                string[] notice = upNotice[i].Split('|');
                if (notice != null && notice.Length > 1)
                {
                    MComAttach model = new MComAttach();
                    model.Name     = notice[0].Insert(0, "TZ_");
                    model.FilePath = notice[1];
                    lst.Add(model);
                }
            }
            //之前上传的培训记录
            string hideRemark = Utils.GetFormValue("hideRemark");

            if (!string.IsNullOrEmpty(hideRemark))
            {
                string[] arrRemark = hideRemark.Split(',');
                if (arrRemark.Length > 0 && arrRemark != null)
                {
                    for (int i = 0; i < arrRemark.Length; i++)
                    {
                        MComAttach model = new MComAttach();
                        if (!string.IsNullOrEmpty(arrRemark[i]))
                        {
                            string[] arry = arrRemark[i].Split('|');
                            if (arry.Length > 1)
                            {
                                model.Name     = arry[0].Insert(0, "JL_");
                                model.FilePath = arry[1];
                                lst.Add(model);
                            }
                        }
                    }
                }
            }
            //新上传的培训记录
            string[] upRemark = Utils.GetFormValues(this.SingleFileUpload2.ClientHideID);
            for (int i = 0; i < upRemark.Length; i++)
            {
                string[] remark = upRemark[i].Split('|');
                if (remark != null && remark.Length > 1)
                {
                    MComAttach model = new MComAttach();
                    model.Name     = remark[0].Insert(0, "JL_");
                    model.FilePath = remark[1];
                    lst.Add(model);
                }
            }
            //之前上传的培训附件
            string hideFile = Utils.GetFormValue("hideFile");

            if (!string.IsNullOrEmpty(hideFile))
            {
                string[] arrFile = hideFile.Split(',');
                if (arrFile.Length > 0 && arrFile != null)
                {
                    for (int i = 0; i < arrFile.Length; i++)
                    {
                        MComAttach model = new MComAttach();
                        if (!string.IsNullOrEmpty(arrFile[i]))
                        {
                            string[] arry = arrFile[i].Split('|');
                            if (arry.Length > 1)
                            {
                                model.Name     = arry[0].Insert(0, "FJ_");
                                model.FilePath = arry[1];
                                lst.Add(model);
                            }
                        }
                    }
                }
            }
            //新上传的附件
            string[] upFile = Utils.GetFormValues(this.SingleFileUpload3.ClientHideID);
            for (int i = 0; i < upFile.Length; i++)
            {
                string[] file = upFile[i].Split('|');
                if (file != null && file.Length > 1)
                {
                    MComAttach model = new MComAttach();
                    model.Name     = file[0].Insert(0, "FJ_");
                    model.FilePath = file[1];
                    lst.Add(model);
                }
            }
            return(lst);
        }