Exemplo n.º 1
0
 public static void UpdateProfile(ENTMEMUSER user)
 {
     con = SQL.GetConnection();
     cmd = SQL.SetCommand("UPDATE MEM_USER SET NAME = @NAME, SURNAME=@SURNAME,MAIL=@MAIL,PASSWORD=@PASSWORD,PHONE=@PHONE WHERE ID = @ID", con);
     cmd.Parameters.AddWithValue("@ID", user.ID);
     cmd.Parameters.AddWithValue("@NAME", user.NAME);
     cmd.Parameters.AddWithValue("@SURNAME", user.SURNAME);
     cmd.Parameters.AddWithValue("@MAIL", user.MAIL);
     cmd.Parameters.AddWithValue("@PASSWORD", user.PASSWORD);
     cmd.Parameters.AddWithValue("@PHONE", user.PHONE);
     con.Open();
     cmd.ExecuteNonQuery();
     con.Close();
 }
Exemplo n.º 2
0
 public static void Update(ENTMEMUSER user)
 {
     con = SQL.GetConnection();
     cmd = SQL.SetCommand("UPDATE MEM_USER SET NAME = @NAME, SURNAME=@SURNAME,CREATEDATE=@CREATEDATE,MAIL=@MAIL,FIRMID=@FIRMID,PHONE=@PHONE,STATUS=@STATUS,TYPEUSERID=@TYPEUSERID,LANGUAGEID=@LANGUAGEID WHERE ID = @ID", con);
     cmd.Parameters.AddWithValue("@ID", user.ID);
     cmd.Parameters.AddWithValue("@NAME", user.NAME);
     cmd.Parameters.AddWithValue("@SURNAME", user.SURNAME);
     cmd.Parameters.AddWithValue("@CREATEDATE", user.CREATEDATE);
     cmd.Parameters.AddWithValue("@MAIL", user.MAIL);
     cmd.Parameters.AddWithValue("@FIRMID", user.FIRMID);
     cmd.Parameters.AddWithValue("@PHONE", user.PHONE);
     cmd.Parameters.AddWithValue("@STATUS", user.STATUS);
     cmd.Parameters.AddWithValue("@TYPEUSERID", user.TYPEUSERID);
     cmd.Parameters.AddWithValue("@LANGUAGEID", user.LANGUAGEID);
     con.Open();
     cmd.ExecuteNonQuery();
     con.Close();
 }
Exemplo n.º 3
0
        public static List <ENTMEMUSER> GetAllListUserID(Guid FIRMID)
        {
            con = SQL.GetConnection();
            cmd = SQL.SetCommand("SELECT * FROM MEM_USER WHERE FIRMID=@FIRMID", con);
            cmd.Parameters.AddWithValue("@FIRMID", FIRMID);
            con.Open();
            SqlDataReader     dr         = cmd.ExecuteReader();
            ENTMEMUSER        user       = null;
            Guid?             firmID     = null;
            byte?             languageıd = null;
            List <ENTMEMUSER> userlist   = new List <ENTMEMUSER>();

            while (dr.Read())
            {
                if (!string.IsNullOrEmpty(dr["FIRMID"].ToString()))
                {
                    firmID = Guid.Parse(dr["FIRMID"].ToString());
                }
                else
                {
                    firmID = null;
                }
                if (!string.IsNullOrEmpty(dr["LANGUAGEID"].ToString()))
                {
                    languageıd = Convert.ToByte(dr["LANGUAGEID"].ToString());
                }
                else
                {
                    languageıd = null;
                }
                user = new ENTMEMUSER(Guid.Parse(dr["ID"].ToString()), dr["MAIL"].ToString(), dr["PASSWORD"].ToString(), dr["NAME"].ToString(), dr["SURNAME"].ToString(), Convert.ToDateTime(dr["CREATEDATE"].ToString()), Convert.ToByte(dr["TYPEUSERID"].ToString()), dr["PHONE"].ToString(), Convert.ToBoolean(dr["ISADMIN"]), Convert.ToBoolean(dr["STATUS"]), firmID, languageıd);
                userlist.Add(user);
            }
            con.Close();

            return(userlist);
        }
Exemplo n.º 4
0
        public static ENTMEMUSER GetUser(string mail, string password)
        {
            con = SQL.GetConnection();
            cmd = SQL.SetCommand("SELECT TOP 1 * FROM MEM_USER WHERE MAIL=@MAIL AND PASSWORD=@PASSWORD", con);
            cmd.Parameters.AddWithValue("@MAIL", mail);
            cmd.Parameters.AddWithValue("@PASSWORD", password);

            con.Open();
            SqlDataReader dr         = cmd.ExecuteReader();
            ENTMEMUSER    user       = null;
            Guid?         firmID     = null;
            byte?         languageıd = null;

            while (dr.Read())
            {
                if (!string.IsNullOrEmpty(dr["FIRMID"].ToString()) || !string.IsNullOrEmpty(dr["LANGUAGEID"].ToString()))
                {
                    firmID = Guid.Parse(dr["FIRMID"].ToString());
                }
                else
                {
                    firmID = null;
                }
                if (!string.IsNullOrEmpty(dr["LANGUAGEID"].ToString()))
                {
                    languageıd = Convert.ToByte(dr["LANGUAGEID"].ToString());
                }
                else
                {
                    languageıd = null;
                }
                user = new ENTMEMUSER(Guid.Parse(dr["ID"].ToString()), dr["MAIL"].ToString(), dr["PASSWORD"].ToString(), dr["NAME"].ToString(), dr["SURNAME"].ToString(), Convert.ToDateTime(dr["CREATEDATE"].ToString()), Convert.ToByte(dr["TYPEUSERID"].ToString()), dr["PHONE"].ToString(), Convert.ToBoolean(dr["ISADMIN"]), Convert.ToBoolean(dr["STATUS"]), firmID, languageıd);
                break;
            }
            con.Close();
            return(user);
        }
Exemplo n.º 5
0
        public static void InsertTable(ENTMEMUSER user)
        {
            try
            {
                con = SQL.GetConnection();
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                cmd = SQL.SetCommand("INSERT INTO MEM_USER (ID,MAIL,PASSWORD,NAME, SURNAME,CREATEDATE,TYPEUSERID,ISADMIN,PHONE,STATUS,FIRMID,LANGUAGEID) VALUES (@ID,@MAIL,@PASSWORD,@NAME,@SURNAME,@CREATEDATE,@TYPEUSERID,@ISADMIN,@PHONE,@STATUS,@FIRMID,@LANGUAGEID)", con);
                cmd.Parameters.AddWithValue("@ID", user.ID);
                cmd.Parameters.AddWithValue("@MAIL", user.MAIL);
                cmd.Parameters.AddWithValue("@PASSWORD", user.PASSWORD);
                cmd.Parameters.AddWithValue("@NAME", user.NAME);
                cmd.Parameters.AddWithValue("@SURNAME", user.SURNAME);
                cmd.Parameters.AddWithValue("@CREATEDATE", user.CREATEDATE);
                cmd.Parameters.AddWithValue("@TYPEUSERID", user.TYPEUSERID);
                cmd.Parameters.AddWithValue("@ISADMIN", user.ISADMIN);
                cmd.Parameters.AddWithValue("@PHONE", user.PHONE);
                cmd.Parameters.AddWithValue("@STATUS", user.STATUS);
                cmd.Parameters.AddWithValue("@FIRMID", user.FIRMID);
                cmd.Parameters.AddWithValue("@LANGUAGEID", user.LANGUAGEID);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
        }