示例#1
0
        /// <summary>
        /// 获取所有展示图片
        /// </summary>
        /// <param name="context"></param>
        public void GetFullResourceData(HttpContext context)
        {
            JObject returnobj = new JObject();
            JArray  jarray    = new JArray();

            try
            {
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    List <ResourceData> ResourceDataList = db.ResourceData.Where(t => t.IsDel != true && t.IsCarousel == true).OrderBy(t => t.CreateDate).ToList();
                    List <ResourcePath> ResourcePathList = db.ResourcePath.ToList();
                    JArray DataArray = new JArray();
                    foreach (ResourceData ResourceData in ResourceDataList)
                    {
                        JObject jobject = new JObject();
                        jobject.Add("Name", ResourceData.Name);
                        jobject.Add("ID", ResourceData.ID);
                        jobject.Add("ResourcePathID", ResourceData.ResourcePathID);
                        jobject.Add("CreateDate", ResourceData.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                        jobject.Add("Path", ResourceDAO.GetPath(ResourceData, ResourcePathList) + "/" + ResourceData.Name);
                        DataArray.Add(jobject);
                    }

                    returnobj.Add("ResourceData", DataArray);
                    returnobj.Add("result", "success");
                }
            }
            catch
            {
                returnobj.Add("result", "failed");
            }
            context.Response.Clear();
            context.Response.Write(returnobj);
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
示例#2
0
        private void DataBindList()
        {
            string Name = ViewState["Name"].ToString();


            using (IFMPDBContext db = new IFMPDBContext())
            {
                List <ResourceFull> returnobj            = new List <ResourceFull>();
                List <ResourcePath> FullResourcePathList = db.ResourcePath.ToList();
                List <ResourcePath> ResourcePathList     = FullResourcePathList.Where(t => t.ParentID == ResourcePathID && t.IsDel != true).ToList();

                if (ResourcePathID != 0)
                {
                    ResourceFull ResourceFull = new ResourceManage.ResourceFull();
                    ResourceFull.ID   = FullResourcePathList.FirstOrDefault(t => t.ID == ResourcePathID).ParentID;
                    ResourceFull.Name = "返回";
                    //是按这个排序的,所以z开头
                    ResourceFull.Type       = "最后";
                    ResourceFull.Path       = "";
                    ResourceFull.IsCarousel = "";
                    returnobj.Add(ResourceFull);
                }

                foreach (ResourcePath ResourcePath in ResourcePathList)
                {
                    ResourceFull ResourceFull = new ResourceManage.ResourceFull();
                    ResourceFull.ID         = ResourcePath.ID;
                    ResourceFull.Name       = ResourcePath.Name;
                    ResourceFull.Type       = "文件夹";
                    ResourceFull.Path       = "";
                    ResourceFull.IsCarousel = "";
                    returnobj.Add(ResourceFull);
                }

                List <ResourceData> ResourceDataList = db.ResourceData.Where(t => t.ResourcePathID == ResourcePathID && t.IsDel != true).ToList();
                foreach (ResourceData ResourceData in ResourceDataList)
                {
                    ResourceFull ResourceFull = new ResourceManage.ResourceFull();
                    ResourceFull.ID         = ResourceData.ID;
                    ResourceFull.Name       = ResourceData.Name;
                    ResourceFull.Type       = "图片";
                    ResourceFull.Path       = ResourceDAO.GetPath(ResourceData, FullResourcePathList) + "/" + ResourceData.Name;
                    ResourceFull.IsCarousel = ResourceData.IsCarousel == true ? "是" : "否";
                    returnobj.Add(ResourceFull);
                }

                this.rp_List.DataSource = returnobj.OrderByDescending(t => t.Type).Skip(Pager.PageSize * (Pager.CurrentPageIndex - 1)).Take(Pager.PageSize).ToList();
                Pager.RecordCount       = returnobj.Count;
                if (returnobj.Count > 0)
                {
                    tr_null.Visible = false;
                }
                else
                {
                    tr_null.Visible = true;
                }
                this.rp_List.DataBind();
                this.hf_CheckIDS.Value = "";
            }
        }
示例#3
0
        public static string SetResourceAccessRange(string code, string classCode, string unitCode, ArrayList ar, bool isRefreshRight)
        {
            string text3;

            try
            {
                string     resourceCode = GetResourceCode(code, classCode);
                bool       flag         = resourceCode == "";
                EntityData entity       = null;
                if (flag)
                {
                    resourceCode = SystemManageDAO.GetNewSysCode("ResourceCode");
                    entity       = new EntityData("Standard_Resource");
                    DataRow newRecord = entity.GetNewRecord();
                    newRecord["ResourceCode"] = resourceCode;
                    newRecord["ClassCode"]    = classCode;
                    newRecord["UnitCode"]     = unitCode;
                    newRecord["RelationCode"] = code;
                    entity.AddNewRecord(newRecord);
                }
                else
                {
                    entity = ResourceDAO.GetStandard_ResourceByCode(resourceCode);
                    entity.CurrentRow["unitCode"] = unitCode;
                }
                if (isRefreshRight)
                {
                    entity.DeleteAllTableRow("AccessRange");
                }
                entity.SetCurrentTable("AccessRange");
                int count = ar.Count;
                for (int i = 0; i < count; i++)
                {
                    AccessRange range = (AccessRange)ar[i];
                    foreach (string text2 in range.Operations.Split(new char[] { ',' }))
                    {
                        DataRow row = entity.GetNewRecord();
                        row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode");
                        row["ResourceCode"]    = resourceCode;
                        row["UnitCode"]        = unitCode;
                        row["OperationCode"]   = text2;
                        row["AccessRangeType"] = range.AccessRangeType;
                        row["RelationCode"]    = range.RelationCode;
                        entity.AddNewRecord(row);
                    }
                }
                ResourceDAO.SubmitAllStandard_Resource(entity);
                entity.Dispose();
                text3 = resourceCode;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
        /**
         * this is the constructor for the GUI, it does the following:
         * 1.  set up the DAO objects to access the local database
         * 2.  add any active meetings in the database to the field in the GUI
         * 3.  extract my X.509 certificate from the local store
         * 4.  instantiate 5 "dummy" resources, add them to resource list
         * */
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            dbConnect = "DSN=TotalRecall;UID=TotalRecallUser;PWD=totalrecall;DATABASE=TotalRecall";

            mDAO  = new MeetingDAO(dbConnect);
            pDAO  = new ParticipantDAO(dbConnect);
            rDAO  = new ResourceDAO(dbConnect);
            cDAO  = new ContactDAO(dbConnect);
            cmDAO = new ContextMsgDAO(dbConnect);

            strSelectedMtg = "";
            ArrayList lstMtgs = mDAO.GetMeetingIDs(enuMeetingState.Active);

            foreach (string s in lstMtgs)
            {
                m_boxMtgs.Items.Add(s);
            }

            strMyUrl = "http://localhost/TotalRecall/InfoAgent.asmx?wsdl";

            store = X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore);
            store.OpenRead();

            strMyName = "CN=Omar";
            certCol   = store.FindCertificateBySubjectName(strMyName);

            cert      = (X509Certificate)certCol[0];
            certToken = new X509SecurityToken(cert);

            lstResources = new ArrayList();
            for (int i = 0; i < 5; i++)
            {
                Resource res = new Resource();
                res.ID   = "res" + (i + 1);
                res.Name = "Foo" + (i + 1) + ".txt";
                res.Url  = "file:///c:\\" + res.Name;
                rDAO.AddNewResource(res);
                lstResources.Add(res);
            }

            foreach (Resource r in lstResources)
            {
                m_boxResources.Items.Add(r.ID);
            }
        }
示例#5
0
        public static DataRow CopySystemGroupNewRow(DataTable tb, DataRow drSrc, DataRow drDst, string dstClassCode)
        {
            DataRow row3;

            try
            {
                string text  = "";
                int    num   = 0;
                string text2 = "";
                if (drDst != null)
                {
                    text  = ConvertRule.ToString(drDst["GroupCode"]);
                    num   = ConvertRule.ToInt(drDst["Deep"]);
                    text2 = ConvertRule.ToString(drDst["FullID"]);
                }
                DataRow row       = tb.NewRow();
                int     num2      = num + 1;
                string  groupCode = SystemManageDAO.GetNewSysCode("SystemGroupCode");
                string  text4     = text2;
                if (text4.Length > 0)
                {
                    text4 = text4 + "-" + groupCode;
                }
                else
                {
                    text4 = groupCode;
                }
                row["GroupCode"]  = groupCode;
                row["GroupName"]  = drSrc["GroupName"];
                row["SortID"]     = drSrc["SortID"];
                row["ClassCode"]  = dstClassCode;
                row["deep"]       = num2;
                row["FullID"]     = text4;
                row["ParentCode"] = text;
                tb.Rows.Add(row);
                EntityData entity = ResourceDAO.GetAccessRangeByGroupCode(drSrc[0].ToString());
                DataTable  table  = entity.Tables["AccessRange"];
                for (int i = table.Rows.Count - 1; i >= 0; i--)
                {
                    DataRow row2 = table.Rows[i];
                    AccessRangeNewRow(table, row2["AccessRangeType"].ToString(), row2["RelationCode"].ToString(), row2["OperationCode"].ToString(), groupCode, row2["RoleLevel"].ToString(), row2["ResourceCode"].ToString());
                }
                ResourceDAO.SubmitAllAccessRange(entity);
                row3 = row;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(row3);
        }
 private void InfoBind()
 {
     using (IFMPDBContext db = new IFMPDBContext())
     {
         ResourceData ResourceData = db.ResourceData.FirstOrDefault(t => t.ID == ResourceDataID);
         if (ResourceData != null)
         {
             List <ResourcePath> FullResourcePathList = db.ResourcePath.ToList();
             this.txt_Name.Text  = ResourceData.Name;
             this.img.Visible    = true;
             this.img.ImageUrl   = ResourceDAO.GetPath(ResourceData, FullResourcePathList) + "/" + ResourceData.Name;
             this.hf_Photo.Value = this.img.ImageUrl;
         }
     }
 }
        private Hashtable policyTable;          // keeps policies keyed by ID (for categories)

        public PolicyEditor()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            policyTable = new Hashtable();

            policyDAO   = new PolicyDAO(PolicyManager.DatabaseConnectionString);
            resourceDAO = new ResourceDAO(PolicyManager.DatabaseConnectionString);
            categoryDAO = new CategoryDAO(PolicyManager.DatabaseConnectionString);

            RefreshResourceList();
            RefreshCategoryList();
            RefreshPolicyLists();
        }
 public ResourceManagerBiz()
 {
     dao = new ResourceDAO();
 }
示例#9
0
        public static void DeleteSystemGroup(string GroupCode)
        {
            Exception exception;

            try
            {
                if (GroupCode != "")
                {
                    string message = CheckDeleteSystemGroup(GroupCode);
                    if (message != "")
                    {
                        throw new Exception(message);
                    }
                    EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(GroupCode);
                    if (systemGroupByCode.HasRecord())
                    {
                        string    keyvalues;
                        string    parentFullID = systemGroupByCode.GetString("FullID");
                        DataTable table        = new DataTable();
                        table.Columns.Add("AccessRangeCode");
                        EntityData systemGroupIncludeAllChildByParentFullID = SystemManageDAO.GetSystemGroupIncludeAllChildByParentFullID(parentFullID);
                        foreach (DataRow row in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows)
                        {
                            EntityData accessRangeByGroupCode = ResourceDAO.GetAccessRangeByGroupCode(row["GroupCode"].ToString());
                            foreach (DataRow row2 in accessRangeByGroupCode.CurrentTable.Rows)
                            {
                                keyvalues = row2["AccessRangeCode"].ToString();
                                DataRow row3 = table.NewRow();
                                row3["AccessRangeCode"] = keyvalues;
                                table.Rows.Add(row3);
                            }
                            accessRangeByGroupCode.Dispose();
                        }
                        using (StandardEntityDAO ydao = new StandardEntityDAO("SystemGroup"))
                        {
                            ydao.BeginTrans();
                            try
                            {
                                foreach (DataRow row3 in table.Rows)
                                {
                                    keyvalues       = row3["AccessRangeCode"].ToString();
                                    ydao.EntityName = "AccessRange";
                                    EntityData entitydata = new EntityData("AccessRange");
                                    entitydata = ydao.SelectbyPrimaryKey(keyvalues);
                                    ydao.DeleteAllRow(entitydata);
                                    ydao.DeleteEntity(entitydata);
                                    entitydata.Dispose();
                                }
                                foreach (DataRow row3 in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows)
                                {
                                    string text3 = row3["GroupCode"].ToString();
                                    ydao.EntityName = "SystemGroup";
                                    EntityData data5 = new EntityData("SystemGroup");
                                    data5 = ydao.SelectbyPrimaryKey(text3);
                                    ydao.DeleteAllRow(data5);
                                    ydao.DeleteEntity(data5);
                                    data5.Dispose();
                                }
                                ydao.CommitTrans();
                            }
                            catch (Exception exception1)
                            {
                                exception = exception1;
                                try
                                {
                                    ydao.RollBackTrans();
                                }
                                catch
                                {
                                }
                                throw exception;
                            }
                        }
                        systemGroupIncludeAllChildByParentFullID.Dispose();
                    }
                    systemGroupByCode.Dispose();
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
        }
示例#10
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    using (IFMPDBContext db = new IFMPDBContext())
                    {
                        ResourcePath        ResourcePath         = db.ResourcePath.FirstOrDefault(t => t.ID == ResourcePathID);
                        List <ResourcePath> FullResourcePathList = db.ResourcePath.ToList();
                        if (ResourcePath == null)
                        {
                            ResourcePath            = new ResourcePath();
                            ResourcePath.CreateDate = DateTime.Now;
                            ResourcePath.IsDel      = false;
                            ResourcePath.Name       = txt_Name.Text;
                            ResourcePath.ParentID   = ParentPathID;

                            db.ResourcePath.Add(ResourcePath);
                            db.SaveChanges();

                            //在这个位置添加一个文件夹
                            //string path = "../Resource";
                            string subPath = System.Web.HttpContext.Current.Server.MapPath(ResourceDAO.GetPathByPathID(ParentPathID, FullResourcePathList)) + "/" + ResourcePath.Name + "/";
                            if (false == System.IO.Directory.Exists(subPath))
                            {
                                //创建pic文件夹
                                System.IO.Directory.CreateDirectory(subPath);
                            }

                            new SysLogDAO().AddLog(LogType.操作日志_添加, "添加资源路径", UserID);
                        }
                        else
                        {
                            ResourcePath.Name = txt_Name.Text;
                            db.SaveChanges();
                            new SysLogDAO().AddLog(LogType.操作日志_修改, "修改资源路径", UserID);
                        }

                        ShowMessage();

                        ts.Complete();
                    }
                }
                catch (Exception ex)
                {
                    ShowMessage(ex.Message);
                    new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                    ts.Dispose();
                    return;
                }
            }
        }
