public DisplayObject_MCE_B_ASSETS_ROLLFILE Get(DisplayObject_MCE_B_ASSETS_ROLLFILE obj)
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_ROLLFILE.Get(obj));
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_ROLLFILE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLLFILE>(ServiceUri))
         {
             return(smgr.Service.Get(obj));
         }
     }
 }
        public EntityObject_MCE_B_ASSETS_ROLLFILE Load(IDbTransaction transaction, string id, out EntityObject_MCE_B_ASSETS_ROLL base_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_ROLLFILE obj = new EntityObject_MCE_B_ASSETS_ROLLFILE();

                //平台自动生成代码
                base_id = new EntityObject_MCE_B_ASSETS_ROLL();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_ROLLFILE.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.BASE_ID))
                {
                    base_id.ID = obj.BASE_ID;
                    base_id    = HelperObject_MCE_B_ASSETS_ROLL.Get(base_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
Ejemplo n.º 3
0
        public BizLogicMsg Delete_RollFiles(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            if (listID != null && listID.Count > 0)
                            {
                                foreach (string strID in listID)
                                {
                                    if (string.IsNullOrEmpty(strID))
                                    {
                                        continue;
                                    }
                                    EntityObject_MCE_B_ASSETS_ROLLFILE obj = new EntityObject_MCE_B_ASSETS_ROLLFILE();
                                    obj.ID = strID;

                                    obj = HelperObject_MCE_B_ASSETS_ROLLFILE.Get(obj);

                                    if (obj != null)
                                    {
                                        EntityObject_MCE_B_ASSETS_ROLL objRoll = new EntityObject_MCE_B_ASSETS_ROLL();

                                        objRoll.ID = obj.BASE_ID;

                                        objRoll = HelperObject_MCE_B_ASSETS_ROLL.Get(objRoll);

                                        if (objRoll == null)
                                        {
                                            throw new Exception("获取数据出错.");
                                        }

                                        if (objRoll.AUDIT_STATE == 3 || objRoll.AUDIT_STATE == 4)
                                        {
                                            throw new Exception("已经审核的案卷信息文件不能删除.");
                                        }

                                        CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                        pCOM_FILE.REF_TAB_ID   = obj.ID;
                                        pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_ROLLFILE";

                                        DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE);

                                        if (listCOM_FILE != null && listCOM_FILE.Length > 0)
                                        {
                                            foreach (DisplayObject_COM_FILE item in listCOM_FILE)
                                            {
                                                if (!string.IsNullOrEmpty(item.SERVER_NAME))
                                                {
                                                    string strFileURL = System.Web.HttpContext.Current.Server.MapPath("~/upload/mce/" + item.SERVER_NAME);//路径
                                                    if (File.Exists(strFileURL))
                                                    {
                                                        File.Delete(strFileURL);
                                                    }
                                                }
                                            }
                                        }
                                        HelperObject_COM_FILE.Delete(pCOM_FILE, transaction);

                                        HelperObject_MCE_B_ASSETS_ROLLFILE.Delete(obj, transaction);
                                    }
                                }
                            }
                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri))
                {
                    return(smgr.Service.Delete_RollFiles(listID));
                }
            }
        }
Ejemplo n.º 4
0
        public BizLogicMsg Save_RollFiles(List <JsonMceAssetsRollFile> listItem)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            if (listItem != null && listItem.Count > 0)
                            {
                                EntityObject_MCE_B_ASSETS_ROLL objRoll = new EntityObject_MCE_B_ASSETS_ROLL();

                                objRoll.ID = listItem[0].base_id;

                                objRoll = HelperObject_MCE_B_ASSETS_ROLL.Get(objRoll);

                                if (objRoll == null)
                                {
                                    throw new Exception("获取数据出错.");
                                }

                                if (objRoll.AUDIT_STATE == 3 || objRoll.AUDIT_STATE == 4)
                                {
                                    throw new Exception("已经审核的案卷信息文件不能保存.");
                                }

                                foreach (JsonMceAssetsRollFile item in listItem)
                                {
                                    EntityObject_MCE_B_ASSETS_ROLLFILE obj = new EntityObject_MCE_B_ASSETS_ROLLFILE();

                                    if (!string.IsNullOrEmpty(item.id))
                                    {
                                        obj.ID = item.id;

                                        obj = HelperObject_MCE_B_ASSETS_ROLLFILE.Get(obj);

                                        if (obj == null)
                                        {
                                            throw new Exception("获取数据出错.");
                                        }
                                    }

                                    obj.BASE_ID = item.base_id;
                                    obj.CODE    = item.code;
                                    obj.NAME    = item.name;

                                    if (!string.IsNullOrEmpty(item.create_date))
                                    {
                                        obj.CREATE_DATE = DateTime.Parse(item.create_date);
                                    }

                                    if (!string.IsNullOrEmpty(item.page_num))
                                    {
                                        obj.PAGE_NUM = decimal.Parse(item.page_num);
                                    }

                                    obj.SUMMARYS = item.summarys;

                                    obj.COMMENTS = item.comments;

                                    if (string.IsNullOrEmpty(item.id))
                                    {
                                        HelperObject_MCE_B_ASSETS_ROLLFILE.Save(obj, transaction);
                                    }
                                    else
                                    {
                                        obj.ID = item.id;
                                        HelperObject_MCE_B_ASSETS_ROLLFILE.Update(obj, transaction);
                                    }

                                    if (!string.IsNullOrEmpty(item.filename))
                                    {
                                        try
                                        {
                                            string strFileURL = System.Web.HttpContext.Current.Server.MapPath("~/upload/mce/" + item.filename);//路径
                                            if (File.Exists(strFileURL))
                                            {
                                                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                                pCOM_FILE.REF_TAB_ID   = obj.ID;
                                                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_ROLLFILE";
                                                pCOM_FILE.SERVER_NAME  = item.filename;
                                                DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE);

                                                if (listCOM_FILE == null || listCOM_FILE.Length == 0)
                                                {
                                                    Ipedf.Web.Entity.EntityObject_COM_FILE entityPicFile = new Ipedf.Web.Entity.EntityObject_COM_FILE();
                                                    entityPicFile.REF_TAB_NAME   = "MCE_B_ASSETS_ROLLFILE";
                                                    entityPicFile.CLIENT_NAME    = item.filename;
                                                    entityPicFile.STATE          = 1;
                                                    entityPicFile.CREATE_TIME    = DateTime.Now;
                                                    entityPicFile.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                                    entityPicFile.REF_TAB_ID     = obj.ID;
                                                    entityPicFile.SERVER_NAME    = item.filename;
                                                    entityPicFile.IS_IMPORT      = 0;
                                                    Ipedf.Web.DataAccess.HelperObject_COM_FILE.Save(entityPicFile, transaction);
                                                }
                                            }
                                        }
                                        catch { }
                                    }
                                }
                            }
                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri))
                {
                    return(smgr.Service.Save_RollFiles(listItem));
                }
            }
        }