protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List<Matricula> lstMatri = new List<Matricula>();

            if (Session["Matri"] != null)
            {
                lstMatri = ((List<Matricula>)Session["Matri"]);
            }
            
            string codigo=GridMatricula.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();


            Matricula MatriculaEncontrada = lstMatri.SingleOrDefault(s => s.Codigo == Convert.ToInt32(codigo));

            if (e.CommandName == "Editar")
            {
                txtCodigo.Text = MatriculaEncontrada.Codigo.ToString();
                txtNombre.Text = MatriculaEncontrada.NombreEstud;
                txtValor.Text = MatriculaEncontrada.Valor.ToString();
            }

            if (e.CommandName == "Eliminar")
            {
                lstMatri.Remove(MatriculaEncontrada);

                //int indice =   lstFactu.IndexOf(factuEncontrada);
                //lstFactu.RemoveAt(indice);                
            }

            GridMatricula.DataSource = lstMatri;
            GridMatricula.DataKeyNames = new string[] { "Codigo" };
            GridMatricula.DataBind();
        }
 public void ProcessRequest(HttpContext context)
 {
     var userno = context.Request["userno"];
     DateTime myDate = DateTime.Now;
     string myDateString = myDate.ToString("yyyy-MM-dd HH:mm:ss");
     String time_start = DateTime.UtcNow.AddDays(-365).ToString("yyyy-MM-dd hh:mm:ss");
     Console.WriteLine(myDateString, time_start);
     List<item_reminder> items = new List<item_reminder>();
     using (var sql_conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.AppSettings["ConnectionStr"]))
     {
         sql_conn.Open();
         using (var sql_cmd = sql_conn.CreateCommand())
         {
             var comm = string.Format("SELECT    [pro_userno],[descr],[CreateDate]   FROM HP_reminder    WHERE  userno = '{0}'  and  (CreateDate BETWEEN '{1}' AND '{2}')   ORDER BY CreateDate DESC ", userno, time_start, myDateString);
             sql_cmd.CommandText = comm;
             sql_cmd.ExecuteNonQuery();
             SqlDataReader sqlite_datareader1 = sql_cmd.ExecuteReader();
             while (sqlite_datareader1.Read())
             {
                 items.Add(new item_reminder()
                 {
                     pro_userno = sqlite_datareader1["pro_userno"].ToString(),
                     descr = sqlite_datareader1["descr"].ToString(),
                     CreateDate = DateTime.Parse(sqlite_datareader1["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")
                 });
             }
             String data = JsonConvert.SerializeObject(items);
             context.Response.Clear();
             context.Response.ContentType = "application/json ; charset =utf-8";
             context.Response.Write(data);
             context.Response.End();
         }
     }
 }
 protected void SubmitBtn_Click()
 {
     CUser user = new CUser();
     List<CUser> userList = new List<CUser>();
     userList=user.GetUserById(Convert.ToInt32(Session["user_id"]));
     MD5 md5hash = MD5.Create();
     if (userList.Count > 0 )
     {
         try
         {
             bool found = false;
             foreach (CUser u in userList)
             {
                 if (u.user_password == user.GetMd5Hash(md5hash, old_password.Text))
                 {
                     user.user_id = Convert.ToInt32(Session["user_id"]);
                     user.updated_by = (string)Session["user_name"];
                     user.user_password = user.GetMd5Hash(md5hash, new_password.Text);
                     user.UpdatePassword();
                     found = true;
                     ltrlmsg.Text = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button> Password Update Success</div>";
                 }
             }
             if (found == false)
             {
                 ltrlmsg.Text = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button> Old Password Error</div>";
             }
         }
         catch (Exception ex)
         {
             ltrlmsg.Text = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button> " + ex.Message + "</div>";
         }
     }
 }
        private string GetSeriesString()
        {
            List<Expense> expenses = Expense.GetAmountRandomAmountList();

            List<string> expensesLinePoints = new List<string>();
            StringBuilder seriesString = new StringBuilder();

            foreach (Expense expenseItem in expenses)
            {
                expensesLinePoints.Add(expenseItem.Amount.ToString());

                if (expenseItem.Date.Month == 12)
                {
                    if (seriesString.Length > 0)
                    {
                        seriesString.Append(",");
                    }
                    seriesString.Append("{ ");
                    seriesString.AppendFormat(@"name: {0},
                            data: [{1}]", expenseItem.Date.Year, string.Join(",", expensesLinePoints.ToArray()));
                    seriesString.Append("  }");

                    expensesLinePoints = new List<string>();
                }
            }

            return seriesString.ToString();
        }
Пример #5
0
        public static List<Customers> PopulateDropDownList()
        {
            DataTable dt = new DataTable();
            List<Customers> objDept = new List<Customers>();

            using (SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=ylena_exercise;Integrated Security=True"))
            {
                using (SqlCommand cmd = new SqlCommand("SELECT CustomerId, CustomerName, ContactName, Address, City, PostalCode, Country FROM Customers", con))
                {
                    con.Open();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            objDept.Add(new Customers
                            {
                                CustomerId = dt.Rows[i]["CustomerId"].ToString(),
                                CustomerName = dt.Rows[i]["CustomerName"].ToString(),
                                ContactName = dt.Rows[i]["ContactName"].ToString(),
                                Address = dt.Rows[i]["Address"].ToString(),
                                City = dt.Rows[i]["City"].ToString(),
                                PostalCode = dt.Rows[i]["PostalCode"].ToString(),
                                Country = dt.Rows[i]["Country"].ToString()
                            });
                        }
                    }
                    return objDept;
                }
            }
        }