示例#11
0
        /**
         * this constructor does the following:
         * 1.  read in the X.509 certificate from the machine store
         * 2.  get the localhost IP address
         * 3.  create an executor / executor context for the local InfoAgent
         * 4.  create the DAO objects to access contents in the database
         * 5.  update the existing meetings with all meetings in the database
         * */
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            store = X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore);
            store.OpenRead();

            strMyId = "CN=Omar";
            certCol = store.FindCertificateBySubjectName(strMyId);

            cert      = (X509Certificate)certCol[0];
            certToken = new X509SecurityToken(cert);

            me      = new MeetingParticipant();
            me.Name = cert.GetName();
            me.Role = enuMeetingParticipantRole.Organizer;

            strFileLocation = "TotalRecall/InfoAgent.asmx?wsdl";
            string      strHost = Dns.GetHostName();
            IPHostEntry entry   = Dns.Resolve(strHost);
            string      strIP   = "";

            if (entry.AddressList.Length > 0)
            {
                IPAddress addr = new IPAddress(entry.AddressList[0].Address);
                strIP = addr.ToString();
            }
            else
            {
                m_boxInvite.Text = "ERROR getting host IP";
                return;
            }
            StringBuilder strbldUrl = new StringBuilder(strIP);

            strbldUrl.Append(strFileLocation);
            me.Location = strbldUrl.ToString();


            //create my infoagent
            strMyUrl = "http://localhost/TotalRecall/InfoAgent.asmx?wsdl";

            ProxyGenRequest pxyreq = new ProxyGenRequest();

            pxyreq.ProxyPath   = "";
            pxyreq.ServiceName = "InfoAgent";
            pxyreq.WsdlUrl     = strMyUrl;

            ProxyPolicyMutator mymutator = new ProxyPolicyMutator();

            mymutator.ProxyName = pxyreq.ServiceName;

            // Ensure the name of the file generated is unique
            string strMySuffix = "";
            int    nMyCode     = Guid.NewGuid().GetHashCode();

            if (nMyCode < 0)
            {
                nMyCode = nMyCode * -1;
            }
            strMySuffix        = nMyCode.ToString();
            pxyreq.ServiceName = pxyreq.ServiceName + "_" + strMySuffix;

            ProxyGen myPxyGen = new ProxyGen();

            myPxyGen.Mutator = mymutator;

            string strMyAssembly = "";

            try
            {
                strMyAssembly = myPxyGen.GenerateAssembly(pxyreq);
            }
            catch (Exception excep)
            {
                string strString = excep.Message;
            }

            myctx             = new ExecContext();
            myctx.ServiceName = pxyreq.Namespace + "." + mymutator.ProxyName;
            myctx.Assembly    = strMyAssembly;


            myexec = new Executor();
            myexec.Settings.ExpectSignedResponse = true;
            myexec.Settings.SigningCertificate   = cert;

            dbConnect = "DSN=TotalRecall;UID=TotalRecallUser;PWD=totalrecall;DATABASE=TotalRecall";

            mDAO = new MeetingDAO(dbConnect);
            pDAO = new ParticipantDAO(dbConnect);
            rDAO = new ResourceDAO(dbConnect);
            cDAO = new ContactDAO(dbConnect);

            strSelectedMtg = "";
            ArrayList lstMtgs = mDAO.GetMeetingIDs(enuMeetingState.Active);

            foreach (string s in lstMtgs)
            {
                m_boxMtgs.Items.Add(s);
            }
        }
