Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Cms.Model.Solution model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Solutions(");
            strSql.Append("CaseTitle,Description,Solution,SucCases,ImageUrl,IsLock,SortOrder)");
            strSql.Append(" values (");
            strSql.Append("@CaseTitle,@Description,@Solution,@SucCases,@ImageUrl,@IsLock,@SortOrder)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@CaseTitle", SqlDbType.NVarChar,50),
                    new SqlParameter("@Description", SqlDbType.NText),
                    new SqlParameter("@Solution", SqlDbType.NText),
                    new SqlParameter("@SucCases", SqlDbType.NText),
                    new SqlParameter("@ImageUrl", SqlDbType.NVarChar,250),
                    new SqlParameter("@IsLock", SqlDbType.Int,4),
                    new SqlParameter("@SortOrder", SqlDbType.Int,4)};
            parameters[0].Value = model.Title;
            parameters[1].Value = model.Description;
            parameters[2].Value = model.SolutionPlan;
            parameters[3].Value = model.SucCases;
            parameters[4].Value = model.ImageUrl;
            parameters[5].Value = model.IsLock;
            parameters[6].Value = model.SortOrder;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 2
0
    public void fillgrid(string type)
    {
        Cms ad = new Cms();


        DataTable dt = ad.getaboutus(type);

        if (dt.Rows.Count == 0)
        {
            Button1.Visible = true;
            Button2.Visible = false;
            uc1.Value       = "";
        }
        else
        {
            Button2.Visible = true;
            Button1.Visible = false;
            uc1.Value       = Server.HtmlDecode(dt.Rows[0]["description"].ToString());
            string types = dt.Rows[0]["type"].ToString();
            for (int i = 0; i < DropDownList1.Items.Count; i++)
            {
                if (DropDownList1.Items[i].Text == types)
                {
                    DropDownList1.Items[i].Selected = true;
                }
            }
        }
    }
Exemplo n.º 3
0
        private void CreateTestCms()
        {
            var defaultTenant = _context.Tenants.Single(t => t.TenancyName == Tenant.DefaultTenantName);

            _context.Cmss.Add(Cms.InsertOrUpdateCMSContent(defaultTenant.Id, CmsPageId, CmsPageName, CmsPageContent));
            _context.SaveChanges();
        }
Exemplo n.º 4
0
        public ActionResult RegisterByAdmin(User user)
        {
            using (var db = new Cms())
            {
                var userTable = db.Users;
                var result    = userTable.FirstOrDefault(x =>
                                                         x.UserName.Equals(user.UserName));
                if (result == null)
                {
                    var registerUser = new User()
                    {
                        UserName = user.UserName,
                        PassWord = user.PassWord == "" ? "1" : user.PassWord,
                        Role     = db.Roles.FirstOrDefault(x => x.Id == user.RoleType),
                        RoleType = user.RoleType,
                        Email    = user.Email
                    };

                    db.Users.Add(registerUser);
                    db.SaveChanges();

                    return(Redirect("Account"));
                }

                ViewBag.Mess = "UserName is exit, please register other user !!!";
                return(Redirect("Account"));
            }
        }
Exemplo n.º 5
0
        public ActionResult CheckRegister(User user, string rePass)
        {
            using (var db = new Cms())
            {
                var userTable = db.Users;
                var result    = userTable.FirstOrDefault(x =>
                                                         x.UserName.Equals(user.UserName) && x.PassWord.Equals(user.PassWord));
                if (result == null && rePass != user.PassWord)
                {
                    ViewBag.Mess = "Success";
                    ViewBag.User = user;
                    var registerUser = new User()
                    {
                        UserName = user.UserName,
                        PassWord = user.PassWord,
                        Role     = db.Roles.FirstOrDefault(x => x.Type == "user"),
                        Email    = user.Email
                    };

                    db.Users.Add(registerUser);
                    db.SaveChanges();

                    return(Redirect("Login"));
                }

                ViewBag.Mess = "UserName is exit, please register other user !!!";
                return(Redirect("Register"));
            }
        }
 /// <summary>
 /// The default editor for editing the build-in pre values in Umbraco
 /// </summary>
 /// <param Name="DataType">The DataType to be parsed</param>
 /// <param Name="DisplayTextBox">Whether to use the default text box</param>
 public DefaultPrevalueEditor(Cms.BusinessLogic.datatype.BaseDataType DataType, bool DisplayTextBox)
 {
     // state it knows its datatypedefinitionid
     _displayTextBox = DisplayTextBox;
     _datatype = DataType;
     setupChildControls();
 }
        public uploadFieldPreValue(Cms.BusinessLogic.datatype.BaseDataType DataType) 
		{
			// state it knows its datatypedefinitionid
			_datatype = DataType;
			setupChildControls();

		}