Пример #6
0
        public DataTable databasecall(string username)
        {
            var con = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
            SqlConnection mycon = new SqlConnection(con);

            try
            {

                DataTable dt = new DataTable();
                SqlCommand cmd = new SqlCommand("Select * from Demo where NAME=@NAME", mycon);
                cmd.Parameters.AddWithValue("@NAME", username);
                mycon.Open();
                SqlDataReader DR1 = cmd.ExecuteReader();
                {
                    if (DR1.HasRows)
                        dt.Load(DR1);
                }

                //converting it to  list
                List<DataRow> list = new List<DataRow>();
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(dr);
                }
                //converting it to  list

                return dt;
            }
            catch (Exception e)
            {
                // cmd.ExecuteScalar();
                mycon.Close();
                return null;
            }
        }
Пример #7
0
 public Marchant()
 {
     Products = new List<Product>();
     Products.Add(new Product("Pen", 25));
     Products.Add(new Product("Pencil", 30));
     Products.Add(new Product("Notebook", 15));
 }
Пример #8
0
 internal DeviceTable(List<PerformanceCubeResult> resultsArray, List<DeviceInfo> deviceList)
 {
     foreach(PerformanceCubeResult result in resultsArray)
     {
         AddIfNew (false, result.DeviceDatabaseId, result.IsMonoTouch, deviceList);
     }
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            int sheet_number = Convert.ToInt32(TextBox1.Text);
            int column_number = Convert.ToInt32(TextBox2.Text);
            string cell_entry = "";
            List<string> list_images = new List<string>();

            foreach (Row row in (((Workbook.Worksheets(excel_path)).ElementAtOrDefault(sheet_number-1)).Rows))
            {
                if (row.Cells.ElementAtOrDefault(column_number-1) != null)
                {
                    cell_entry = (row.Cells.ElementAtOrDefault(column_number-1)).Text;
                    list_images.Add(cell_entry);
                }
            }

            List<string> distinct_images = list_images.Distinct().ToList();
            foreach (var images in distinct_images)
            {
                System.Drawing.Image image = DownloadImageFromUrl("https://media.loylty.com/Gallery/" + images + ".jpg");
                if (image != null)
                {
                    string rootPath = ConfigurationManager.AppSettings["FolderPath1"];
                    string fileName1 = Server.MapPath(rootPath + images + ".jpg");
                    image.Save(fileName1);
                }
            }
        }
        public static OracleDataReader ExecutarComando(String cmmdText, CommandType cmmdType, List<OracleParameter> listParameter)
        {
            // Cria comando com os dados passado por parâmetro
            OracleCommand command = CriarComando(cmmdText, cmmdType, listParameter);

            command.InitialLONGFetchSize = 0;

            // Cria objeto de retorno
            OracleDataReader  objRetorno = null;
            try
            {
                // Abre a Conexão com o banco de dados
                command.Connection.Open();
                 // Retorna um DbDataReader
                objRetorno = command.ExecuteReader(CommandBehavior.CloseConnection);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                    // Sempre fecha a conexão com o BD
                    //command.Connection.Close();
                    //command.Connection.Dispose();
                    //command.Dispose();
                    //command = null;
            }
            return objRetorno;
        }