示例#12
0
        public static string SetResourceAccessRange(string code, string classCode, string unitCode, bool isRefreshRight)
        {
            string text5;

            try
            {
                string     resourceCode = GetResourceCode(code, classCode);
                bool       flag         = resourceCode == "";
                EntityData entity       = null;
                if (flag)
                {
                    resourceCode = SystemManageDAO.GetNewSysCode("ResourceCode");
                    entity       = new EntityData("Standard_Resource");
                    DataRow newRecord = entity.GetNewRecord();
                    newRecord["ResourceCode"] = resourceCode;
                    newRecord["ClassCode"]    = classCode;
                    newRecord["UnitCode"]     = unitCode;
                    newRecord["RelationCode"] = code;
                    entity.AddNewRecord(newRecord);
                }
                else
                {
                    entity = ResourceDAO.GetStandard_ResourceByCode(resourceCode);
                    entity.CurrentRow["unitCode"] = unitCode;
                }
                if (isRefreshRight)
                {
                    entity.DeleteAllTableRow("AccessRange");
                }
                EntityData stationByUnitAccess = OBSDAO.GetStationByUnitAccess(unitCode);
                entity.SetCurrentTable("AccessRange");
                foreach (DataRow row2 in stationByUnitAccess.CurrentTable.Rows)
                {
                    string     text2 = row2["RoleCode"].ToString();
                    string     text3 = row2["StationCode"].ToString();
                    EntityData data3 = SystemManageDAO.GetStandard_RoleByCode(text2);
                    foreach (DataRow row3 in data3.Tables["RoleOperation"].Select(string.Format(" SubString(OperationCode,1,4)='{0}' ", classCode)))
                    {
                        string  text4 = (string)row3["OperationCode"];
                        DataRow row   = entity.GetNewRecord();
                        row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode");
                        row["ResourceCode"]    = resourceCode;
                        row["UnitCode"]        = unitCode;
                        row["OperationCode"]   = text4;
                        row["AccessRangeType"] = 1;
                        row["RelationCode"]    = text3;
                        entity.AddNewRecord(row);
                    }
                    data3.Dispose();
                }
                stationByUnitAccess.Dispose();
                ResourceDAO.SubmitAllStandard_Resource(entity);
                entity.Dispose();
                text5 = resourceCode;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text5);
        }