Exemplo n.º 8
0
        public static void Init()
        {
            AspNetInitializer.Init();
            Cms.OfficialEnvironment = false;
            // 初始化资源
            SiteResourceInit.Init();
            Cms.ConfigCache(new AspNetCacheWrapper());
            //Cms.OnInit += CmsEventRegister.Init;
            Cms.Init(BootFlag.Normal, null);
            //注册路由;
            Routes.MapRoutes(RouteTable.Routes);
            // 加载插件
            //WebCtx.Current.Plugin.Connect();

            //RouteDebug.RouteDebugger.RewriteRoutesForTesting(routes);

            //加载自定义插件
            //Cms.Plugins.Extends.LoadFromAssembly(typeof(sp.datapicker.CollectionExtend).Assembly);

            //注册定时任务
            // CmsTask.Init();


            //设置可写权限
            Cms.Utility.SetDirCanWrite("bin");
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.TEMP_PATH + "update");
            Cms.Utility.SetDirHidden("config");
        }
Exemplo n.º 9
0
        public static void V_Test_CMS_MakeSigData()
        {
            Console.WriteLine("Testing CMS_MakeSigData ...");
            string        strPriKeyFile = null;
            StringBuilder sbPrivateKey  = null;
            //'Dim nIntKeyLen As Integer
            int    nRet          = 0;
            string strInputFile  = null;
            string strOutputFile = null;
            string strCertFile   = null;

            strPriKeyFile = "myuser.epk";
            strCertFile   = "myuser.cer";
            strInputFile  = "excontent.txt";
            strOutputFile = "BasicSignBy_myuser.bin";

            // First we need to read in the private key string
            // NB: This version is not encrypted
            sbPrivateKey = Rsa.ReadEncPrivateKey(strPriKeyFile, "password");
            Console.WriteLine("nIntKeyLen = " + sbPrivateKey.Length);
            if (sbPrivateKey.Length == 0)
            {
                Console.WriteLine(General.LastError());
                Console.WriteLine("Unable to retrieve private key");
                return;
            }
            Console.WriteLine("Key size=" + Rsa.KeyBits(sbPrivateKey.ToString()) + " bits");

            // Now we can sign our message
            nRet = Cms.MakeSigData(strOutputFile, strInputFile, strCertFile, sbPrivateKey.ToString(), 0);
            Console.WriteLine("CMS_MakeSigData returns " + nRet);
        }
Exemplo n.º 10
0
        /// <summary>
        /// CMS初始化
        /// </summary>
        public static void Init()
        {
            //设置依赖反转
            ObjectFactory.Configure(x =>
            {
                //x.For<IArchiveModel>().Singleton().Use<ArchiveBLL>();
                // x.For<ICategoryModel>().Singleton().Use<CategoryBLL>();
                x.For <IComment>().Singleton().Use <CommentBLL>();
                // x.For<ILink>().Singleton().Use<LinkBLL>();
                x.For <Imember>().Singleton().Use <MemberBLL>();
                x.For <Imessage>().Singleton().Use <MessageBLL>();
                x.For <Imodule>().Singleton().Use <ModuleBLL>();
                //x.For<ISite>().Singleton().Use<SiteBLL>();
                // x.For<ITemplateBind>().Singleton().Use<TemplateBindBLL>();
                x.For <IUser>().Singleton().Use <UserBLL>();
                x.For <ITable>().Singleton().Use <TableBLL>();
            });

            //读取站点
            Cms.RegSites(SiteCacheManager.GetAllSites().ToArray());

            //内嵌资源释放
            SiteResourceInit.Init();

            //设置可写权限
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);

            Cms.Utility.SetDirHidden("config");
            Cms.Utility.SetDirHidden("bin");
        }
Exemplo n.º 11
0
        //TODO : VIEW MODEL
        public IActionResult Put(int id, [FromBody] CmsViewModel cms)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Cms _cmsDb = _cmsRepository.GetSingle(id);

            if (_cmsDb == null)
            {
                return(NotFound());
            }
            else
            {
                //TODO : AJUSTAR
                _cmsDb.Titulo         = cms.Titulo;
                _cmsDb.Avatar         = cms.Avatar;
                _cmsDb.QtdFields      = cms.QtdFields;
                _cmsDb.FieldsCreated  = cms.FieldsCreated;
                _cmsDb.WorkItemTypeId = cms.WorkItemTypeId;
                _cmsRepository.Commit();
            }

            //cms = Mapper.Map<Cms, CmsViewModel>(_cmsDb);

            CreatedAtRouteResult result = CreatedAtRoute("GetCmsies", new { controller = "Cmsies", _cmsDb.Id }, cms);

            return(result);
            // return new NoContentResult();
        }
Exemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        public static void UserCmsInitializer(this IApplicationBuilder app)
        {
            app.UseCmsMiddleware(); // 添加cms拦截器
            // app.UseCmsRoutes();          // 注册路由

            //Cms.OnInit += CmsEventRegister.Init;
            // 初始化资源
            SiteResourceInit.Init();
            Cms.ConfigCache(new MemoryCacheWrapper());
            Cms.Init(BootFlag.Normal, null);
            // 加载插件
            //WebCtx.Current.Plugin.Connect();


            //设置可写权限
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.TEMP_PATH + "update");
            Cms.Utility.SetDirHidden("config");

            //注册定时任务
            //CmsTask.Init();
        }