Пример #11
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            char[] trimmer={' '};

            List<string> keywords = TextBox2.Text.Split(',').ToList();

            List<string> filteredKeywords = new List<string>();

            foreach (string word in keywords)
            {

                string temp = word.ToLower();
                temp = temp.TrimEnd(trimmer);
                temp = temp.TrimStart(trimmer);
                filteredKeywords.Add(temp);

            }
            float CSMatch = Comparator.matchSpringerCS(filteredKeywords.ToArray());
            float ENMatch = Comparator.matchSpringerEngineering(filteredKeywords.ToArray());
            float MAMatch = Comparator.matchSpringerMA(filteredKeywords.ToArray());

            SCS.Text = " Computer Science: " +CSMatch  + "%";
            SEN.Text = " Engineering: " + ENMatch + "%";
            SMA.Text = " Mathematics: " + MAMatch + "%";
            ; ;
        }
Пример #12
0
        // checks whether student satisfies prereqs for given CourseNumber
        // string => bool
        protected bool checkClassPrereqs(string CourseNumber)
        {
            List<string> PrereqSetIDs = new List<string>();
            SqlDataReader rdr;

            //gets PrereqSetIDs for CourseNumber from server, puts them in PrereqSetIDs
            string sql = "SELECT PrereqSetID FROM wi.tbl_prereq_set WHERE CourseNumber = @CourseNumber;";
            MyConnection.Open();
            SqlCommand cmd = new SqlCommand(sql, MyConnection);
            cmd.Parameters.Add("@CourseNumber", System.Data.SqlDbType.VarChar);
            cmd.Parameters["@CourseNumber"].Value = CourseNumber;
            rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                //PrereqSetIDs.Add(rdr.GetString(0));
                PrereqSetIDs.Add(rdr.GetValue(0).ToString());
            }

            if (cmd != null) cmd.Dispose();
            if (MyConnection != null) MyConnection.Close();
            if (rdr != null) rdr.Dispose();
            MyConnection.Close();

            //for each PrereqSetID, gets its classes from server and checks whether studenthistory contains them
            foreach (string PrereqSetID in PrereqSetIDs)
            {
                List<string> PrereqSet = new List<string>();
                bool setRet = false;

                sql = "SELECT Prereq FROM wi.tbl_prereq WHERE PrereqSetID = @PrereqSetID;";
                MyConnection.Open();
                cmd = new SqlCommand(sql, MyConnection);
                cmd.Parameters.Add("@PrereqSetID", System.Data.SqlDbType.VarChar);
                cmd.Parameters["@PrereqSetID"].Value = PrereqSetID;
                rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    //checks if returned classes are in StudentHistory
                    if (studentHistory.Contains(rdr.GetString(0))) setRet = true;
                }

                if (cmd != null) cmd.Dispose();
                if (MyConnection != null) MyConnection.Close();
                if (rdr != null) rdr.Dispose();
                MyConnection.Close();

                //returns false if the PrereqSet isn't satisfied
                if (!setRet) return false;
            }

            if (cmd != null) cmd.Dispose();
            if (MyConnection != null) MyConnection.Close();
            if (rdr != null) rdr.Dispose();
            MyConnection.Close();

            //returns true if no prereqs are missing for the PrereqSets
            return true;
        }
