Beispiel #1
0
		protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
		{
			serverConfiguration.AuthenticationMode = "oauth";
			serverConfiguration.AnonymousUserAccessMode = database::Raven.Database.Server.AnonymousUserAccessMode.None;

			serverConfiguration.Catalog.Catalogs.Add(new AssemblyCatalog(typeof(AuthenticationUser).Assembly));
		}
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            string dob = null;
            database q = new database();
            DataTable t,d;
            t = q.select("select name,email from reg_login where email='" + Session["emailID"].ToString().Trim() + "'");
            d = q.select("select *from detail where email='" + Session["emailID"].ToString().Trim() + "'");
            if (t.Rows.Count > 0)
            {
                txtname.Text = t.Rows[0][0].ToString();
                 txtemail.Text = t.Rows[0][1].ToString();
                 if (d.Rows[0][1].ToString() == "Male")
                     Male.Checked = true;
                 if (d.Rows[0][1].ToString() == "Female")
                   Female.Checked = true;
                   txtadd.Text = d.Rows[0][2].ToString();
                 txtstate.Text = d.Rows[0][3].ToString();
                 txtcity.Text = d.Rows[0][4].ToString();
                 txtpin.Text = d.Rows[0][5].ToString();
                 txtmobile.Text = d.Rows[0][6].ToString();
            }
        }
    }
Beispiel #3
0
    public static void add_ipAddress(string ip, string name)
    {
        database Database = new database();

        Database.open_connection();
        Database.insert_datbase_ip_connection(ip, name);
        Database.close_connection();
    }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            database da = new database();
            int      j  = da.getLastEmpId();
            int      k  = da.getEmppass(j);

            da.insertInUserTable(j, k, "Employee");
        }
Beispiel #5
0
    public static void session_connection(string id, bool status)
    {
        database _database_ = new database();

        _database_.open_connection();
        _database_.update_datebase_session_connection(id, status);
        _database_.close_connection();
    }
Beispiel #6
0
        private void showUserInfo(object sender, EventArgs e)
        {
            database  db    = new database();
            string    query = "select * from userinfo where name = '" + username + "'";
            DataTable dt    = db.Table(query);

            new adminShowUserInfo(0, dt).ShowDialog();
        }
Beispiel #7
0
        public Filter(Appointments appForm)
        {
            InitializeComponent();
            dbConn       = new database();
            this.appForm = appForm;

            scheduledMin = Convert.ToDateTime(schedule_datetime1.Value);
        }
Beispiel #8
0
        //var model1 = (Employee)TempData["data"];
        //    return View(model1);


        public IEnumerable <SelectListItem> GetStates()
        {
            List <SelectListItem> states = new List <SelectListItem>();
            string   query = "select * from dbo.States";
            database ob2   = new database();

            return(ob2.dbState(query));
        }
        private ResultSet getRowsTableSP(database db, string Padre = "", string IDCta = "")
        {
            String sql = "SELECT * FROM VESTADO_CUENTA_PENSIONADOS where PADRE = " + Padre + " and ID_ESTADODECUENTA = " + IDCta;

            sql += " ORDER BY ID_CTAPENSIONADO ";

            return(db.getTable(sql));
        }
        private ResultSet getRowsTableH(database db, string IDCta = "")
        {
            String sql = "SELECT * FROM VESTADO_CUENTA where PADRE = " + IDCta;

            sql += " ORDER BY FECHAPAGO ";

            return(db.getTable(sql));
        }
Beispiel #11
0
        public static void Delete(string id)
        {
            database db = new database();

            db.AddParameter("@DesigId", id);
            db.AddParameter("@QryType", "D");
            db.ExecuteSP("DesigProc");
        }
Beispiel #12
0
        public static object GetDesignationTypeID(string DesignCode)
        {
            database db = new database();

            db.AddParameter("@DesignationCode", DesignCode);
            db.AddParameter("@QryType", "G");
            return(db.GetDataValue("DesigCode"));
        }
Beispiel #13
0
    public static void update_table_ip(string[] befor, string[] after)
    {
        database _database_ = new database();

        _database_.open_connection();
        _database_.update_table_ip(befor, after);
        _database_.close_connection();
    }
Beispiel #14
0
 public validarusuario(string f)
 {
     InitializeComponent();
     guia  = true;
     folio = f;
     db    = new database();
     ValidateUser();
 }
Beispiel #15
0
 public Corte_de_Caja()
 {
     InitializeComponent();
     db = new database();
     CultureInfo.GetCultureInfo("es-MX");
     timer1.Interval = 1;
     timer1.Start();
 }