Exemplo n.º 13
0
        public IActionResult Delete(int id)
        {
            Cms _cmsDb = _cmsRepository.GetSingle(id);

            if (_cmsDb == null)
            {
                return(new NotFoundResult());
            }
            else
            {
                IEnumerable <Field> _fields = _fieldRepository.FindBy(a => a.CmsId == id);

                foreach (var field in _fields)
                {
                    _fieldRepository.DeleteWhere(a => a.CmsId == field.Id);
                    _fieldRepository.Delete(field);
                }

                _cmsRepository.Delete(_cmsDb);

                _cmsRepository.Commit();

                return(new NoContentResult());
            }
        }
Exemplo n.º 14
0
        internal static void UseCmsMiddleware(this IApplicationBuilder app)
        {
            // 如果没有安装,则跳转到安装地址
            app.Use(async(context, next) =>
            {
                if (Cms.IsInstalled() || context.Request.Path == "/install")
                {
                    await next();
                    return;
                }
                context.Response.Redirect("/install");
            });
            // 自动跳转到www开头的域名
            app.Use(async(context, next) =>
            {
                var redirect = false;
                if (Settings.SYS_AUTOWWW)
                {
                    var url = context.Request.GetEncodedUrl() ??
                              throw new ArgumentNullException("context.Request.GetEncodedUrl()");
                    var host = context.Request.Host.Host;
                    if (host.Split('.').Length == 2)
                    {
                        context.Response.Redirect(url.Replace(host, "www." + host));
                        redirect = true;
                    }
                }

                if (!redirect)
                {
                    await next();
                }
            });
        }
		public mailerConfiguratorPreValueEditor(Cms.BusinessLogic.datatype.BaseDataType DataType) 
		{
			// state it knows its datatypedefinitionid
			_datatype = DataType;
			setupChildControls();

		}
Exemplo n.º 16
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Cms.Model.JobInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into JobList(");
            strSql.Append("Position,Requirement,Responsibility,HeadCount,IsLock,JobOrder)");
            strSql.Append(" values (");
            strSql.Append("@Position,@Requirement,@Responsibility,@HeadCount,@IsLock,@JobOrder)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Position", SqlDbType.NVarChar,50),
                    new SqlParameter("@Requirement", SqlDbType.NText),
                    new SqlParameter("@Responsibility", SqlDbType.NText),
                    new SqlParameter("@HeadCount", SqlDbType.Int,4),
                    new SqlParameter("@IsLock", SqlDbType.Int,4),
                    new SqlParameter("@JobOrder", SqlDbType.Int,4)};
            parameters[0].Value = model.Position;
            parameters[1].Value = model.Requirement;
            parameters[2].Value = model.Responsibility;
            parameters[3].Value = model.HeadCount;
            parameters[4].Value = model.IsLock;
            parameters[5].Value = model.JobOrder;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        ///     检查站点首页路径
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="site"></param>
        /// <returns></returns>
        private bool CheckSiteUrl(ICompatibleHttpContext ctx, SiteDto site)
        {
            // 跳转到自定义地址
            if (!string.IsNullOrEmpty(site.Location))
            {
                ctx.Response.Redirect(site.Location, false); //302
                return(false);
            }

            // 跳转到站点首页
            var path = ctx.Request.GetPath();

            if (!string.IsNullOrEmpty(site.AppPath) && path == "/")
            {
                ctx.Response.Redirect("/" + site.AppPath, false);
                return(false);
            }

            if (string.IsNullOrEmpty(Settings.SYS_SITE_MAP_PATH))
            {
                Settings.SYS_SITE_MAP_PATH = Utils.GetBaseUrl(ctx);
                Configuration.BeginWrite();
                Configuration.UpdateByPrefix("sys");
                Configuration.EndWrite();
            }

            if (!Cms.ExistsRobots())
            {
                Cms.GenerateRobots(Utils.GetBaseUrl(ctx));
            }

            return(true);
        }
Exemplo n.º 18
0
 public void AggiornaStato()
 {
     Cms.AggiornaStato();
     Mcs.AggiornaStato();
     Uos.AggiornaStato();
     StatoAggiornato = true;
 }
Exemplo n.º 19
0
        public UndoChangePassword(CompanyGroup.Dto.PartnerModule.UndoChangePassword undoChangePassword, Cms.CommonCore.Models.Visitor visitor)
        {
            this.Message = undoChangePassword.Message;

            this.Succeeded = undoChangePassword.Succeeded;

            this.Visitor = visitor;
        }
Exemplo n.º 20
0
        public void SetUp()
        {
            Environment.CurrentDirectory = Path.GetDirectoryName(typeof(Tests).Assembly.Location);
            this.cms = new Cms();

            // после того как первый раз заполните cms данными, эту строчку нужно закоментить
            FillTestData(6, 11);
        }