Пример #13
0
        protected void Unnamed_Click(object sender, EventArgs e)
        {
            string email = Iemail.Text;
            string pass = Ipass.Text;

            User u = new User();
            List<string> lst = new List<string>();
            lst = u.UserLogin(email, pass);

            if(lst[0].ToString().Equals("True"))
            {
                if(lst[3].ToString().Equals("1") || lst[3].ToString().Equals("4"))
                {
                    Application.Add("username", lst[2]);
                    Application.Add("UserNumber", lst[1]);
                    Application.Add("UserSecRole", lst[3]);
                    Response.Redirect("./default");
                }
                if (lst[3].ToString().Equals("2") || lst[3].ToString().Equals("3"))
                {
                    Application.Add("username", lst[2]);
                    Application.Add("UserNumber", lst[1]);
                    Application.Add("UserSecRole", lst[3]);
                    Response.Redirect("./manager/default");
                }

            }
            else
            {
                email = "";
                pass = "";
                failed.Visible = true;

            }
        }
 protected void btnAjouter_Click(object sender, EventArgs e)
 {
     List<Produit> uneListeDeProduits = new List<Produit>();
     MySqlConnection cnx = new MySqlConnection("server=localhost;user=root;password=root;database=magasin");
     cnx.Open();
     MySqlCommand cmd = cnx.CreateCommand();
     cmd.CommandType = CommandType.Text;
     /*
     cmd.CommandText = "INSERT INTO produit(designation, prixUnitaire, quantiteEnStock) "
                     +"VALUES ('" + txtDesignation.Text + "'," + txtPrixUnitaire.Text + "," + txtQuantiteEnStock.Text + ")";
     */
     // Requêtes paramétrées
     cmd.CommandText = "INSERT INTO produit(designation, prixUnitaire, quantiteEnStock) "
                     + "VALUES (@designation, @prixUnitaire, @quantiteEnStock)";
     cmd.Prepare();
     cmd.Parameters.AddWithValue("@designation", txtDesignation.Text);
     cmd.Parameters.AddWithValue("@prixUnitaire", txtPrixUnitaire.Text);
     cmd.Parameters.AddWithValue("@quantiteEnStock", txtQuantiteEnStock.Text);
     using (DbDataReader dbrdr = cmd.ExecuteReader())
     {
         if (dbrdr.Read()) {}
         lblMessage.Text = "BRAVO ! L'insertion a réussi.";
     }
     cnx.Close();
 }
        protected void RegisterCookie(List<CUser> userlist)
        {
            Page page = (Page)HttpContext.Current.Handler;
            foreach (CUser user in userlist)
            {
                HttpCookie aCookie = new HttpCookie("user_name");
                aCookie.Value = user.user_name;
                aCookie.Expires = DateTime.Now.AddDays(1);
                HttpContext.Current.Response.Cookies.Add(aCookie);

                HttpCookie aCookie2 = new HttpCookie("user_email");
                aCookie2.Value = user.user_email;
                aCookie2.Expires = DateTime.Now.AddDays(1);
                HttpContext.Current.Response.Cookies.Add(aCookie2);

                HttpCookie aCookie3 = new HttpCookie("user_id");
                aCookie3.Value = user.user_id.ToString();
                aCookie3.Expires = DateTime.Now.AddDays(1);
                HttpContext.Current.Response.Cookies.Add(aCookie3);

                HttpCookie aCookie4 = new HttpCookie("user_group_id");
                aCookie4.Value = user.user_id.ToString();
                aCookie4.Expires = DateTime.Now.AddDays(1);
                HttpContext.Current.Response.Cookies.Add(aCookie4);
            }
        }
Пример #16
0
        public static string sqlstringtext()
        {
            string appPath = HttpRuntime.AppDomainAppPath + @"\sql.txt";
            //string appPath = @"c:\Users\" + Environment.UserName + @"\Desktop\sql.txt";
            List<string> lines = new List<string>();

            using (StreamReader r = new StreamReader(appPath, Encoding.Default))
            {
                string line;
                while ((line = r.ReadLine()) != null)
                {
                    lines.Add(line);
                }
            }
            string sqltext = "";
            foreach (string s in lines)
            {
                //string[] words = s;

                sqltext = s.Trim();

                //words[0] = "";
                //words[1] = "";
            }

            return sqltext;
        }
Пример #17
0
 internal DeviceTable(List<MatrixTestResult> resultsArray, List<DeviceInfo> deviceList)
 {
     foreach(MatrixTestResult result in resultsArray)
     {
         AddIfNew (true, result.DeviceDatabaseId, true, deviceList);
     }
 }