示例#13
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    using (IFMPDBContext db = new IFMPDBContext())
                    {
                        //这里应该有权限,很重要
                        ResourceData        ResourceData         = db.ResourceData.FirstOrDefault(t => t.ID == ResourceDataID && t.IsDel != true);
                        List <ResourcePath> FullResourcePathList = db.ResourcePath.ToList();
                        string message = "";
                        if (ResourceData == null)
                        {
                            ResourceData = new ResourceData();

                            //ResourceData.Name = txt_Name.Text;
                            ResourceData.CreateDate     = DateTime.Now;
                            ResourceData.IsCarousel     = (ddl_IsCarousel.SelectedValue == "0" ? false : true);
                            ResourceData.IsDel          = false;
                            ResourceData.ResourcePathID = ResourcePathID;
                            //ResourceData.ResourcePathID
                            #region   图片
                            if (this.fl_UpFile.HasFile)
                            {
                                int upsize = 4000000;
                                try
                                {
                                    upsize = Convert.ToInt32(ConfigurationManager.AppSettings["upsize"].ToString());
                                }
                                catch (Exception) { }


                                string path = System.Web.HttpContext.Current.Server.MapPath(ResourceDAO.GetPathByPathID(ResourcePathID, FullResourcePathList));
                                if (!Directory.Exists(path))
                                {
                                    Directory.CreateDirectory(path);
                                }
                                string name = this.fl_UpFile.PostedFile.FileName.ToString();

                                string filepath = path + "\\" + name;

                                if (this.fl_UpFile.PostedFile.ContentLength < upsize)
                                {
                                    this.fl_UpFile.SaveAs(filepath);
                                }

                                ResourceData.Name = name;
                                db.ResourceData.Add(ResourceData);
                                db.SaveChanges();
                                new SysLogDAO().AddLog(LogType.操作日志_添加, "添加资源图片", UserID);
                            }
                            else
                            {
                                ShowMessage("请添加图片");
                                return;
                            }
                            #endregion
                        }
                        else
                        {
                            ResourceData.IsCarousel = Convert.ToBoolean(ddl_IsCarousel.SelectedValue);
                            ResourceData.IsDel      = false;
                            //ResourceData.ResourcePathID = ResourcePathID;
                            //若和原图相同则不替换
                        }
                        ShowMessage();

                        ts.Complete();
                    }
                }
                catch (Exception ex)
                {
                    ShowMessage(ex.Message);
                    new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                    ts.Dispose();
                    return;
                }
            }
        }