Exemplo n.º 21
0
        public editor(Cms.BusinessLogic.datatype.DefaultData Data)
        {
            _data = Data;

            if (HttpContext.Current.Request.Browser.Win32 &&
                HttpContext.Current.Request.Browser.Browser == "IE")
                _browserIsCompatible = true;
        }
 protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile)
 {
     Rectangle selection = FSpot.Utils.PixbufUtils.TransformOrientation ((int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Width : input.Height,
                                         (int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Height : input.Width,
                                         State.Selection, State.PhotoImageView.PixbufOrientation);
     int threshold = Preferences.Get<int> (Preferences.EDIT_REDEYE_THRESHOLD);
     return PixbufUtils.RemoveRedeye (input, selection, threshold);
 }
Exemplo n.º 23
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        MessageBox msg = new MessageBox(); Cms ad = new Cms();

        ad.insertaboutus(DropDownList1.SelectedItem.Text.ToString(), Server.HtmlEncode(uc1.Value));
        msg.Show("CMS updated successfully");
        fillgrid(DropDownList1.SelectedItem.Text.ToString());
    }
Exemplo n.º 24
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Cms.Model.Admin model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Staff(");
            strSql.Append("StaffName,StaffTel,StaffAddres)");
            strSql.Append(" values (");
            strSql.Append("@StaffName,@StaffTel,@StaffAddres)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@StaffName", SqlDbType.VarChar,50),
                    new SqlParameter("@StaffTel", SqlDbType.VarChar,50),
                    new SqlParameter("@StaffAddres", SqlDbType.VarChar,50)};
            parameters[0].Value = model.RealName;
            parameters[1].Value = model.Telephone;
            parameters[2].Value = model.Address;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                model.StaffID =  Convert.ToInt32(obj);
            }

            strSql = new StringBuilder();
            strSql.Append("insert into UserInfo(");
            strSql.Append("username,password,realname2,departmentId,roleid,StaffId,userbh)");
            strSql.Append(" values (");
            strSql.Append("@username,@password,@realname2,@departmentId,@roleid,@StaffId,@userbh)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parametersUser = {
                    new SqlParameter("@username", SqlDbType.NVarChar,50),
                    new SqlParameter("@password", SqlDbType.Char,32),
                    new SqlParameter("@realname2", SqlDbType.NVarChar,50),
                    new SqlParameter("@departmentId", SqlDbType.Int,4),
                    new SqlParameter("@roleid", SqlDbType.Int,4),
                    new SqlParameter("@StaffId", SqlDbType.Int,4),
                    new SqlParameter("@userbh", SqlDbType.NVarChar,50)};
            parametersUser[0].Value = model.UserName;
            parametersUser[1].Value = model.UserPwd;
            parametersUser[2].Value = model.RealName;
            parametersUser[3].Value = model.DepartID;
            parametersUser[4].Value = model.RoleID;
            parametersUser[5].Value = model.StaffID;
            parametersUser[6].Value = model.UserBH;

            obj = DbHelperSQL.GetSingle(strSql.ToString(), parametersUser);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 25
0
        public ActionResult Account()
        {
            using (var db = new Cms())
            {
                var allAccount = db.Users.ToList();

                return(View(allAccount));
            }
        }
Exemplo n.º 26
0
		public static void UpdateCruds(BusinessLogic.User User, Cms.BusinessLogic.CMSNode Node, string Permissions) 
		{
			// delete all settings on the node for this user
			Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(GlobalSettings.DbDSN, CommandType.Text, "delete from umbracoUser2NodePermission where userId = @userId and nodeId = @nodeId", new SqlParameter("@userId", User.Id), new SqlParameter("@nodeId", Node.Id)); 

			// Loop through the permissions and create them
			foreach (char c in Permissions.ToCharArray())
				MakeNew(User, Node, c);
		}
Exemplo n.º 27
0
        protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile)
        {
            Pixbuf output = input.Copy ();

            Pixbuf sub = new Pixbuf (output, State.Selection.X, State.Selection.Y,
                    State.Selection.Width, State.Selection.Height);
            sub.Fill (0x00000000);
            return output;
        }
Exemplo n.º 28
0
        public static void V_Test_CMS_VerifySigData()
        {
            Console.WriteLine("Testing CMS_VerifySigData ...");
            int    nRet         = 0;
            string strInputFile = null;

            strInputFile = "BasicSignBy_myuser.bin";
            nRet         = Cms.VerifySigData(strInputFile, "myuser.cer");
            Console.WriteLine("CMS_VerifySigData returns " + nRet + " (expecting 0)");
        }
Exemplo n.º 29
0
 public void ProcessRequest(HttpContext context)
 {
     if (!Cms.IsInstalled())
     {
         context.Response.Redirect("/install/cms", true);
     }
     // 解决中文乱码
     context.Response.ContentType = "text/html;charset=utf-8";
     Logic.Request(HttpHosting.Context);
 }
Exemplo n.º 30
0
        public void SetUp()
        {
            Environment.CurrentDirectory = Path.GetDirectoryName(typeof(Tests).Assembly.Location);
            this.cms = new Cms();

            if (cms.Count == 0)
            {
                FillTestData(6, 11);
            }
        }