Beispiel #16
0
        private void employeeTableDataGridView_Enter(object sender, EventArgs e)
        {
            database da = new database();
            int      j  = da.getLastEmpId();
            int      k  = da.getEmppass(j);

            da.insertInUserTable(j, k, "Employee");
        }
        public override global::System.Data.DataSet Clone()
        {
            database cln = ((database)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Beispiel #18
0
    public static void update_table_properties(int[] befor, int[] after)
    {
        database _database_ = new database();

        _database_.open_connection();
        _database_.update_table_properties(befor, after);
        _database_.close_connection();
    }
Beispiel #19
0
 public Login()
 {
     InitializeComponent();
     LoginUsuario.Focus();
     groupBoxusuario.Visible = true;
     db = new database();
     progressBar1.Visible = false;
 }
Beispiel #20
0
        private void btnDatosCPActBuscar_Click(object sender, EventArgs e)
        {
            database datos = new database();
            string   tipoBusqueda = "", parametroBusqueda = "", valorParametroBusqueda = "";

            try
            {
                if (rbDatosCPActualizarClientes.Checked == true)
                {
                    tipoBusqueda = rbDatosCPActualizarClientes.Text;
                    tipo         = tipoBusqueda;
                    if (rbDatosCPActualizarTodos.Checked == true)
                    {
                        parametroBusqueda = rbDatosCPActualizarTodos.Text;
                    }
                    else if (rbDatosCPActualizarRFC.Checked == true)
                    {
                        parametroBusqueda = rbDatosCPActualizarRFC.Text; valorParametroBusqueda = txtDatosCPActRFC.Text;
                    }
                    else if (rbDatosCPActualizarNombre.Checked == true)
                    {
                        parametroBusqueda = rbDatosCPActualizarNombre.Text; valorParametroBusqueda = txtDatosCPActNombre.Text;
                    }
                    else
                    {
                    }
                }
                else if (rbDatosCPActualizarProvedores.Checked == true)
                {
                    tipoBusqueda = rbDatosCPActualizarProvedores.Text;
                    tipo         = tipoBusqueda;
                    if (rbDatosCPActualizarTodos.Checked == true)
                    {
                        parametroBusqueda = rbDatosCPActualizarTodos.Text;
                    }
                    else if (rbDatosCPActualizarRFC.Checked == true)
                    {
                        parametroBusqueda = rbDatosCPActualizarRFC.Text; valorParametroBusqueda = txtDatosCPActRFC.Text;
                    }
                    else if (rbDatosCPActualizarNombre.Checked == true)
                    {
                        parametroBusqueda = rbDatosCPActualizarNombre.Text; valorParametroBusqueda = txtDatosCPActNombre.Text;
                    }
                    else
                    {
                    }
                }
                else
                {
                    MessageBox.Show("Parametros de busqueda no valido");
                }
                dgvActualizar.DataSource = datos.listaCP(tipoBusqueda, parametroBusqueda, valorParametroBusqueda);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #21
0
        public sFormModels GetRestartModels(dFormData dFormData, string cuurip)
        {
            database       database    = new database();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
            dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
            if (database.checkActiveSql("mssql", "flyformstring", "exec web.deletefilldeta @formId,@inoper;", dbparamlist) != "istrue")
            {
                return(new sFormModels()
                {
                    status = "error"
                });
            }
            DataTable mainRows = new DataTable();

            mainRows = database.checkSelectSql("mssql", "flyformstring", "exec web.searchmaindeta @formId,@inoper;", dbparamlist);
            switch (mainRows.Rows.Count)
            {
            case 0:
                return(new sFormModels()
                {
                    status = "nodata"
                });
            }
            int i = 1;

            dbparamlist.Add(new dbparam("@random", mainRows.Rows[0]["randsub"].ToString().TrimEnd()));
            dbparamlist.Add(new dbparam("@number", mainRows.Rows[0]["number"].ToString().TrimEnd()));
            dbparamlist.Add(new dbparam("@finish", mainRows.Rows[0]["finish"].ToString().TrimEnd()));
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            foreach (DataRow dr in database.checkSelectSql("mssql", "flyformstring", "exec web.searchsubdeta @formId,@inoper,@random,@number,@finish;", dbparamlist).Rows)
            {
                dbparamlist.Clear();
                dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
                dbparamlist.Add(new dbparam("@iid", int.Parse(dr["iid"].ToString().TrimEnd())));
                dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
                dbparamlist.Add(new dbparam("@random", mainRows.Rows[0]["randopt"].ToString().TrimEnd()));
                List <Dictionary <string, object> > answeritems = new List <Dictionary <string, object> >();
                foreach (DataRow drs in database.checkSelectSql("mssql", "flyformstring", "exec web.searchoptiondeta @formId,@iid,@inoper,@random;", dbparamlist).Rows)
                {
                    answeritems.Add(new Dictionary <string, object>()
                    {
                        { "id", drs["id"].ToString().TrimEnd() }, { "values", drs["value"].ToString().TrimEnd() }, { "showAnswer", drs["answer"].ToString().TrimEnd() == "1" }, { "showRight", drs["right"].ToString().TrimEnd() == "1" }
                    });
                }
                items.Add(new Dictionary <string, object>()
                {
                    { "iid", dr["iid"].ToString().TrimEnd() }, { "title", $"{i}.{dr["tile"].ToString().TrimEnd()}" }, { "showVeri", dr["verified"].ToString().TrimEnd() == "1" }, { "showDrop", false }, { "showFile", false }, { "outValue", dr["outValue"].ToString().TrimEnd() }, { "value", dr["value"].ToString().TrimEnd() }, { "showMenu", false }, { "type_", dr["type"].ToString().TrimEnd() }, { "operation", dr["operation"].ToString().TrimEnd() }, { "area", dr["area"].ToString().TrimEnd() }, { "eror", dr["eror"].ToString().TrimEnd() }, { "showCheck", dr["checked"].ToString().TrimEnd() == "1" }, { "answeritems", answeritems.ToArray() }
                });
                i++;
            }
            return(new sFormModels()
            {
                formId = mainRows.Rows[0]["formId"].ToString().TrimEnd(), tile = mainRows.Rows[0]["tile"].ToString().TrimEnd(), desc = mainRows.Rows[0]["desc"].ToString().TrimEnd(), exam = mainRows.Rows[0]["examed"].ToString().TrimEnd() == "1", restart = mainRows.Rows[0]["restarted"].ToString().TrimEnd() == "1", finish = mainRows.Rows[0]["finish"].ToString().TrimEnd() == "1", score = $"{mainRows.Rows[0]["score"].ToString().TrimEnd()}分", items = items, status = "istrue"
            });
        }
Beispiel #22
0
        public static routine addSpecificCourse(string cid)
        {
            database db = new database();
            routine  r  = new routine();

            r.courses = new List <course>();
            string query = "select * from timing where cid = " + cid;
            course c;

            c.slots = new List <coursetime>();
            coursetime t  = new coursetime();
            DataTable  dt = db.Table(query);
            bool       isMatch;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                isMatch = false;
                c       = new course();
                t.day   = dt.Rows[i]["day"].ToString();
                t.start = DateTime.Parse(dt.Rows[i]["start"].ToString());
                t.end   = DateTime.Parse(dt.Rows[i]["endt"].ToString());

                string AMPM;
                if (t.start.Hour >= 1 && t.start.Hour <= 3)
                {
                    AMPM    = t.start.ToString();
                    AMPM    = AMPM.Remove(AMPM.Length - 2, 2);
                    AMPM   += "PM";
                    t.start = DateTime.Parse(AMPM);
                }
                if (t.end.Hour >= 1 && t.end.Hour <= 5)
                {
                    AMPM  = t.end.ToString();
                    AMPM  = AMPM.Remove(AMPM.Length - 2, 2);
                    AMPM += "PM";
                    t.end = DateTime.Parse(AMPM);
                }

                for (int j = 0; j < r.courses.Count; j++)
                {
                    if (dt.Rows[i]["sec"].ToString() == r.courses[j].section)
                    {
                        isMatch = true;
                        r.courses[j].slots.Add(t);
                        break;
                    }
                }
                if (isMatch == false)
                {
                    c.slots   = new List <coursetime>();
                    c.name    = dt.Rows[i]["cname"].ToString();
                    c.section = dt.Rows[i]["sec"].ToString();
                    c.slots.Add(t);
                    r.courses.Add(c);
                }
            }
            return(r);
        }
        /// <summary>
        /// Función que revisa trae un colaborador por su clave.
        /// </summary>
        /// <param name="clave">Clave del colaborador que se desea revisar</param>
        /// <returns>Objeto Colaborador con los datos personales </returns>
        public static Colaborador ObtienePorClave(long clave)
        {
            Colaborador persona = null;

            /* Solo se permite el acceso a personas que tengan fuentas de correo terminadas en "@anahuac.mx" */
            database db = new database();

            /* Buscamos al colaborador para revisar que este registrado como un colaborador en el sorteo activo actual */
            ResultSet dbPersona = db.getTable(String.Format(@"
SELECT top 1 C.CLAVE, C.NOMBRE, C.APATERNO, C.AMATERNO, c.CORREO_P, S.CUENTA, SE.PK_SORTEO
FROM COLABORADORES_ASIGNACION CA, 
SECTORES SE, 
SORTEOS S,
COLABORADORES C
WHERE CA.PK_SECTOR=SE.PK1 
AND SE.PK_SORTEO=S.PK1 
AND S.ACTIVO = 1
AND CA.PK_COLABORADOR = {0}
AND C.CORREO_P LIKE '*****@*****.**'", clave));

            long sorteo_colab = -1;

            // Si existe la persona con correo anahuac, entonces extraemos sus datos
            if (dbPersona.Next())
            {
                persona = new Colaborador()
                {
                    clave               = clave,
                    identificador       = dbPersona.Get("CLAVE"),
                    nombre              = dbPersona.Get("NOMBRE"),
                    apellido_paterno    = dbPersona.Get("APATERNO"),
                    apellido_materno    = dbPersona.Get("AMATERNO"),
                    correo              = dbPersona.Get("CORREO_P").ToLower(),
                    referencia_bancaria = dbPersona.Get("CUENTA")
                };
                sorteo_colab = dbPersona.GetLong("PK_SORTEO");
            }

            /* Si la persona existe, obtenemos los datos del estado de cuenta */
            if (persona != null)
            {
                ResultSet dbEdoCuenta = db.getTable(String.Format(@"
SELECT TOP 1 IMPORTE, ABONO, SALDO
FROM vESTADO_CUENTA_COLABORADOR edo
WHERE edo.PK_COLABORADOR = {0}", clave));

                /* Si encontramos datos, entonces extraemos la información del estado de cuenta */
                if (dbEdoCuenta.Next())
                {
                    persona.monto_total   = dbEdoCuenta.GetDecimal("IMPORTE");
                    persona.monto_abonado = dbEdoCuenta.GetDecimal("ABONO");
                    persona.monto_deudor  = dbEdoCuenta.GetDecimal("SALDO");
                }
            }
            ;

            return(persona);
        }
Beispiel #24
0
    public static void delete_session_time(string id)
    {
        database     Database    = new database();
        current_user CurrentUser = new current_user(id);

        Database.open_connection();
        Database.delete_datebase("user_session", "where user_id='" + id + "' and start_status='0'");
        Database.close_connection();
    }
Beispiel #25
0
 public validarchofer(string fol)
 {
     InitializeComponent();
     timer2.Enabled = true;
     db             = new database();
     folioguia      = fol;
     ValidateUserGUIA();
     reporte = true;
 }
Beispiel #26
0
    private static void save_session_time(int count_sec, string id)
    {
        database     Database    = new database();
        current_user CurrentUser = new current_user(id);

        Database.open_connection();
        Database.update_datebase_session_time_count(count_sec, CurrentUser);
        Database.close_connection();
    }
Beispiel #27
0
        private void button4_Click(object sender, EventArgs e)
        {
            DataTable dk = new DataTable();
            database  dt = new database();
            int       k  = Convert.ToInt32(textBox3.Text.ToString());

            dk = dt.getProductData(k);
            dataGridView2.DataSource = dk;
        }
        private string createTree(string nivel, string name, SessionDB sesion)
        {
            database db = new database();

            String menu = "<ul id=\"" + name + "\">";

            String sql = "SELECT PK1, NOMBRE, PADRE,DISPONIBLE FROM JERARQUIAS WHERE PADRE = '" + nivel + "' ORDER BY ORDEN";

            //SqlDataReader res = db.getRows(sql);
            ResultSet res = db.getTable(sql);

            //if (res.HasRows)
            /* */
            {
                while (res.Next())
                {
                    // Abrimos el nodo con el nombre del primer dependiente
                    // Utilizaremos esta variable para ver si seguimos consultado la BDD
                    int    tiene_dependientes = 0;
                    string pk1 = res.Get("PK1");

                    String sqlchild        = "SELECT * FROM JERARQUIAS WHERE PADRE = '" + pk1 + "'";
                    String numrowssqlchild = "SELECT COUNT(PK1) AS 'MAX' FROM JERARQUIAS WHERE PADRE = '" + pk1 + "'";
                    tiene_dependientes = sesion.db.Count(numrowssqlchild);

                    /*
                     * if (tiene_dependientes > 0) { urlweb = "javascript:;"; }
                     * else { bullet = ""; classstyle = ""; classstyleactive = " class=\"active\" "; }*/

                    //Validamos si tiene permiso
                    //sesion.permisos.havePermission(res.GetInt("PK_PERMISO")) || res.GetInt("PK_PERMISO") == 0
                    if (true)
                    {
                        menu += "<li ";
                        menu += "><a href=\" \">" + res.Get("NOMBRE") + "</a>";
                    }

                    // Si tiene dependientes, ejecutamos recursivamente
                    // tomando como parámetro el nuevo nivel
                    if (tiene_dependientes > 0)
                    {
                        //if(idmenu==Integer.valueOf(rs.getString("PK1"))){
                        menu += this.createTree(res.Get("PK1"), " ", sesion);

                        //}
                    }

                    // Cerramos el nodo
                    menu += "</li>";
                }
            }

            // Cerramos la lista
            menu += "</ul>";

            return(menu);
        }
 void Start()
 {
     sensor = SensorsComponent.SensorFactory.GetInstance(currentSensor, robotPrefab);
     createMaze.onClick.AddListener(createMazeButtonListener);
     expDB = new database();
     manualButton.onClick.AddListener(manualButtonListener);
     automaticButton.onClick.AddListener(automaticButtonListener);
     backButton.interactable = false;
 }
Beispiel #30
0
        public IActionResult country(string countryName)
        {
            ViewBag.country = countryName;
            try
            {
                ViewBag.countryExists = "true";
                database db = new database(database.maindb);
                db.AddParam("?country", countryName);
                MySqlDataReader rd = db.ExecuteReader("select * from countries where lower(country)=lower(?country)");
                if (!rd.HasRows)
                {
                    ViewBag.climate    = "N.A.";
                    ViewBag.death_rate = "N.A.";
                    ViewBag.obesity    = "N.A.";
                }

                while (rd.Read())
                {
                    ViewBag.climate = rd.GetString("climate");
                    double death_rate = rd.GetDouble("death_rate");
                    if (death_rate == 0)
                    {
                        ViewBag.death_rate = "N.A.";
                    }
                    else
                    {
                        ViewBag.death_rate = death_rate;
                    }
                    double obesity = rd.GetDouble("obesity");
                    if (obesity == 0)
                    {
                        ViewBag.obesity = "N.A.";
                    }
                    else
                    {
                        ViewBag.obesity = obesity;
                    }
                }
                Dictionary <string, Country> cslist = new Countries().getDictionar();
                ViewBag.code = "";
                try
                {
                    ViewBag.code = cslist[countryName].Code;
                }
                catch { }
            }
            catch { }
            ViewBag.nr = 0;
            try
            {
                ObjectResult obj = (ObjectResult) new MeAd.Raml.SearchController().Get(countryName);
                Dictionary <string, Countries.CountryDiseases> countryDiseases = (Dictionary <string, Countries.CountryDiseases>)obj.Value;
                ViewBag.countryDiseases = countryDiseases;
            }
            catch { }
            return(View());
        }
Beispiel #31
0
        public static List <Curso> GetCurso()
        {
            database db    = getDataBase();
            var      query = from c in db.Curso select c;

            List <Curso> curso = new List <Curso>(query.AsEnumerable());

            return(curso);
        }
Beispiel #32
0
        public static void DropCurso()
        {
            database db = getDataBase();

            if (db.DatabaseExists() == true)
            {
                db.DeleteDatabase();
            }
        }
Beispiel #33
0
    //==========================================================================
    public static void Main(string[] astrArg)
    {
        ContextMenu cm;
        MenuItem miCurr;
        int iIndex = 0;
        string status = "running";

        // Kontextmenü erzeugen
        cm = new ContextMenu();

        // Kontextmenüeinträge erzeugen
        miCurr = new MenuItem();
        miCurr.Index = iIndex++;
        miCurr.Text = "&Aktion 1";           // Eigenen Text einsetzen
        miCurr.Click += new System.EventHandler(Action1Click);
        cm.MenuItems.Add(miCurr);

        // Kontextmenüeinträge erzeugen
        miCurr = new MenuItem();
        miCurr.Index = iIndex++;
        miCurr.Text = "&Beenden";
        miCurr.Click += new System.EventHandler(ExitClick);
        cm.MenuItems.Add(miCurr);

        // NotifyIcon selbst erzeugen
        notico = new NotifyIcon();
        notico.Icon = new Icon("git.ico"); // Eigenes Icon einsetzen
        notico.Text = "OVEye-Server | "+ status;   // Eigenen Text einsetzen
        notico.Visible = true;
        notico.ContextMenu = cm;
        



        Console.WriteLine("Erstelle Server");

        Server x = new Server();
        database y = new database();
        //Erstellt
        Thread prüfen = new Thread(delegate() { y.renewActiveConnections(x.clientList); });

        // Ohne Appplication.Run geht es nicht
        Application.Run();

            

      



    }
Beispiel #34
0
    protected void btn_clk(object sender, EventArgs e)
    {
        string password;
        DataTable t;
        database q = new database();
        t = q.select("select *from reg_login where email ='" + txtemail.Text.ToString().Trim() + "'");
          if(t.Rows.Count>0)
          {
          password = t.Rows[0][1].ToString();
        if (password == txtpassword.Text)
        {
            Session["Email"] = txtemail.Text;

            Response.Redirect("home.aspx");
        }
        else
            txtemail.Text = " invalid password";
        }
        else
          txtpassword.Text = "Invalid user name";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        myDB = (database)Session["myDB"];
        curUser = (user)Session["curUser"];
        designUser = (user)Session["designUser"];
        userInfoColl = myDB.getUserInfoCollection();

        if (designUser != null)
        {
            usersBoardColl = myDB.getUsersBoardCollection(designUser);
        }
        if (curUser.Account_Type == "client")
        {
            boardPnl.Visible = true;
            usersBoardColl = myDB.getUsersBoardCollection(curUser);
            board_item.loadBoards(usersBoardColl, boardNameList);
        }
        else if (curUser.Account_Type == "designer")
        {
            designerPnl.Visible = true;
            switchUserBtn.Visible = true;
            user.loadUsers(userInfoColl, designerUserList, curUser);
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     myDB = (database)Session["myDB"];
     userInfoColl = myDB.getUserInfoCollection();
 }
Beispiel #37
0
 protected void Page_Load(object sender, EventArgs e)
 {
     i = (int)Session["i"];
     el = (elements)Session["el"];
     myDB = (database)Session["myDB"];
     curUser = (user)Session["curUser"];
     boardName = (string)Session["boardName"];
     queryItems = (List<product_image>)Session["queryItems"];
     usersBoardColl = myDB.getUsersBoardCollection(curUser);
     p = (product_image)Session["p"];
     setImage(p);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     allItems = (List<product_image>)Session["allItems"];
     myDB = (database)Session["myDB"];
     myDB.retrieveImagesCollection();
     imgColl = myDB.getImagesCollection();
     elements.loadElements(imgColl, colorList, lineList, lightList, formList, spaceList, textureList, patternList, massList, balanceList, unityList, harmonyList, rhythmList, proportionList, varietyList, emphasisList, scaleList, typeList);
 }
Beispiel #39
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ddlDnsTypelist.SelectedValue.Trim().Equals("6"))
        {
            DB = new dbDns("dns");
        }
        else
        {
            DB = new dbDns("dnsalarm");
        }

        if (!IsPostBack)
        {
            initDnsTypeList();
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "木马查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }

            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    if (selectedCount == 0)  //防止只选一个站点时,出现在,1的情况 查询报错
                    {
                        sParent = li.Value;
                    }
                    else
                    {
                        sParent += "," + li.Value + "";
                    }

                    selectedCount++;
                }
            }

            if (selectedCount <= 0)//tedi3231 added 2010.02.01 没有选中任何站点时显示用户能看到的所有站点
            {
                sParent = common.GetHosrList(User.Identity.Name);
            }

            Condition += " and nParent in (" + sParent + ")";

            if (txtvDstIp.Text.ToString() != "")//数据库中为numeric 类型,因而需要先将值转化为数字类型
                Condition += " and vDstIp = dmc_config.dbo.f_IP2Int('" + txtvDstIp.Text.ToString() + "')";

            if (txtvDstMac.Text.ToString() != "")
                Condition += " and vDstMac ='" + txtvDstMac.Text.ToString() + "' ";

            if (txtvAddr.Text.ToString() != "")//数据库中为numeric 类型,因而需要先将值转化为数字类型
                Condition += " and vAddr = dmc_config.dbo.f_IP2Int('" + txtvAddr.Text.ToString() + "') ";

            if (txtvName.Text.ToString() != "")
            {
                if (fromeq.Checked)
                    Condition += " and vName = '" + txtvName.Text.ToString() + "'";
                else
                    Condition += " and vName like '%" + txtvName.Text.ToString() + "%'";
            }

            //用户IP
            if (!string.IsNullOrEmpty(tbUserIp.Text))
            {
                Condition += " and vSrcIp = dmc_config.dbo.f_IP2Int('" + tbUserIp.Text.ToString() + "') ";
            }

            //用户MAC
            if (!string.IsNullOrEmpty(tbUserMac.Text))
            {
                Condition += " and vSrcMac= '" + tbUserMac.Text.ToString() + "' ";
            }

            // 是否静默
            if (this.ddlStateFlag.SelectedValue.Trim() == "0")
            {
                Condition += " and vStateFlag = 0 ";
            }
            else if (this.ddlStateFlag.SelectedValue.Trim() == "1")
            {
                 Condition += " and vStateFlag = 1 ";
            }

            //域名类型
            string typeval = ddlDnsTypelist.SelectedValue.Trim();

            if (!string.IsNullOrEmpty(typeval) && typeval != "-1")
            {
                if (typeval == "0") // 如果为所有黑名单,则显示黑名单的三种类别
                {
                    Condition += " and (vType=7 or vType=8 or vType=9 ) ";
                }
                else if (typeval == "10")
                {
                    Condition += " and (vType=3 or vType=4 or vType=5 ) ";
                }
                else if (typeval == "11") //其他域名 可疑域名 所有异常域名
                {
                    Condition += " and (vType=2 or vType=3 or vType=4 or vType=5 ) ";
                }
                else
                {
                    Condition += " and vType = " + typeval + " ";
                }
            }

            //ip归属地查询
            if (ddlIpList.SelectedValue.Trim() != "-1")
            {
                Condition += " and ipnum = " + ddlIpList.SelectedValue.Trim();
            }

            int senstive = common.GetSenstiveCheck(this.CheckBoxList2);

            if (senstive > 0)
                Condition += " and ( (nKey & " + senstive + ")>0 ) ";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
                Condition = Condition.Substring(5);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        _RecordCount = Convert.ToInt32(lblRecordCount.Text);
        _PageCount = _RecordCount / _PageSize;
        if (_RecordCount % _PageSize > 0) _PageCount++;
        _PageIndex = Convert.ToInt32(lblPageIndex.Text);
        int selectedCount = 0;

        string sParent = "'0'";
        DB = CreateDataBase(this.DropDownList1.SelectedValue.Trim());

        if (!IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "网站查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }

            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    sParent += "," + li.Value + "";
                    selectedCount++;
                }
            }

            //tedi3231 added 2010.02.01 没有选中任何站点时显示用户能看到的所有站点
            if (sParent.Length <= 3)
            {
                sParent = common.GetHosrList(User.Identity.Name);
            }

            if (selectedCount < cblHost.Items.Count)
                Condition += " and nParent in (" + sParent + ")";
            if (txtSrcAddr.Text.ToString() != "")
                Condition += " and vSrcAddr = dmc_config.dbo.[f_IP2int]('" + txtSrcAddr.Text.ToString() + "')";
            if (txtSrcMac.Text.ToString() != "")
                Condition += " and vSrcMac = '" + txtSrcMac.Text.ToString() + "'";

            int senstive = GetSenstiveCheck();

            if( senstive> 0 )
                Condition += " and ( (nKey & " + senstive+ ")>0 ) ";
            //if (txtWeburl.Text.ToString() != "")
            //{
            //    if (weburleq.Checked)
            //        Condition += " and vURL = '" + txtWeburl.Text.ToString() + "'";
            //    else
            //        Condition += " and vURL like '%" + txtWeburl.Text.ToString().Trim() + "%'";
            //}
            //if (txtWebIP.Text.ToString() != "")
            //    Condition += " and vDstAddr = dmc_config.dbo.[f_IP2int]('" + txtWebIP.Text.ToString() + "')";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
                Condition = Condition.Substring(5);
        }
    }
		protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
		{
			serverConfiguration.RunInMemory = false;
			serverConfiguration.DefaultStorageTypeName = "esent";
		}
        public string getUpdateSqlCode(int row, database.Preferences.MySQLRow mysqlRow, MySqlConnection connection)
        {
            setDefaultItemValues(row);
            ItemTemplates.ItemTemplateRow tempRow = (ItemTemplates.ItemTemplateRow)this.ItemTemplate.Rows[row];
            System.Data.DataTable columnsTable = new System.Data.DataTable();

            //automatic detection
            if (mysqlRow.cellDetection == true && connection != null)
            {
                try
                {
                    connection.Open();
                    string SQL = "SHOW COLUMNS FROM " + mysqlRow.ItemTemplateTable;

                    MySqlCommand cmd = new MySqlCommand(SQL, connection);
                    MySqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        columnsTable.Columns.Add(reader.GetString(0));
                    }
                }
                catch (MySqlException ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                    columnsTable = this.ItemTemplate;
                }
                finally
                {
                    connection.Close();
                }
            }
            else
            {
                columnsTable = this.ItemTemplate.Clone();

                if (mysqlRow.ArtiID == false) columnsTable.Columns.Remove("ArtiID");
            }

            string dataSQL = "";
            bool insertedData = false;

            string sqlCodeRaw = "";
            int i = 0;
            foreach (System.Data.DataColumn column in columnsTable.Columns)
            {
                if (this.ItemTemplate.Columns.Contains(column.ColumnName))
                {
                    if (sqlCodeRaw != "") sqlCodeRaw += ", ";
                    sqlCodeRaw += "`" + column.ColumnName + "` = @value"+i;
                }
                i++;
            }
            string sqlCode = "UPDATE " + mysqlRow.ItemTemplateTable + " SET " + sqlCodeRaw;

            MySqlCommand c = new MySqlCommand(sqlCode);
            i = 0;
            foreach (System.Data.DataColumn column in columnsTable.Columns)
            {
                if (this.ItemTemplate.Columns.Contains(column.ColumnName))
                {
                    object value = tempRow[column.ColumnName];
                    c.Parameters.AddWithValue("value" + i, value);
                }
                i++;
            }

            foreach (System.Data.DataColumn column in columnsTable.Columns)
            {
                if (this.ItemTemplate.Columns.Contains(column.ColumnName))
                {
                    if (column.Unique == false && column.ColumnName != "ItemTemplate_ID")
                    {
                        if (tempRow.IsNull(column.ColumnName))
                        {
                            if (insertedData != false) dataSQL += ", ";
                            else insertedData = true;
                            dataSQL += "`" + column.ColumnName + "` = NULL";
                            break;
                        }
                        else {

                            object value = tempRow[column.ColumnName];
                        //if (value.GetType() != System.DBNull.Value.GetType())
                        //{
                            //Alle Spalten die einen Wert enthalten werdne in der SQL aufgelistet, um NULL-Werte automatisch setzen zu können
                            //columnsSQL

                            switch (value.GetType().ToString())
                            {
                                case "System.String":
                                    {
                                        if (insertedData != false) dataSQL += ", ";
                                        else insertedData = true;
                                        dataSQL += "`" + column.ColumnName + "` = '" + this.escapeString(value.ToString()) + "'";
                                        break;
                                    }
                                case "System.Boolean":
                                    {
                                        if (insertedData != false) dataSQL += ", ";
                                        else insertedData = true;

                                        if ((bool)value == true) dataSQL += "`" + column.ColumnName + "` = 1";
                                        else dataSQL += "`" + column.ColumnName + "` = 0";
                                        break;
                                    }
                                case "System.DBNull":
                                    {
                                        if (insertedData != false) dataSQL += ", ";
                                        else insertedData = true;
                                        dataSQL += "`" + column.ColumnName + "` = NULL";
                                        break;
                                    }
                                default:
                                    {
                                        if (insertedData != false) dataSQL += ", ";
                                        else insertedData = true;
                                        dataSQL += "`" + column.ColumnName + "` = " + value.ToString();
                                        break;
                                    }
                            }
                        }
                    }
                }
            }

            string code;
            code = "UPDATE " + mysqlRow.ItemTemplateTable + " SET " + dataSQL + " WHERE `Id_nb` = '" + tempRow.Id_nb + "' LIMIT 1";

            return code;
        }
		protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
		{
			serverConfiguration.AnonymousUserAccessMode = database::Raven.Database.Server.AnonymousUserAccessMode.None;
			database::Raven.Database.Server.Security.Authentication.EnableOnce();
		}
    protected void Page_Load(object sender, EventArgs e)
    {
        myDB = (database)Session["myDB"];
        curUser = (user)Session["curUser"];
        designUser = (user)Session["designUser"];
        userInfoColl = myDB.getUserInfoCollection();
        imgColl = myDB.getImagesCollection();
        allItems = product_image.getItems(imgColl);
        Session["imgColl"] = imgColl;
        Session["allItems"] = allItems;

        elements.loadElements(imgColl, colorList, lineList, lightList, formList, spaceList, textureList, patternList, massList, balanceList, unityList, harmonyList, rhythmList, proportionList, varietyList, emphasisList, scaleList, typeList);
        if (curUser.Account_Type == "client")
        {
            boardPnl.Visible = true;
            usersBoardColl = myDB.getUsersBoardCollection(curUser);
            board_item.loadBoards(usersBoardColl, boardNameList);
        }
        else if (curUser.Account_Type == "designer")
        {
            designerPnl.Visible = true;
            user.loadUsers(userInfoColl, designerUserList, curUser);
        }
    }
    private void BinddtgData(string TableType)
    {
        DB = CreateDataBase(this.DropDownList1.SelectedValue.Trim());

        if (_PageIndex < 1) _PageIndex = 1;
        _RecordCount = DB.getCount(qrytypelist.SelectedItem.Value, Condition);
        if (_RecordCount > 0)
        {
            _PageCount = _RecordCount / _PageSize;
            if (_RecordCount % _PageSize > 0) _PageCount++;
        }
        DataSet ds = DB.RunProcedure(TableType, _PageSize, _PageIndex, "Asc", Condition);

        dtgData.DataSource = ds.Tables[0].DefaultView;
        dtgData.DataBind();
        ViewState["ds"] = ds;

        lblRecordCount.Text = _RecordCount.ToString();
        lblPageCount.Text = _PageCount.ToString();
        lblPageIndex.Text = _PageIndex.ToString();

        if (_PageIndex > 1)
            lnkPrev.Visible = true;
        else
            lnkPrev.Visible = false;
        if (_PageIndex < _PageCount)
            lnkNext.Visible = true;
        else
            lnkNext.Visible = false;
        BindlsbPage(_PageCount, _PageIndex);
    }
Beispiel #46
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _RecordCount = Convert.ToInt32(lblRecordCount.Text);
        _PageCount = _RecordCount / _PageSize;
        if (_RecordCount % _PageSize > 0) _PageCount++;
        _PageIndex = Convert.ToInt32(lblPageIndex.Text);
        int selectedCount = 0;

        string sParent = "0";
        if (rdlCategory.SelectedValue == "mail_box")
            DB = new dbMailBox(rdlMailType.SelectedValue);
        else
        {
            if (rdlMailType.SelectedValue == "Pop")
                DB = new dbMailSite("Get");
            else
                DB = new dbMailSite("Send");
        }
        if (!IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "邮件查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }
            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    sParent += "," + li.Value + "";
                    selectedCount++;
                }
            }
            if (selectedCount < cblHost.Items.Count)
                Condition += " and nParent in (" + sParent + ")";
            if (txtSrcAddr.Text.ToString() != "")
                Condition += " and vSrcAddr = dmc_config.dbo.[f_IP2int]('" + txtSrcAddr.Text.ToString() + "')";
            if (txtSrcMac.Text.ToString() != "")
                Condition += " and vSrcMac = dmc_config.dbo.[f_IP2int]('" + txtSrcMac.Text.ToString() + "')";
            if (txtDstAddr.Text.ToString() != "")
                Condition += " and vDstAddr = dmc_config.dbo.[f_IP2int]('" + txtDstAddr.Text.ToString() + "')";
            if (txtDstMac.Text.ToString() != "")
                Condition += " and vDstMac = '" + txtDstMac.Text.ToString() + "'";
            if (txtDstAddr.Text.ToString() != "")
                Condition += " and vDstAddr = dmc_config.dbo.[f_IP2int]('" + txtDstAddr.Text.ToString() + "')";
            if (txtDstMac.Text.ToString() != "")
                Condition += " and vDstMac = '" + txtDstMac.Text.ToString() + "'";
            if (txtLpFrom.Text.ToString() != "")
            {
                if (fromeq.Checked)
                    Condition += " and vLpFrom = '" + txtLpFrom.Text.ToString() + "'";
                else
                    Condition += " and vLpFrom like '%" + txtLpFrom.Text.ToString() + "%'";
            }
            if (txtLpTo.Text.ToString() != "")
            {
                if (toeq.Checked)
                    Condition += " and vLpTo = '" + txtLpTo.Text.ToString() + "'";
                else
                    Condition += " and vLpTo like '%" + txtLpTo.Text.ToString() + "%'";
            }
            if (txtLpTitle.Text.ToString() != "")
                Condition += " and vLpTitle like '%" + txtLpTitle.Text.ToString() + "%'";
            if (txtLogin.Text.ToString() != "")
                Condition += " and vLogin like '%" + txtLogin.Text.ToString() + "%'";

            if (rdlMode.SelectedValue == "1")//敏感模式
                Condition += " and nKey > 0";

            int senstive = common.GetSenstiveCheck(this.CheckBoxList2);

            if (senstive > 0)
                Condition += " and ( (nKey & " + senstive + ")>0 ) ";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
                Condition = Condition.Substring(5);
        }
    }