Пример #18
0
        public void ProcessRequest(HttpContext context)
        {
            String today = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            List<item_public> items = new List<item_public>();
            using (var sql_conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.AppSettings["ConnectionStr"]))
            {
                sql_conn.Open();
                using (var sql_cmd = sql_conn.CreateCommand())
                {
                    var comm = string.Format("SELECT  acttitle, actbdate,actedate,  content , name ,telephone ,cellphone  FROM   hactivity  where bucd ='wkhm'  and actedate >='{0}'  ORDER BY actedate DESC ", today);
                    sql_cmd.CommandText = comm;
                    sql_cmd.ExecuteNonQuery();
                    SqlDataReader sqlite_datareader1 = sql_cmd.ExecuteReader();
                    while (sqlite_datareader1.Read())
                    {
                        items.Add(new item_public()
                        {
                            acttitle = sqlite_datareader1["acttitle"].ToString(),
                            actbdate = DateTime.Parse(sqlite_datareader1["actbdate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"),
                            actedate = DateTime.Parse(sqlite_datareader1["actedate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"),
                            content = sqlite_datareader1["content"].ToString(),
                            name = sqlite_datareader1["name"].ToString(),
                               telephone = sqlite_datareader1["telephone"].ToString(),
                            cellphone = sqlite_datareader1["cellphone"].ToString()
                        });
                    }
                    String data = JsonConvert.SerializeObject(items);
                    context.Response.Clear();
                    context.Response.ContentType = "application/json ; charset =utf-8";
                    context.Response.Write(data);
                    context.Response.End();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["lang"] != null)
            {
                if (Request["lang"] == "en")
                {
                    Session["lang"] = "en";
                }
                else
                {
                    Session["lang"] = "my";
                }
            }
            if (HttpContext.Current.Request.Cookies["user_email"]!=null && Session["user_name"]==null)
            {
                CUser userObj = new CUser();
                List<CUser> lstUser=new List<CUser>();
                lstUser=userObj.GetUserByEmail(HttpContext.Current.Request.Cookies["user_email"].Value);
                if (lstUser.Count() > 0)
                {
                    RegisterSession(lstUser);
                    //throw new Exception("cookies");
                }

            }

            if ((string)Session["user_email"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            //initz initObj = new initz();
            //List<Dictionary<string, Object>> primary_nav = new List<Dictionary<string, object>>();
            //primary_nav = initObj.primary_nav;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var myLog = new List<string>();
            myLog.Add(string.Format("{0} - Logging Started", DateTime.UtcNow));

            logListView.DataSource = myLog;
            logListView.DataBind();
        }
Пример #21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack) { parameterList = DeserializeXml(@"C:\Users\Роман\Desktop\2008\WebApplication1\WebApplication1\Input.xml");
     Control.Validation = new Validation(parameterList);
     }
     foreach (var parameter in Control.Validation.parameterList)
         AddParameter(parameter);
 }
Пример #22
0
        protected List<ServiceLayer.RainRecord> retrieveRecords()
        {
            List<ServiceLayer.RainRecord> list = new List<ServiceLayer.RainRecord>();

            list = rs.RetrieveAllRainrecords();

            return list;
        }
Пример #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Events/Add");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Events/Add");
            }

            if (!IsPostBack)
            {
                Classes.Locations l = new Classes.Locations();
                DataTable dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }

                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                if (locationId == 0)
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = locationId;

                    DataTable dtLocation = l.locationInfoOnlyId(locationId);

                    locationCity(Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString()));
                    locationState(Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString()));
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString();
                    DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString();
                    DropDownListCity.SelectedValue = locationId.ToString();
                }
            }

        }
Пример #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     List<DBO.Books> list = new List<DBO.Books>();
     List<DBO.Books> list_bis = new List<DBO.Books>();
     list_bis = BuisinessManagement.Echange.parse("test_xml.xml", 0);
     BuisinessManagement.Echange.create(list, 0);
     list = BuisinessManagement.Echange.parse("test_xml.xml",1);
     BuisinessManagement.Echange.create(list, 1);
 }
 public void Submit()
 {
     COrder oObj = new COrder();
     List<COrder> oList = new List<COrder>();
     oList = oObj.GetReport1(Convert.ToDateTime(start_from.Text), Convert.ToDateTime(end_to.Text));
     ReportDocument crystalReport = new ReportDocument();
     crystalReport.Load(Server.MapPath("~/CrystalReport1.rpt"));
     //            Customers dsCustomers = GetData();
     crystalReport.SetDataSource(oList);
     CrystalReportViewer1.ReportSource = crystalReport;
 }