Exemplo n.º 31
0
        public void Boot()
        {
            // Cms.Init(BootFlag.UnitTest,"../../../../UIApp/T2.Cms.WebUI/config/cms.conf");
            Cms.Init(BootFlag.UnitTest, "./config/cms.conf");

            //读取站点
            if (Cms.Installed)
            {
                Cms.RegSites(SiteCacheManager.GetAllSites().ToArray());
            }
        }
Exemplo n.º 32
0
 /// <summary>
 /// 注册路由
 /// </summary>
 public static void RegisterCmsRoutes(RouteCollection routes, Type cmsHandleType)
 {
     if (!Cms.IsInstalled())
     {
         //安装路由
         routes.Add("install_route", new Route("install/process", new CmsInstallHandler()));
         routes.Add("install_route_redirect", new Route("{*path}", new CmsInstallHandler()));
         return;
     }
     RegisterInstalledCmsRoutes(routes, cmsHandleType ?? typeof(CmsController));
 }
Exemplo n.º 33
0
        public void ChannelsOfTest()
        {
            // Arrange
            ColorSpaceSignature space = ColorSpaceSignature._11colorData;
            uint expected             = 11;

            // Act
            uint actual = Cms.ChannelsOf(space);

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 34
0
        public void ToPixelTypeTest()
        {
            // Arrange
            ColorSpaceSignature space    = ColorSpaceSignature.YCbCrData;
            PixelType           expected = PixelType.YCbCr;

            // Act
            var actual = Cms.ToPixelType(space);

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 35
0
        public void ToColorSpaceSignatureTest()
        {
            // Arrange
            PixelType           pixelType = PixelType.RGB;
            ColorSpaceSignature expected  = ColorSpaceSignature.RgbData;

            // Act
            var actual = Cms.ToColorSpaceSignature(pixelType);

            // Assert
            Assert.AreEqual(expected, actual);
        }
		public KeyValuePrevalueEditor(Cms.BusinessLogic.datatype.BaseDataType DataType) 
		{
			// state it knows its datatypedefinitionid
			_datatype = DataType;
			setupChildControls();

			// Bootstrap delete.
			if (System.Web.HttpContext.Current.Request["delete"] != null) {
				DeletePrevalue(int.Parse(System.Web.HttpContext.Current.Request["delete"]));
			}
			
		}
Exemplo n.º 37
0
        public void Boot()
        {
            // Cms.Init(BootFlag.UnitTest,"../../../../UIApp/JR.Cms.WebUI/config/cms.conf");
            Cms.Init(BootFlag.UnitTest, "./config/cms.conf");

            //读取站点
            if (Cms.IsInstalled())
            {
                Cms.RegSites(SiteCacheManager.GetAllSites().ToArray());
            }

            ServiceInit.Initialize();
        }
Exemplo n.º 38
0
    protected override void RegisterInstances(TinyIoC.TinyIoCContainer container, IEnumerable <Nancy.Bootstrapper.InstanceRegistration> instanceRegistrations)
    {
        base.RegisterInstances(container, instanceRegistrations);
        var settings = new NodeTreeCms.Cms.NodeTreeCmsSettings()
        {
            DbPath          = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/NodeTreeCmsLiveDb"),
            AdminUrl        = "/admin",
            DefaultViewPath = "Views/Default.cshtml"
        };

        var cms = new Cms(settings);

        container.Register <ICms, Cms>(cms);
    }
		public FullColorAdjustment (Pixbuf input, Cms.Profile input_profile, 
				double exposure, double brightness, double contrast, 
				double hue, double saturation, 
				Cms.ColorCIEXYZ src_wp, Cms.ColorCIEXYZ dest_wp) 
			: base (input, input_profile)
		{
			this.exposure = exposure;
			this.brightness = brightness;
			this.contrast = contrast;
			this.hue = hue;
			this.saturation = saturation;
			this.src_wp = src_wp;
			this.dest_wp = dest_wp;
		}
Exemplo n.º 40
0
        public IActionResult Get(int id)
        {
            Cms _cms = _cmsRepository.GetSingle(u => u.Id == id, u => u.Fields);

            if (_cms != null)
            {
                CmsViewModel _cmsVM = Mapper.Map <Cms, CmsViewModel>(_cms);
                return(new OkObjectResult(_cmsVM));
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 41
0
        protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile)
        {
            Pixbuf output = input.Copy ();

            Pixbuf sub = new Pixbuf (output, State.Selection.X, State.Selection.Y,
                    State.Selection.Width, State.Selection.Height);
            /* lazy man's pixelate: scale down and then back up */
            Pixbuf down = sub.ScaleSimple (State.Selection.Width/75, State.Selection.Height/75,
                    InterpType.Nearest);
            Pixbuf up = down.ScaleSimple (State.Selection.Width, State.Selection.Height,
                    InterpType.Nearest);
            up.CopyArea (0, 0, State.Selection.Width, State.Selection.Height, sub, 0, 0);
            return output;
        }
Exemplo n.º 42
0
		protected override Pixbuf Process (Pixbuf input, Cms.Profile input_profile) {
			Cms.ColorCIEXYZ src_wp;
			Cms.ColorCIEXYZ dest_wp;

			src_wp = Cms.ColorCIExyY.WhitePointFromTemperature (5000).ToXYZ ();
			dest_wp = Cms.ColorCIExyY.WhitePointFromTemperature ((int)temp_scale.Value).ToXYZ ();
			Cms.ColorCIELab dest_lab = dest_wp.ToLab (src_wp);
			dest_lab.a += temptint_scale.Value;
			dest_wp = dest_lab.ToXYZ (src_wp);

			FullColorAdjustment adjust = new FullColorAdjustment (input, input_profile,
					exposure_scale.Value, brightness_scale.Value, contrast_scale.Value,
					hue_scale.Value, sat_scale.Value, src_wp, dest_wp);
			return adjust.Adjust ();
		}
Exemplo n.º 43
0
        /// <summary>
        /// 获取节点文件路径
        /// </summary>
        /// <param name="xpath"></param>
        /// <returns></returns>
        public String SelectNodeValuePath(String xpath)
        {
            string  mapTo = null;
            XmlNode node  = this.SelectSingleNode(xpath);

            if (node == null ||
                node.Attributes["value"] == null ||
                (mapTo = node.Attributes["value"].Value) == String.Empty)
            {
                Cms.TraceLog("management mapping lose!");
                return(null);
            }

            return(this.GetMapToPath(mapTo));
        }
Exemplo n.º 44
0
        public static void ApplyProfile(Gdk.Pixbuf pixbuf, Cms.Profile image_profile, Cms.Profile destination_profile)
        {
            if (pixbuf == null || pixbuf.HasAlpha)
                return;

            image_profile = image_profile ?? Cms.Profile.CreateStandardRgb ();

            Cms.Profile [] list = new Cms.Profile [] { image_profile, destination_profile };
            Cms.Transform transform = new Cms.Transform (list,
                                     PixbufUtils.PixbufCmsFormat (pixbuf),
                                     PixbufUtils.PixbufCmsFormat (pixbuf),
                                     Cms.Intent.Perceptual,
                                     0x0000);
            PixbufUtils.ColorAdjust (pixbuf, pixbuf, transform);
        }
Exemplo n.º 45
0
        private static string GetMappingXmlPath(String key)
        {
            string mapTo = null;

            XmlNode node = SelectSingleNode("/maps/map[@for='" + key + "']");

            if (node == null ||
                node.Attributes["to"] == null ||
                (mapTo = node.Attributes["to"].Value) == String.Empty)
            {
                Cms.TraceLog("management mapping lose!");
                return(null);
            }

            return(GetMapToPath(mapTo));
        }
Exemplo n.º 46
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         Cms       ad = new Cms();
         DataTable dt = ad.getaboutus(Request.QueryString["id"]);
         if (dt.Rows.Count == 0)
         {
         }
         else
         {
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
         }
     }
 }
		private Pixbuf ProcessImpl (Pixbuf input, Cms.Profile input_profile, bool fast) {
			Pixbuf result;
			using (ImageInfo info = new ImageInfo (input)) {
				Widgets.SoftFocus soft = new Widgets.SoftFocus (info);
				soft.Radius = radius;

				MemorySurface surface = new MemorySurface (Format.Argb32,
									   input.Width,
									   input.Height);

				Context ctx = new Context (surface);
				soft.Apply (ctx, info.Bounds);
				((IDisposable)ctx).Dispose ();

				result = MemorySurface.CreatePixbuf (surface);
				surface.Flush ();
			}
			return result;
		}
Exemplo n.º 48
0
        public JsonResult FilteredInvoice(Cms.PartnerInfo.Models.GetInvoiceInfo request)
        {
            CompanyGroup.Dto.ServiceRequest.GetInvoiceInfo req = new CompanyGroup.Dto.ServiceRequest.GetInvoiceInfo()
            {
                LanguageId = this.ReadLanguageFromCookie(),
                VisitorId = this.ReadObjectIdFromCookie(),
                PaymentType = request.PaymentType
            };

            List<CompanyGroup.Dto.PartnerModule.InvoiceInfo> response = this.PostJSonData<List<CompanyGroup.Dto.PartnerModule.InvoiceInfo>>("CustomerService", "GetInvoiceInfo", req);

            List<Cms.PartnerInfo.Models.InvoiceInfo> invoiceInfoList = new List<Cms.PartnerInfo.Models.InvoiceInfo>();

            invoiceInfoList.AddRange(response.ConvertAll(x => ConverInvoiceInfoToInvoiceInfo(x)));

            Cms.PartnerInfo.Models.InvoiceInfoList model = new Cms.PartnerInfo.Models.InvoiceInfoList(invoiceInfoList);

            return Json(model, "application/json; charset=utf-8", System.Text.Encoding.UTF8, JsonRequestBehavior.DenyGet);
        }
Exemplo n.º 49
0
        protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile)
        {
            uint timer = FSpot.Utils.Log.DebugTimerStart ();
            if (input.BitsPerSample != 8) {
                FSpot.Utils.Log.Warning ("unsupported pixbuf format");
                return (Pixbuf)input.Clone ();
            }
            Pixbuf output = new Pixbuf (input.Colorspace, input.HasAlpha, input.BitsPerSample, input.Width, input.Height);
            Vector4f multiply = new Vector4f ((float)(r.Value/100.0), (float)(g.Value/100.0), (float)(b.Value/100.0), 0);
            Normalize (ref multiply);

            bool has_alpha = input.HasAlpha;
            int chan = input.NChannels;
            int rowstride_in = input.Rowstride;
            int rowstride_out = output.Rowstride;
            Vector4f v_in;
            Vector4f v_out = new Vector4f (0);
            float[] fcurve = new float [256];
            c.GetVector (fcurve.Length, fcurve);
            byte[] curve = new byte [fcurve.Length];
            for (int i = 0; i < fcurve.Length; i++)
                curve[i] = (byte)fcurve[i];
            unsafe {
                byte *pix_in = (byte *)input.Pixels;
                byte *pix_out = (byte *)output.Pixels;
                for (int i=0; i < input.Height; i++)
                    for (int j=0; j<input.Width; j++) {
                        v_in = new Vector4f (pix_in[i*rowstride_in + j*chan],
                                     pix_in[i*rowstride_in + j*chan + 1],
                                     pix_in[i*rowstride_in + j*chan + 2],
                                     0);
                        Desaturate (ref v_in, ref multiply, ref v_out);
                        pix_out[i*rowstride_out + j*chan] = curve [unchecked ((byte)v_out.X)];
                        pix_out[i*rowstride_out + j*chan + 1] = curve [unchecked ((byte)v_out.Y)];
                        pix_out[i*rowstride_out + j*chan + 2] = curve [unchecked ((byte)v_out.Z)];
                        if (has_alpha)
                            pix_out[i*rowstride_out + j*chan + 3] = pix_in[i*rowstride_in + j*chan + 3];
                    }
            }
            FSpot.Utils.Log.DebugTimerPrint (timer, "Processing took {0}");
            return output;
        }
