/// <summary>
        /// Initializes a new instance of the <see cref="HomeController"/> class.
        /// </summary>
        /// <param name="userDao">The user DAO.</param>
        public HomeController(UsuariosDAO userDao)
        {
            this.usuarioDAO = userDao;

            if (!WebSecurity.Initialized)
            {
                WebSecurity.InitializeDatabaseConnection(ConfigureHelper.Key("connection.connection_string_name")
                                                         , "CadastroDeUsuario", "Id", "Login", true);
            }
        }
Ejemplo n.º 2
0
        public static string JsCssFile(this UrlHelper helper, string path)
        {
            var jsAndCssFileEdition = ConfigureHelper.GetAppSetting("JsAndCssFileEdition");

            if (string.IsNullOrEmpty(jsAndCssFileEdition))
            {
                jsAndCssFileEdition = Guid.NewGuid().ToString();
            }

            path += string.Format("?v={0}", jsAndCssFileEdition);

            return(helper.StaticFile(path));
        }
Ejemplo n.º 3
0
        private void FillDir()
        {
            conf = ConfigureHelper.getInitConfigure();
            cmb_updir.Items.Add("--上级目录--");
            List <ScSystem> upDirDs = new List <ScSystem>();
            ScSystem        ssBlank = new ScSystem();

            ssBlank.Name = "";
            upDirDs.Add(ssBlank);
            foreach (ScSystem ss in conf.SysList)
            {
                if (ss.Pid == "0")
                {
                    upDirDs.Add(ss);
                }
            }

            cmb_updir.DataSource    = upDirDs;
            cmb_updir.DisplayMember = "Name";
            cmb_updir.ValueMember   = "Id";
            cmb_updir.SelectedIndex = 0;
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_name.Text.Trim()))
            {
                MessageBox.Show("网页名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            scs       = new ScSystem();
            scs.Deflt = cb_deflt.Checked ? "Y" : "N";
            if (cb_deflt.Checked)
            {
                foreach (ScSystem ss in conf.SysList)
                {
                    ss.Deflt = "N";
                }
            }
            scs.Name = tb_name.Text.Trim();
            scs.Url  = tb_address.Text.Trim();
            List <ScSystem> ssList = new List <ScSystem>();

            if (cmb_updir.SelectedIndex == 0)
            {
                scs.Id  = Convert.ToString(conf.SysList.Count + 1);
                scs.Pid = "0";
                conf.SysList.Add(scs);
                ssList = conf.SysList;
            }
            else
            {
                string selPid   = (cmb_updir.SelectedItem as ScSystem).Id;
                bool   sFlag    = false;
                int    sysIndex = 1;

                for (int i = 0; i < conf.SysList.Count;)
                {
                    if (conf.SysList[i].Id == selPid)
                    {
                        sFlag = true;
                        conf.SysList[i].Id = Convert.ToString(sysIndex++);
                        ssList.Add(conf.SysList[i]);
                        if (i == conf.SysList.Count - 1)
                        {
                            scs.Id  = Convert.ToString(sysIndex++);
                            scs.Pid = ssList[ssList.Count - 1].Id;
                            ssList.Add(scs);
                        }
                    }
                    else if (sFlag && ((i + 1) >= conf.SysList.Count ? "-1" : conf.SysList[i + 1].Id) != selPid)
                    {
                        scs.Id  = Convert.ToString(sysIndex++);
                        scs.Pid = ssList[ssList.Count - 1].Id;
                        ssList.Add(scs);
                        conf.SysList[i].Id = Convert.ToString(sysIndex++);
                        ssList.Add(conf.SysList[i]);
                        sFlag = false;
                    }
                    else
                    {
                        conf.SysList[i].Id = Convert.ToString(sysIndex++);
                        ssList.Add(conf.SysList[i]);
                    }
                    i++;
                }
            }
            //重置ID

            ConfigureHelper.SaveWebapp(ssList);
            MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据数据库类别获取ConnectionStrings中的数据库连接字符串
        /// </summary>
        /// <returns></returns>
        public static string GetConnStr(DBCatetory category)
        {
            var connName = GetConnName(category);

            return(ConfigureHelper.GetConnStr(connName));
        }