Пример #26
0
        public void ProcessRequest(HttpContext context)
        {
            var userid = context.Request["userid"];

            String data = "";
            List<item_check> items = new List<item_check>();
            using (var sql_conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.AppSettings["ConnectionStr"]))
            {
                sql_conn.Open();
                using (var sql_cmd = sql_conn.CreateCommand())
                {

                    var comm = string.Format("SELECT userid FROM employees  where userid = '{0}' ", userid);
                    sql_cmd.CommandText = comm;
                    sql_cmd.ExecuteNonQuery();
                    SqlDataReader sqlite_datareader1 = sql_cmd.ExecuteReader();

                        while (sqlite_datareader1.Read())
                        {
                            items.Add(new item_check()
                            {
                                userid = sqlite_datareader1["userid"].ToString(),

                            });

                        }

                        data = JsonConvert.SerializeObject(items);

                        if (data == "[]")
                        {
                            context.Response.Clear();
                            context.Response.ContentType = "application/json ; charset =utf-8";
                            context.Response.Write("YES");
                            context.Response.End();
                        }
                        else
                        {
                            context.Response.Clear();
                            context.Response.ContentType = "application/json ; charset =utf-8";
                            context.Response.Write("NO");
                            context.Response.End();

                        }

                        context.Response.Clear();
                        context.Response.ContentType = "application/json ; charset =utf-8";
                        context.Response.Write(data);
                        context.Response.End();

                }

            }
        }
 protected void CarregarRegrasSQL(string grupo)
 {
     var dsTabelas = ObterParametrosRegras();
     var arRegras = dsTabelas.Tables["Regras"].Select("tipo='" + grupo + "'");
     Dictionary<string, string> dicRegras = new Dictionary<string, string>();
     foreach (var registro in arRegras)
     {
         dicRegras.Add(registro["nome"].ToString(), registro["argumento"].ToString());
     }
     colRegras = RegrasScriptSQL.RegrasSQL.Carregar(dicRegras);
 }
Пример #28
0
 /// <summary>
 /// 匹配页面的图片地址
 /// </summary>
 /// <param name="HtmlCode"></param>
 /// <param name="imgHttp">要补充的http://路径信息</param>
 /// <returns></returns>
 public List<string> GetImgSrc(string HtmlCode)
 {
     List<string> list = new List<string>();
     string Reg = @"";
     Reg = "(?is)<img.*?src=(['\"]?)(?<url>[^'\" ]+)(?=\\1)[^>]*>";
     foreach (Match m in Regex.Matches(HtmlCode, Reg, RegexOptions.IgnoreCase))
     {
         list.Add(m.Groups["url"].Value);
     }
     return list;
 }
        public static List<string> acm(string uri)
        {
            List<string> acmkeywords = new List<string>();

            int counter = 0;
            string ccsforthisarticle = "CCS&nbsp;for&nbsp;this&nbsp;Article";
            string end = "]);";
            bool printNow = false;
            string quoteandgreatersymbol = "\">";
            string path = HttpContext.Current.Server.MapPath("~/App_Data/ACMhtmlFile.txt");
            Stream writer = new FileStream(path, FileMode.Create);
            writer.Close();
            //  string link = "http://dl.acm.org/citation.cfm?id=1073209&CFID=574953640&CFTOKEN=74149999";
            using (WebClient client = new WebClient())
            {

                client.DownloadFile(uri, path);

                foreach (var line in File.ReadLines(path))
                {

                    if (printNow)
                    {
                        if (line.Contains(end))
                        {
                            printNow = false;
                            counter++;
                        }
                    }
                    if (printNow)
                    {

                        if (line.Contains(quoteandgreatersymbol))
                        {
                            var a = line.IndexOf("href");
                            var b = line.LastIndexOf("/a>");
                            var c = line.Substring(a, b - a);
                            var d = c.IndexOf('>');
                            var e = c.IndexOf('<');
                            var f = c.Substring(d, e - d);
                            acmkeywords.Add(f.Trim('>'));
                            System.Diagnostics.Debug.WriteLine(f.Trim('>'));
                        }

                    }
                    if ((line.Contains(ccsforthisarticle)) && counter == 0)
                        printNow = true;

                }

            }

            return acmkeywords;
        }
Пример #30
0
 public static void Add(string path,string connectionId)
 {
     if (_lst == null)
     {
         _lst = new List<Photo>();
     }
     _lst.Add(new Photo()
     {
         Path = path,
         ConnectionId = connectionId,
     });
 }