Exemplo n.º 50
0
		public UInt16Buffer (Gdk.Pixbuf pixbuf, Cms.Profile profile)
		{
			this.profile = profile;
			width = pixbuf.Width;
			height = pixbuf.Height;
			this.nchannels = pixbuf.HasAlpha ? 4 : 3;
			
			depth = PixelBufferDepth.UInt16;

			data = new ushort [width * height * nchannels];
			
			unsafe {
				byte * src_pixels = (byte *) pixbuf.Pixels;
				int src_stride = pixbuf.Rowstride;
				int count = pixbuf.Width * nchannels;

				for (int row = 0; row < height; row++) {
					Fill8 (row, 0, src_pixels, row * src_stride, count);
				}
			}
		}
Exemplo n.º 51
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Cms.Model.ProductInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Specifications(");
            strSql.Append("Specifications,TypeId,BrandId,ComoditiesNameId,Description,ImageUrl,SmallImgUrl,Click,IsTop,PubTime)");
            strSql.Append(" values (");
            strSql.Append("@Specifications,@TypeId,@BrandId,@ComoditiesNameId,@Description,@ImageUrl,@SmallImgUrl,@Click,@IsTop,@PubTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Specifications", SqlDbType.NVarChar,50),
                    new SqlParameter("@TypeId", SqlDbType.Int,4),
                    new SqlParameter("@BrandId", SqlDbType.Int,4),
                    new SqlParameter("@ComoditiesNameId", SqlDbType.Int,4),
                    new SqlParameter("@Description", SqlDbType.NText),
                    new SqlParameter("@ImageUrl", SqlDbType.NVarChar,250),
                    new SqlParameter("@SmallImgUrl", SqlDbType.NVarChar,250),
                    new SqlParameter("@Click", SqlDbType.Int,4),
                    new SqlParameter("@IsTop", SqlDbType.Int,4),
                    new SqlParameter("@PubTime", SqlDbType.DateTime)};
            parameters[0].Value = model.Specifications;
            parameters[1].Value = model.TypeId;
            parameters[2].Value = model.BrandId;
            parameters[3].Value = model.NameId;
            parameters[4].Value = model.Description;
            parameters[5].Value = model.ImgUrl;
            parameters[6].Value = model.SmallImgUrl;
            parameters[7].Value = model.Click;
            parameters[8].Value = model.IsTop;
            parameters[9].Value = model.PubTime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 52