Beispiel #47
0
    protected void Page_Load(object sender, EventArgs e)
    {
        myDB = (database)Session["myDB"];
        boardName = (string)Session["boardName"];
        curUser = (user)Session["curUser"];
        designUser = (user)Session["designUser"];
        userInfoColl = myDB.getUserInfoCollection();
        images = (List<product_image>)Session["allItems"];
        imgColl = myDB.getImagesCollection();
        elements.loadElements(imgColl, colorList, lineList, lightList, formList, spaceList, textureList, patternList, massList, balanceList, unityList, harmonyList, rhythmList, proportionList, varietyList, emphasisList, scaleList, typeList);

        if (curUser.Account_Type == "client")
        {
            usersBoardColl = myDB.getUsersBoardCollection(curUser);
            userNameLbl.Text = curUser.Username;
            board_item.loadBoards(usersBoardColl, boardNameList);
        }
        else if (curUser.Account_Type == "designer")
        {
            if (designUser != null)
            {
                usersBoardColl = myDB.getUsersBoardCollection(designUser);
                userNameLbl.Text = designUser.Username;
            }
            else
            {
                userNameLbl.Text = curUser.Username;
                usersBoardColl = myDB.getUsersBoardCollection(curUser);
            }
            switchUserBtn.Visible = true;
            user.loadUsers(userInfoColl, designerUserList, curUser);
        }
        boardNameLbl.Text = boardName;
        if (!Page.IsPostBack)
        {
            if (boardName != null)
            {
                optionsPnl.Visible = true;
                boardNamePnl.Visible = true;
                if (curUser.Account_Type == "designer")
                {
                    userNamePnl.Visible = true;
                }
            }
            else
            {
                boardNamePnl.Visible = false;
                userNamePnl.Visible = false;
                if (curUser.Account_Type == "designer")
                {
                    switchUserPnl.Visible = true;
                }
                else
                {
                    changeBoardPnl.Visible = true;
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        myDB = (database)Session["myDB"];
        boardName = (string)Session["boardName"];
        curUser = (user)Session["curUser"];
        designUser = (user)Session["designUser"];
        userInfoColl = myDB.getUserInfoCollection();
        boardNameLbl.Text = boardName;
        userNameLbl.Text = curUser.Username;
        userErrLbl.Text = "";
        boardErrLbl.Text = "";
        resetBoard();
        if (curUser.Account_Type == "client")
        {
            userNamePnl.Visible = false;
            usersBoardColl = myDB.getUsersBoardCollection(curUser);
            board_item.loadBoards(usersBoardColl, boardNameList);
        }
        else if (curUser.Account_Type == "designer")
        {
            userNamePnl.Visible = true;
            switchUserBtn.Visible = true;
            if (designUser != null)
            {
                usersBoardColl = myDB.getUsersBoardCollection(designUser);
                userNameLbl.Text = designUser.Username;
            }
            else
            {
                usersBoardColl = myDB.getUsersBoardCollection(curUser);
            }
            user.loadUsers(userInfoColl, designerUserList, curUser);
        }
        if (!Page.IsPostBack)
        {

            boardNamePnl.Visible = true;

            if (boardName != null)
            {
                loadImages(usersBoardColl, boardName);
                inspirationPnl.Visible = true;
            }
            else
            {
                inspirationPnl.Visible = false;
                userNamePnl.Visible = false;
                boardNamePnl.Visible = false;
                changeBoardBtn.Visible = false;
                if (curUser.Account_Type == "designer")
                {
                    switchUserPnl.Visible = true;
                }
                else
                {
                    changeBoardPnl.Visible = true;
                }
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     myDB = (database)Session["myDB"];
     curUser = (user)Session["curUser"];
     userInfoColl = myDB.getUserInfoCollection();
     curUser = user.findUser(userInfoColl, curUser.Username);
     Session["curUser"] = curUser;
     usernameLbl.Text = curUser.Username;
     emailAddressLbl.Text = curUser.Email;
     phoneLbl.Text = curUser.Phone;
     designerLbl.Text = curUser.Designer;
     passwordFieldValidator.ControlToValidate = "passwordTxt";
     cnfrmPassFieldValidator.ControlToValidate = "cnfrmPassTxt";
     changeEmailFieldValidator.ControlToValidate = "emailAddressTxt";
     if (curUser.Account_Type == "client")
     {
         clientPnl.Visible = true;
     }
     else
     {
         designerPnl.Visible = true;
         user.loadClients(userInfoColl, clientList, curUser);
     }
 }
        public string getInsertSqlCode(int row, database.Preferences.MySQLRow mysqlRow, MySqlConnection connection)
        {
            setDefaultItemValues(row);
            ItemTemplates.ItemTemplateRow tempRow = (ItemTemplates.ItemTemplateRow)this.ItemTemplate.Rows[row];
            System.Data.DataTable columnsTable = new System.Data.DataTable();

            //automatic detection
            if (mysqlRow.cellDetection == true && connection != null)
            {
                try
                {
                    connection.Open();
                    string SQL = "SHOW COLUMNS FROM " + mysqlRow.ItemTemplateTable;

                    MySqlCommand cmd = new MySqlCommand(SQL, connection);
                    MySqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        columnsTable.Columns.Add(reader.GetString(0));
                    }
                }
                catch (MySqlException ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                    columnsTable = this.ItemTemplate;
                }
                finally
                {
                    connection.Close();
                }
            }
            else
            {
                columnsTable = this.ItemTemplate.Clone();

                if (mysqlRow.ArtiID == false) columnsTable.Columns.Remove("ArtiID");
            }

            string columnsSQL = "";
            string dataSQL = "";
            bool insertedColumn = false;
            bool insertedData = false;
            foreach (System.Data.DataColumn column in columnsTable.Columns)
            {
                if (this.ItemTemplate.Columns.Contains(column.ColumnName))
                {
                    if(!tempRow.IsNull(column.ColumnName))
                    {
                        object value = tempRow[column.ColumnName];

                        switch (value.GetType().ToString())
                        {
                            case "System.String":
                                {
                                    if ((string)value != "")
                                    {
                                        if (insertedColumn == false)
                                        {
                                            columnsSQL += "`" + column.ColumnName + "`";
                                            insertedColumn = true;
                                        }
                                        else columnsSQL += ", `" + column.ColumnName + "`";

                                        if (insertedData != false) dataSQL += ", ";
                                        else insertedData = true;
                                        dataSQL += "'" + this.escapeString(value.ToString()) + "'";
                                    }
                                    break;
                                }
                            case "System.Boolean":
                                {
                                    if (insertedColumn == false)
                                    {
                                        columnsSQL += "`" + column.ColumnName + "`";
                                        insertedColumn = true;
                                    }
                                    else columnsSQL += ", `" + column.ColumnName + "`";

                                    if (insertedData != false) dataSQL += ", ";
                                    else insertedData = true;

                                    if ((bool)value == true) dataSQL += "1";
                                    else dataSQL += "0";
                                    break;
                                }
                            default:
                                {
                                    if (System.Convert.ToInt32(value) != 0)
                                    {
                                        if (insertedColumn == false)
                                        {
                                            columnsSQL += "`" + column.ColumnName + "`";
                                            insertedColumn = true;
                                        }
                                        else columnsSQL += ", `" + column.ColumnName + "`";

                                        if (insertedData != false) dataSQL += ", ";
                                        else insertedData = true;
                                        dataSQL += value.ToString();
                                    }
                                    break;
                                }
                        }
                    }
                }
            }

            string code;
            code = "REPLACE INTO " + mysqlRow.ItemTemplateTable + " (" + columnsSQL + ") VALUES (" + dataSQL + ")";

            return code;
        }
Beispiel #51
0
		protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
		{
			serverConfiguration.AnonymousUserAccessMode = database::Raven.Database.Server.AnonymousUserAccessMode.None;
		}
 protected void Page_Load(object sender, EventArgs e)
 {
     myDB = (database)Session["myDB"];
     curUser = (user)Session["curUser"];
     boardName = (string)Session["boardName"];
     images = (List<product_image>)Session["allItems"];
     imgColl = myDB.getImagesCollection();
     usersBoardColl = myDB.getUsersBoardCollection(curUser);
     board_item.loadBoards(usersBoardColl, boardNameList);
     elements.loadElements(imgColl, colorList, lineList, lightList, formList, spaceList, textureList, patternList, massList, balanceList, unityList, harmonyList, rhythmList, proportionList, varietyList, emphasisList, scaleList, typeList);
     boardNameLbl.Text = "Selected Board: " + boardName;
 }