0
		private Pixbuf ProcessImpl (Pixbuf input, Cms.Profile input_profile, bool fast) {
			Pixbuf result;
			using (ImageInfo info = new ImageInfo (input)) {
				MemorySurface surface = new MemorySurface (Format.Argb32,
									   input.Width,
									   input.Height);

				Context ctx = new Context (surface);
				ctx.Matrix = info.Fill (info.Bounds, angle);
				SurfacePattern p = new SurfacePattern (info.Surface);
				if (fast) {
					p.Filter =  Filter.Fast;
				}
				ctx.Source = p;
				ctx.Paint ();
				((IDisposable)ctx).Dispose ();
				p.Destroy ();
				result = MemorySurface.CreatePixbuf (surface);
				surface.Flush ();
			}
			return result;
		}
Exemplo n.º 53
0
 private Pixbuf ProcessImpl(Pixbuf input, Cms.Profile input_profile, bool fast)
 {
     Pixbuf result;
     using (ImageInfo info = new ImageInfo (input)) {
         using (MemorySurface surface = new MemorySurface (Format.Argb32,
                                input.Width,
                                input.Height)) {
             using (Context ctx = new Context (surface)) {
                 ctx.Matrix = info.Fill (info.Bounds, angle);
                 using (SurfacePattern p = new SurfacePattern (info.Surface)) {
                     if (fast)
                         p.Filter =  Filter.Fast;
                     ctx.Source = p;
                     ctx.Paint ();
                 }
                 result = MemorySurface.CreatePixbuf (surface);
                 surface.Flush ();
             }
         }
     }
     return result;
 }
Exemplo n.º 54
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Cms.Model.NewsInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into NewsInfo(");
            strSql.Append("Title,Author,ClassId,Content,Click,IsLock,IsTop,PubTime)");
            strSql.Append(" values (");
            strSql.Append("@Title,@Author,@ClassId,@Content,@Click,@IsLock,@IsTop,@PubTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Title", SqlDbType.NVarChar,100),
                    new SqlParameter("@Author", SqlDbType.NVarChar,50),
                    new SqlParameter("@ClassId", SqlDbType.Int,4),
                    new SqlParameter("@Content", SqlDbType.NText),
                    new SqlParameter("@Click", SqlDbType.Int,4),
                    new SqlParameter("@IsLock", SqlDbType.Int,4),
                    new SqlParameter("@IsTop", SqlDbType.Int,4),
                    new SqlParameter("@PubTime", SqlDbType.DateTime)};
            parameters[0].Value = model.Title;
            parameters[1].Value = model.Author;
            parameters[2].Value = model.ClassId;
            parameters[3].Value = model.Content;
            parameters[4].Value = model.Click;
            parameters[5].Value = model.IsLock;
            parameters[6].Value = model.IsTop;
            parameters[7].Value = model.PubTime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 55
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int AddNewsClass(Cms.Model.NewsClass model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into NewsClass(");
            strSql.Append("Title,ClassOrder)");
            strSql.Append(" values (");
            strSql.Append("@Title,@ClassOrder)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Title", SqlDbType.NVarChar,50),
                    new SqlParameter("@ClassOrder", SqlDbType.Int,4)};
            parameters[0].Value = model.Title;
            parameters[1].Value = model.ClassOrder;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 56
0
 protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile)
 {
     return ProcessImpl (input, input_profile, false);
 }
Exemplo n.º 57
0
		public abstract Gdk.Pixbuf ToPixbuf (Cms.Profile profile);
Exemplo n.º 58
0
		public override Gdk.Pixbuf ToPixbuf (Cms.Profile destination_profile)
		{
#if true //USE_LCMS
			profile = Cms.Profile.CreateStandardRgb ();
			Cms.Profile [] list = new Cms.Profile [] { profile, destination_profile };
			Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 
							    width, height);
			
			Cms.Transform t = new Cms.Transform (list,
							     Cms.Format.Rgb16,
							     PixbufUtils.PixbufCmsFormat (pixbuf),
							     Cms.Intent.Perceptual, 0x0);
			
			unsafe {
				fixed (ushort * srcpix  = &data[0]) {
					byte * destpix = (byte *) pixbuf.Pixels;
					
					for (int row = 0; row < height; row++)
						t.Apply ((IntPtr) (srcpix + row * rowstride),
							 (IntPtr) (destpix + row * pixbuf.Rowstride),
							 (uint)width);
				}
			}

			return pixbuf;
#else
			Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 
							    width, height);

			unsafe {
				fixed (ushort * src  = &data[0]) {
					ushort * srcpix = src;
					byte * destpix = (byte *) pixbuf.Pixels;
					
					for (int row = 0; row < height; row++) {
						for (int col = 0; col < width * nchannels; col++)
							destpix [col] = (byte) (srcpix [col] >> 8);
						
						srcpix += rowstride;
						destpix += pixbuf.Rowstride;
					}
				}
			}

			return pixbuf;
#endif
		}
 protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile)
 {
     Pixbuf output = (Pixbuf) input.Clone ();
     return output.Flip (true);
 }
Exemplo n.º 60
0
 protected override Pixbuf ProcessFast(Pixbuf input, Cms.Profile input_profile)
 {
     return ProcessImpl (input, input_profile, true);
 }