/// <summary>
        /// Авторизация.
        /// </summary>
        public static bool Autorization(decimal worguild, string password)
        {
            var          dbFolder = Properties.Settings.Default.FoxProDbFolder_Temp;
            const string query    = "SELECT * FROM WorkingStandardsPassword " +
                                    "WHERE workguild = ? AND password = ?";

            try
            {
                using (var oleDbConnection = DbControl.GetConnection(dbFolder))
                {
                    // Установка соединения и проверка кодировки
                    oleDbConnection.TryConnectOpen();
                    oleDbConnection.VerifyInstalledEncoding("BalancePassword");

                    using (var oleDbCommand = new OleDbCommand(query, oleDbConnection))
                    {
                        oleDbCommand.Parameters.AddWithValue("workguild", worguild);
                        oleDbCommand.Parameters.AddWithValue("password", password);
                        using (var reader = oleDbCommand.ExecuteReader())
                        {
                            return(reader != null && reader.Read());
                        }
                    }
                }
            }
            catch (OleDbException ex)
            {
                throw DbControl.HandleKnownDbFoxProAndMssqlServerExceptions(ex);
            }
        }
Пример #2
0
        protected void bntSignIn_Click(object sender, EventArgs e)
        {
            TUser tUser;

            //Verify if txtId is nothing
            if ((txtId.Value.Trim() == "") || (txtPassword.Value.Trim() == ""))
            {
                Response.Write("<script type='text/javascript'>alert('ID number and Password cannot be NULL!');</script>");
                return;
            }

            tUser = DbControl.getInstance().getUser(txtId.Value, txtPassword.Value);
            //Verify if ID or PASSWORD is Wrong
            if (tUser == null)
            {
                Response.Write("<script type='text/javascript'>alert('ID number or Password wrong!');</script>");
                return;
            }
            else
            {
                Session["user"] = tUser;
                if (tUser.id == "admin")
                {
                    Response.Redirect("admin.aspx");
                }
                else
                {
                    Response.Redirect("home.aspx");
                }
            }
        }
Пример #3
0
    protected void Page_Init(object sender, EventArgs e)
    {
        for (int i = 0; i <= 23; i++)
        {
            stime.Items.Add(i.ToString());
            etime.Items.Add(i.ToString());
        }
        unitid = Request.QueryString["unitid"];
        //    unitname = Unitlib.Get_UnitName(int.Parse(unitid));
        string strsql           = "SELECT *  FROM tbl_banner_class where unitid = (select upperid from unitdata where unitid= @id) order by  sort ";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("id", Request.QueryString ["unitid"]);
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        DropDownList1.DataSource = dt;
        DropDownList1.DataBind();

        nvc.Clear();
        strsql = "select *   FROM    tbl_category";
        dt     = DbControl.Data_Get(strsql, nvc);
        DropDownList2.DataSource = dt;
        DropDownList2.DataBind();
        DropDownList2.Items.Insert(0, new ListItem("全部", ""));
        DropDownList2_SelectedIndexChanged(sender, e);
    }
Пример #4
0
    public void selectSQL(string sorttype = "desc", string sortColumn = "packageid")
    {
        string strsql = @" SELECT (SELECT TOP (1) tbl_productData.logo
                            FROM  tbl_package_product INNER JOIN
                            tbl_productData ON tbl_package_product.p_id = tbl_productData.p_id
                            WHERE tbl_package_product.packageid = Tbl_package.packageid) AS logo,
                            Tbl_package.*
                            FROM   Tbl_package where status <> 'D' ";

        if (search_txt.Text != "")
        {
            int  n;
            bool isNumeric = int.TryParse(search_txt.Text, out n);
            strsql += @" and (ReMark like '%'+@S+'%'    or packagename like '%'+@S+'%'   or description like '%'+@S+'%')  ";
        }
        if (DropDownList1.SelectedIndex > 0)
        {
            strsql += " and  categoryid = @categoryid";
        }

        strsql += " ORDER BY  sort," + sortColumn + " " + sorttype;

        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("S", search_txt.Text);
        nvc.Add("categoryid", DropDownList1.SelectedValue);
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        ListView1.DataSource = dt;
        ListView1.DataBind();
        dt.Dispose();
        MultiView1.ActiveViewIndex = 0;
    }
Пример #5
0
        public static dynamic MyJoinLesson(string memberid)
        {
            string strsql = @"SELECT          tbl_lesson.startday, tbl_lesson.address, tbl_lesson.lessontime, tbl_OrderData.ord_code, tbl_OrderData.memberid, 
                            tbl_Joindata.joinid, tbl_OrderData.paymode, tbl_OrderData.TotalPrice, tbl_OrderData.ordname, 
                            tbl_OrderData.ordphone, tbl_OrderData.ord_date, tbl_article.articleId, tbl_article.subject, tbl_article.pic, 
                            tbl_lesson.endday, tbl_OrderData.companyno, tbl_OrderData.title, tbl_OrderData.status, tbl_OrderData.ord_id, 
                            tbl_OrderData.ordaddress, tbl_OrderData.atmcode, tbl_OrderData.card_code, tbl_OrderData.card_pan, 
                            tbl_OrderData.card_response, tbl_OrderData.paid, tbl_OrderData.ordgender, tbl_OrderData.email, tbl_OrderData.zip, 
                            tbl_OrderData.cityid, tbl_OrderData.countryid, tbl_OrderData.companyid, tbl_paymode.name AS paymodename, 
                            tbl_payStatus.name AS payStatusname, tbl_OrderData.invoice
FROM              tbl_OrderData INNER JOIN
                            tbl_Joindata ON tbl_OrderData.ord_code = tbl_Joindata.ord_code INNER JOIN
                            tbl_article ON tbl_Joindata.Articleid = tbl_article.articleId INNER JOIN
                            tbl_lesson ON tbl_Joindata.Articleid = tbl_lesson.articleId INNER JOIN
                            tbl_payStatus ON tbl_OrderData.status = tbl_payStatus.id INNER JOIN
                            tbl_paymode ON tbl_OrderData.paymode = tbl_paymode.id
                                WHERE          (tbl_OrderData.memberid = @memberid) and tbl_OrderData.status != 0
                                ORDER BY   tbl_OrderData.ord_code DESC ";

            NameValueCollection nvc = new NameValueCollection
            {
                { "memberid", memberid },
            };

            DataTable result = DbControl.Data_Get(strsql, nvc);


            return(result);
        }
Пример #6
0
        public static Mmemberdata Add(string email, string password, string account, string username = "", string phone = "")
        {
            Mmemberdata result = new Mmemberdata();

            if (account == "")
            {
                account = email;
            }
            //result = Check_exist(email);
            //if (result.Memberid == 0)
            //{
            string strsql           = @"insert  into tbl_MemberData ( email,password ,AccountId,phone,username)
                values  ( @email,@password,@AccountId,@phone ,@username) ";
            NameValueCollection nvc = new NameValueCollection
            {
                { "email", email },
                { "password", password },
                { "AccountId", account },
                { "username", username },
                { "phone", phone }
            };

            DbControl.Data_add(strsql, nvc);
            result = Login(account, password);
            Mail.Join_member(result.Memberid);
            // }

            return(result);
        }
Пример #7
0
    public void selectSQL(string sorttype = "desc", string sortColumn = "memberid")
    {
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("id", "0");
        string strsql = "select  * from  tbl_memberdata where   memberid >@id ";

        if (keyword.Text != "")
        {
            strsql += " and (  username like '%' + @keyword + '%'  or email like '%' + @keyword + '%' or phone like '%' + @keyword + '%' )";
            nvc.Add("keyword", keyword.Text);
        }
        if (sortColumn != "")
        {
            strsql += " ORDER BY  " + sortColumn + " " + sorttype;
        }
        else
        {
            strsql += " ORDER BY  memberid desc ";
        }

        DataTable dt = DbControl.Data_Get(strsql, nvc);

        ListView1.DataSource = dt;
        ListView1.DataBind();
    }
Пример #8
0
        public static Mmemberdata GetData(string memberid)
        {
            string strsql = @"select * from tbl_MemberData  where 
                memberid =@memberid ";

            NameValueCollection nvc = new NameValueCollection
            {
                { "memberid", memberid },
            };
            DataTable   dt = DbControl.Data_Get(strsql, nvc);
            Mmemberdata m  = new Mmemberdata();

            if (dt.Rows.Count > 0)
            {
                m.AccountId = dt.Rows[0]["AccountId"].ToString();
                m.Email     = dt.Rows[0]["email"].ToString();
                m.Memberid  = (int)dt.Rows[0]["memberid"];
                m.Phone     = dt.Rows[0]["Phone"].ToString();
                m.Password  = MySecurity.SimpleTripleDes(dt.Rows[0]["Password"].ToString());
                m.Username  = dt.Rows[0]["Username"].ToString();
                m.Address   = dt.Rows[0]["Address"].ToString();
                m.Zip       = dt.Rows[0]["zip"].ToString();
                m.Countyid  = dt.Rows[0]["Countyid"].ToString() == ""? 0:(int)dt.Rows[0]["Countyid"];
                m.Cityid    = dt.Rows[0]["Cityid"].ToString() == "" ? 0 : (int)dt.Rows[0]["Cityid"];
                m.Password  = dt.Rows[0]["password"].ToString();
                m.Kind      = dt.Rows[0]["Kind"].ToString();
                m.Birthday  = dt.Rows[0]["Birthday"].ToString() == "" ? DateTime.Parse("1911/1/1") : (DateTime )dt.Rows[0]["Birthday"];
            }
            return(m);
        }
 private void waitToBeNextSpeaker()
 {
     while (!DbControl.getInstance().checkNextSpeaker(simulationId, speaker))
     {
         Application.DoEvents();
     }
 }
        private void btnWait_Click(object sender, EventArgs e)
        {
            if (txtDatabase.Text == "")
            {
                MessageBox.Show("Please, choose a database file before start the simulation.");
                btnBrowseDatabase.Focus();
                return;
            }

            //Open connection
            //DbControl.getInstance().openConnection();//Now, the connection will be closed only when closed

            //Create Simulation
            simulationId = DbControl.getInstance().createSimulation(txtUserId.Text);

            //Wait for connection
            gbDatafile.Visible = false;
            btnWait.Visible    = false;
            gbWait.Visible     = true;
            btnCancel.Visible  = true;

            waitToBeNextSpeaker();

            //Open FormInteractionSimulation
            FormInteractionSimulation formInteractionSimulation = new FormInteractionSimulation();

            formInteractionSimulation.setSimulationId(simulationId);
            formInteractionSimulation.setSpeaker(speaker);
            formInteractionSimulation.setNextSpeaker(nextSpeaker);
            formInteractionSimulation.Show();
            this.Hide();
        }
Пример #11
0
    protected void Page_Init(object sender, EventArgs e)
    {
        string unitid = Request.QueryString["unitid"];


        string strsql           = "SELECT *  FROM    tbl_category_class where unitid =@unitid  ";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("unitid", unitid);

        DataTable dt = DbControl.Data_Get(strsql, nvc);

        classid = dt.Rows[0]["classid"].ToString();

        strsql = "SELECT *  FROM tbl_category where parentid =0 and classid=@classid ";
        nvc.Clear();
        nvc.Add("classid", classid);
        dt = DbControl.Data_Get(strsql, nvc);
        DropDownList2.Items.Add(new ListItem("設為上層", "0"));
        DropDownList1.Items.Add(new ListItem("第一層", "0"));
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DropDownList1.Items.Add(new ListItem(dt.Rows [i]["title"].ToString(), dt.Rows[i]["categoryid"].ToString()));
            DropDownList2.Items.Add(new ListItem(dt.Rows[i]["title"].ToString(), dt.Rows[i]["categoryid"].ToString()));
        }
        dt.Dispose();
    }
Пример #12
0
    public void selectSQL(string sorttype = "desc", string sortColumn = "p_id")
    {
        string strsql = " SELECT  * ,(select title from  tbl_category  where tbl_category.categoryid =  tbl_productdata.categoryid) as title   from  tbl_productdata    where status <> 'D' ";

        if (search_txt.Text != "")
        {
            int  n;
            bool isNumeric = int.TryParse(search_txt.Text, out n);
            strsql += @" and (memo like '%'+@S+'%'    or productname like '%'+@S+'%'   or description like '%'+@S+'%')  ";
        }
        if (DropDownList1.SelectedIndex > 0)
        {
            strsql += " and  categoryid = @categoryid";
        }

        strsql += " ORDER BY  sort," + sortColumn + " " + sorttype;

        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("S", search_txt.Text);
        nvc.Add("categoryid", DropDownList1.SelectedValue);
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        ListView1.DataSource = dt;
        ListView1.DataBind();
        dt.Dispose();
        MultiView1.ActiveViewIndex = 0;
    }
Пример #13
0
    protected void Page_Init(object sender, EventArgs e)
    {
        //DropDownList1.DataBound  += new EventHandler(DropDownList1_DataBound);
        DropDownList1.Items.Add(new ListItem("不區分", ""));
        string strsql           = "select * from tbl_category where parentid =0 and classid=@classid  and status<>'D' ";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("classid", "2");
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string name = dt.Rows[i]["title"].ToString();
            string id   = dt.Rows[i]["categoryid"].ToString();
            categoryid.Items.Add(new ListItem(name, id));
            DropDownList1.Items.Add(new ListItem(name, id));
        }
        dt.Dispose();
        categoryid.Items.Insert(0, new ListItem("請選擇", ""));

        nvc.Clear();
        nvc.Add("classid", "3");
        dt = DbControl.Data_Get(strsql, nvc);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string name = dt.Rows[i]["title"].ToString();
            string id   = dt.Rows[i]["categoryid"].ToString();
            supplierid.Items.Add(new ListItem(name, id));
        }
        dt.Dispose();
        supplierid.Items.Insert(0, new ListItem("請選擇", ""));
    }
        /// <summary>
        /// Обновление [Выпуска изделий] (dbf izd_rasc)
        /// </summary>
        public static void Update(RealaseProduct realaseProduct)
        {
            var          dbFolder = Properties.Settings.Default.FoxProDbFolder_Foxpro_Trudnorm;
            const string update   = "UPDATE [izd_rasc] SET vypusk = ? WHERE detal = ?";

            try
            {
                using (var oleDbConnection = DbControl.GetConnection(dbFolder))
                {
                    oleDbConnection.TryConnectOpen();

                    using (var oleDbCommand = new OleDbCommand(update, oleDbConnection))
                    {
                        oleDbCommand.Parameters.AddWithValue("@vypusk", realaseProduct.Realase);
                        oleDbCommand.Parameters.AddWithValue("@detal", realaseProduct.CodeDetail);

                        oleDbCommand.ExecuteNonQuery();
                    }
                }
            }
            catch (OleDbException ex)
            {
                throw DbControl.HandleKnownDbFoxProAndMssqlServerExceptions(ex);
            }
        }
Пример #15
0
        /// <summary>
        /// Проверка на дубликат
        /// </summary>
        public static bool IsDublicate(long productId, long materialId, string workGuildId, string parcelId)
        {
            const string query = "SELECT * FROM [Nu65DB].[dbo].[Nu65Table] " +
                                 "WHERE [productsId] = @productsId and [materialsId] = @materialsId and " +
                                 "[workGuildId] = @workGuildId and [parcelId] = @parcelId";
            var server = Properties.Settings.Default.SqlServerNu65;
            var db     = Properties.Settings.Default.SqlDbNu65Db;

            try
            {
                using (var connection = DbControl.GetConnection(server, db))
                {
                    connection.TryConnectOpen();

                    using (var sqlCommand = new SqlCommand(query, connection))
                    {
                        sqlCommand.Parameters.AddWithValue("@productsId", productId);
                        sqlCommand.Parameters.AddWithValue("@materialsId", materialId);
                        sqlCommand.Parameters.AddWithValue("@workGuildId", workGuildId);
                        sqlCommand.Parameters.AddWithValue("@parcelId", parcelId);
                        using (var reader = sqlCommand.ExecuteReader())
                        {
                            return(reader.HasRows);
                        }
                    }
                }
            }
            catch (SqlException ex)
            {
                throw DbControl.HandleKnownDbFoxProAndMssqlServerExceptions(ex);
            }
        }
Пример #16
0
        public async System.Threading.Tasks.Task <object> PostClienteAsync(ClienteViewModel viewModel)
        {
            try
            {
                OracleCommand orcCommand = new OracleCommand();

                orcCommand.Parameters.add(new OracleParameter("V_CEP", viewModel.CEP));
                orcCommand.Parameters.add(new OracleParameter("V_CIDADE", viewModel.Cidade));
                orcCommand.Parameters.add(new OracleParameter("V_DATANASCIMENTO", viewModel.DataNascimento));
                orcCommand.Parameters.add(new OracleParameter("V_ENDERECO", viewModel.Endereco));
                orcCommand.Parameters.add(new OracleParameter("V_ESTADO", viewModel.Estado));
                orcCommand.Parameters.add(new OracleParameter("V_NOME", viewModel.Nome));
                orcCommand.Parameters.add(new OracleParameter("V_SOBRENOME", viewModel.Sobrenome));

                var result = await DbControl.ExecuteProcWithReturnAsync(
                    StoredProcedure.InsertCliente,
                    orcCommand);

                return(result);
            }
            catch (Exception x)
            {
                //TODO: Adicionar log para Exception
                return(new HttpResponseMessage(System.Net.HttpStatusCode.ExpectationFailed));
            }
        }
Пример #17
0
    public static string get_lesson(string kind)
    {
        string result = "{ \"main\":[";

        if (kind == "get")
        {
            string strsql           = "SELECT *  FROM tbl_Lesson where status='Y'  ";
            NameValueCollection nvc = new NameValueCollection();
            DataTable           dt  = DbControl.Data_Get(strsql, nvc);
            //result = JsonConvert.SerializeObject(dt);
            int i = 0;
            for (i = 0; i < dt.Rows.Count; i++)
            {
                if (i != 0)
                {
                    result += ",";
                }
                result += "{\"name\":\"" + dt.Rows[i]["subject"].ToString() + "\",\"id\":\"" + dt.Rows[i]["lessonid"].ToString() + "\"}";
            }

            dt.Dispose();
        }
        result += "]}";
        return(result);
    }
Пример #18
0
        public static string Is_collection(string memberid, string articleId)
        {
            string result = "";
            string strsql = @"select * from     tbl_articleCollection where articleId =@articleId 
                and memberid =@memberid";

            NameValueCollection nvc = new NameValueCollection
            {
                { "memberid", memberid },
                { "articleId", articleId }
            };

            DataTable dt = DbControl.Data_Get(strsql, nvc);

            if (dt.Rows.Count == 0)
            {
                result = "";
            }

            else
            {
                result = "Y";
            }
            dt.Dispose();

            return(result);
        }
Пример #19
0
    public static string Set_active(string unitid, string thisid)
    {
        string msg = "";

        if (thisid == unitid)
        {
            msg = "class=\"active\"";
        }
        if (thisid != null)
        {
            string strsql           = "select * from unitdata where unitid=" + thisid;
            NameValueCollection nvc = new NameValueCollection();
            DataTable           dt  = DbControl.Data_Get(strsql, nvc);
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows [0]["upperid"].ToString() == unitid)
                {
                    msg = "class=\"active open\"";
                }
            }
            dt.Dispose();
            nvc.Clear();
        }

        return(msg);
    }
Пример #20
0
        public static Mmemberdata Update(Mmemberdata m)
        {
            string strsql = @"update tbl_MemberData set email=@email,
            username=@username
            ,phone=@phone
            ,mobile=@mobile
            ,cityid=@cityid 
            ,countyid=@countyid
            ,zip=@zip,birthday=@birthday
            ,address=@address,password=@password where  memberid=@memberid";

            NameValueCollection nvc = new NameValueCollection
            {
                { "username", m.Username },
                { "email", m.Email },
                { "phone", m.Phone },
                { "mobile", m.Mobile },
                { "cityid", m.Cityid.ToString() },
                { "countyid", m.Countyid.ToString() },
                { "zip", m.Zip },
                { "address", m.Address },
                { "birthday", m.Birthday.ToString("yyyy/MM/dd") },
                { "password", m.Password },
                { "memberid", m.Memberid.ToString() }
            };

            DbControl.Data_add(strsql, nvc);
            return(m);
        }
Пример #21
0
        public static object Tbl_article_tag(int id, string kind = "dt")
        {
            NameValueCollection nvc = new NameValueCollection();
            string strsql           = @"select tbl_article_tag.articleId, tbl_article_tag.tagid, tbl_article_tag.unitid,
            tbl_tag.tagname, tbl_tag.pic, tbl_tag.contents, tbl_tag.title
                FROM     tbl_article_tag INNER JOIN tbl_tag ON tbl_article_tag.tagid = tbl_tag.tagid
                where tbl_article_tag.articleId=@id ";

            nvc.Add("id", id.ToString());
            DataTable dt = DbControl.Data_Get(strsql, nvc);
            {
                if (kind == "dt")
                {
                    return(dt);
                }
                else
                {
                    List <article.Lecturer> Lecture = new List <article.Lecturer>();
                    int i = 0;
                    for (i = 0; i < dt.Rows.Count; i++)
                    {
                        Lecture.Add(new article.Lecturer
                        {
                            Id       = (int)dt.Rows[i]["tagid"],
                            Title    = (string)dt.Rows[i][" Title"],
                            Subject  = (string)dt.Rows[i]["tagname"],
                            Contents = (string)dt.Rows[i]["Contents"],
                            Pic      = (string)dt.Rows[i]["Contents"]
                        });
                    }
                    dt.Dispose();
                    return(Lecture);
                }
            }
        }
Пример #22
0
    protected void link_edit(object sender, System.EventArgs e)
    {
        MultiView1.ActiveViewIndex = 1;
        LinkButton obj = sender as LinkButton;

        Selected_id.Value = obj.CommandArgument;
        o = OrderLib.Get_ordData(Selected_id.Value);
        payStatus.SelectedValue    = o.Status;
        MultiView1.ActiveViewIndex = 1;
        LessonLib.JoinData l = LessonLib.Web.Get_ord_JoinData(o.Ord_code);
        joindata.Visible     = false;
        companyno.Text       = o.Companyno;
        title.Text           = o.Title;
        Repeater1.DataSource = o.OrderDetail;
        Repeater1.DataBind();
        if (l.JoinDetail != null)
        {
            joindata.Visible      = true;
            Lstatus.SelectedValue = l.JoinDetail[0].Status;
        }
        paymode.SelectedValue    = o.Paymode;
        Btn_save.CommandArgument = "edit";
        string strsql           = "select * from Log_Sms where ord_code=@ord_code";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("ord_code", Selected_id.Value);
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        Repeater2.DataSource = dt;
        Repeater2.DataBind();
    }
Пример #23
0
        public static article.LessonDetail Get_LessonClass(int id)
        {
            NameValueCollection nvc = new NameValueCollection();
            string strsql           = "select * from   tbl_lesson_class  ";

            strsql += "where lessonId =@id";
            nvc.Add("id", id.ToString());

            DataTable dt = DbControl.Data_Get(strsql, nvc);

            article.LessonDetail MainData = new article.LessonDetail();
            int i = 0;

            for (i = 0; i < dt.Rows.Count; i++)
            {
                MainData.Id          = (int)dt.Rows[i]["articleId"];
                MainData.Price       = (int)dt.Rows[i]["Price"];
                MainData.Description = (string)dt.Rows[i]["description"];
                MainData.Sellprice   = (int)dt.Rows[i]["Sellprice"];
                MainData.Limitnum    = (int)dt.Rows[i]["limitnum"];
                MainData.LessonId    = (int)dt.Rows[i]["lessonId"];
            }
            dt.Dispose();
            return(MainData);
        }
Пример #24
0
    protected void btn_del_Click(object sender, System.EventArgs e)
    {
        string strsql = "delete from tbl_banner  where bannerid = @id";
        int    i      = DbControl.Data_delete(strsql, Selected_id.Value);

        ListView1.DataBind();
    }
Пример #25
0
        public static object Get_lecturer(string kind = "dt")
        {
            NameValueCollection nvc = new NameValueCollection();
            string    strsql        = "select * from       tbl_tag  where unitid=14 ";
            DataTable dt            = DbControl.Data_Get(strsql, nvc);

            if (kind == "dt")
            {
                dt.Dispose();
                return(dt);
            }
            else
            {
                List <article.Lecturer> Lecture = new List <article.Lecturer>();
                int i = 0;
                for (i = 0; i < dt.Rows.Count; i++)
                {
                    Lecture.Add(new article.Lecturer
                    {
                        Id       = (int)dt.Rows[i]["tagid"],
                        Subject  = (string)dt.Rows[i]["tagname"],
                        Contents = (string)dt.Rows[i]["Contents"],
                        Pic      = (string)dt.Rows[i]["Contents"]
                    });
                }
                dt.Dispose();
                return(Lecture);
            }
        }
        public async System.Threading.Tasks.Task <object> PostReclamacaoAsync(ReclamacaoInstalacaoViewModel viewModel)
        {
            try
            {
                OracleCommand orcCommand = new OracleCommand();

                orcCommand.Parameters.add(new OracleParameter("V_CODIGOCLIENTE", viewModel.CodigoCliente));
                orcCommand.Parameters.add(new OracleParameter("V_CODIGOINSTALACAO", viewModel.CodigoInstalacao));
                orcCommand.Parameters.add(new OracleParameter("V_CODIGOREGIAO", viewModel.CodigoRegiao));
                orcCommand.Parameters.add(new OracleParameter("V_DATACADASTRO", viewModel.DataCadastro));
                orcCommand.Parameters.add(new OracleParameter("V_DESCRICAOOPCIONAL", viewModel.DescricaoOpcional));
                orcCommand.Parameters.add(new OracleParameter("V_STATUS", viewModel.Status));

                var result = await DbControl.ExecuteProcWithReturnAsync(
                    StoredProcedure.InsertReclamacaoInstalacao,
                    orcCommand);

                return(result);
            }
            catch (Exception x)
            {
                //TODO: Adicionar log para Exception
                return(new HttpResponseMessage(System.Net.HttpStatusCode.ExpectationFailed));
            }
        }
Пример #27
0
    void deleteBrickImage(string now_id)
    {
        foreach (RepeaterItem item in Repeater_image.Items)
        {
            CheckBox    chk   = (CheckBox)(item.FindControl("chk_del"));
            HiddenField imgid = (HiddenField)(item.FindControl("img_id"));
            if (chk.Checked)
            {
                string strsql           = "delete from   tbl_article_file  where imgid=@imgid ";
                NameValueCollection nvc = new NameValueCollection();

                nvc.Clear();
                nvc.Add("imgid", imgid.Value);
                int i = DbControl.Data_add(strsql, nvc);
            }
        }

        foreach (RepeaterItem item in Repeater_file.Items)
        {
            CheckBox    chk   = (CheckBox)(item.FindControl("chk_del"));
            HiddenField imgid = (HiddenField)(item.FindControl("file_id"));
            if (chk.Checked)
            {
                string strsql           = "delete from   tbl_article_file  where imgid=@imgid ";
                NameValueCollection nvc = new NameValueCollection();
                nvc.Clear();
                nvc.Add("imgid", imgid.Value);
                int i = DbControl.Data_add(strsql, nvc);
            }
        }
    }
        /// <summary>
        /// Установление признака детали в бд
        /// </summary>
        public static void UpdateIsCalculate(bool isCalculate, DetailCalculate detailCalculate)
        {
            var          dbFolder = Properties.Settings.Default.FoxProDbFolder_Foxpro_Trudnorm;
            const string update   = "UPDATE [izd_rasc] SET pr_rasc = ? WHERE detal = ?";

            try
            {
                using (var oleDbConnection = DbControl.GetConnection(dbFolder))
                {
                    oleDbConnection.TryConnectOpen();

                    using (var oleDbCommand = new OleDbCommand(update, oleDbConnection))
                    {
                        oleDbCommand.Parameters.AddWithValue("@pr_rasc", isCalculate ? "+" : "");
                        oleDbCommand.Parameters.AddWithValue("@detal", detailCalculate.CodeDetail);

                        oleDbCommand.ExecuteNonQuery();
                    }
                }
            }
            catch (OleDbException ex)
            {
                throw DbControl.HandleKnownDbFoxProAndMssqlServerExceptions(ex);
            }
        }
Пример #29
0
    public void selectSQL()
    {
        string strsql           = "select* from tbl_article_file where  status <> 'D' and  (articleid =@articleid or tempid=@articleId) and kind='P' order by sort";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("articleid", Session["uploadid"].ToString());
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        Repeater_image.DataSource = dt;
        if (Request.QueryString ["type"] == "image")
        {
            Repeater_image.DataBind();
        }


        dt.Dispose();
        strsql = "select* from tbl_article_file where  status <> 'D' and  (articleid =@articleid or tempid=@articleId) and kind='F' order by sort";
        dt     = DbControl.Data_Get(strsql, nvc);
        Repeater_file.DataSource = dt;
        if (Request.QueryString["type"] == "file")
        {
            Repeater_file.DataBind();
        }
        ;

        dt.Dispose();
        nvc.Clear();
    }
Пример #30
0
    //編輯
    protected void link_edit(object sender, System.EventArgs e)
    {
        LinkButton obj = sender as LinkButton;

        Selected_id.Value          = obj.CommandArgument;
        MultiView1.ActiveViewIndex = 1;
        Btn_save.CommandArgument   = "edit";

        string strsql           = "select * from tbl_banner where bannerid=@bannerid";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("bannerid", Selected_id.Value);
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        t_title.Text           = dt.Rows[0]["title"].ToString();
        t_url.Text             = dt.Rows[0]["url"].ToString();
        t_sort.Text            = dt.Rows[0]["sort"].ToString();
        t_status.SelectedValue = dt.Rows[0]["status"].ToString();
        t_targetblank.Text     = dt.Rows[0]["targetblank"].ToString();
        sdate.Text             = DateTime.Parse(dt.Rows[0]["enabledate"].ToString()).ToString("yyyy/MM/dd");
        stime.SelectedValue    = DateTime.Parse(dt.Rows[0]["enabledate"].ToString()).Hour.ToString();
        Literal1.Text          = "<img src=\"../webimages/banner/" + dt.Rows[0]["filename"].ToString() + "\" height =\"200\"/>";
        HiddenField1.Value     = dt.Rows[0]["filename"].ToString();
        contents.Text          = dt.Rows[0]["contents"].ToString();

        DropDownList2.SelectedIndex =
            DropDownList2.Items.IndexOf(DropDownList2.Items.FindByValue(dt.Rows[0]["categoryid"].ToString()));

        DropDownList3.SelectedIndex =
            DropDownList3.Items.IndexOf(DropDownList3.Items.FindByValue(dt.Rows[0]["articleId"].ToString()));
        articleId = dt.Rows[0]["articleId"].ToString();

        if (dt.Rows[0]["disabledate"].ToString() != "")
        {
            DateTime ee = DateTime.Parse(dt.Rows[0]["disabledate"].ToString());
            edate.Text          = ee.ToString("yyyy/MM/dd");
            etime.SelectedValue = ee.Hour.ToString();
        }
        else
        {
            edate.Text = "";
        }

        dt.Dispose();
        strsql = "select * from tbl_recommend where bannerid=@bannerid";
        dt     = DbControl.Data_Get(strsql, nvc);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            foreach (ListItem li in classid.Items)
            {
                if (dt.Rows [i]["classid"].ToString() == li.Value)
                {
                    li.Selected = true;
                }
            }
        }

        dt.Dispose();
    }
Пример #31
0
    private void Page_Load(object sender, System.EventArgs e)
    {
        cnString = ConfigurationSettings.AppSettings["connectionstring"].ToString();
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);

            /* List<string> list1 = new List<string>();
             string ll = getHours("trtd16:00,1:00/td td width=\"20\"/tdtd class=\"w2b\"â/td/trtrtd20:30/td td width=\"20\"/tdtd class=\"w2b\"ã/td/trtrtd/td td width=\"20\"/tdtd class=\"w2b\"/td/tr".Replace(">", "").Replace("<", ""),
                 list1);
             Response.Write("Count:" + list1.Count+" ");
             ll = getHours(ll, list1);
             Response.Write("Count:" + list1.Count + " ");
             List<string> list2 = new List<string>();
             ll = getHours(ll, list2);
             Response.Write("Count:" + list2.Count + " ");
             return;
             */
            string page = readPage1("http://movies.walla.co.il");
            //string filterArr[] = page.Split('dropdown_selection'); // all code before dropdown_selection is unneeded
            string[] pageLines = page.Split('\n');
            DbControl dbControl = new DbControl();
            foreach (string line in pageLines)
            {
                string strToFind = "onclick=\"location.href='/movie/";
                int index = line.IndexOf(strToFind);
                string movieId;
                if (index > 0)
                {
                    movieId = line.Substring(index + strToFind.Length, 4);
                    Match movieIdMatch = Regex.Match(movieId, "[0-9]*", RegexOptions.IgnoreCase);
                    movieId = movieIdMatch.Value;

                    string movieUrl = line.Substring(line.IndexOf(strToFind) + strToFind.Length);
                    movieUrl = movieUrl.Substring(0, movieUrl.IndexOf("';"));
                    string moviePage = readPage1("http://movies.walla.co.il/movie/" + movieUrl);
                    string hebrewName = getStringInBetween(moviePage, "class=\"right block\">", "</span>");
                    string englishName = getStringInBetween(moviePage, "class=\"left block\">", "</span>");

                    if (dbControl.hasMovie(movieId) == true)
                        continue;

                    Response.Write("<BR>" + "movie:" + movieId + "<BR>");
                    Match imageMatch = Regex.Match(line, "http://msc.wcdn.co.il/archive/[0-9-]*.jpg", RegexOptions.IgnoreCase);
                    string movieIcon = "";
                    if (imageMatch.Success)
                    {
                        movieIcon = imageMatch.Value;
                        Response.Write(movieIcon + "<BR>");
                    }
                    dbControl.addMovie(movieId, hebrewName, englishName, movieIcon);

                    string findCinemasUrl = @"http://movies.walla.co.il/?w=/@ajax.movie.projections&movie_id=" + movieId;
                    //http://movies.walla.co.il/?w=/@ajax.movie.projection.time&movie_id=4673&cinema_id=38
                    string cinemasPage = readPage1(findCinemasUrl);
                    string[] cinemasPageLines = cinemasPage.Split('\n');
                    List<string> cinemasList = new List<string>();
                    List<string> cinemasIdList = new List<string>();

                    foreach (string cinemasLine in cinemasPageLines)
                    {
                        string cinemasLineStrip = cinemasLine.ToLower();
                        strToFind = "\"w3b\"";
                        int indexStart = cinemasLineStrip.IndexOf(strToFind);
                        int indexEnd = cinemasLineStrip.IndexOf("</a>");
                        string cinemaLineSuf;
                        if (indexEnd > 0)
                        {
                            cinemaLineSuf = cinemasLineStrip.Substring(indexStart + strToFind.Length, indexEnd - (indexStart + strToFind.Length));
                            //MatchCollection matches = Regex.Matches("[a-zA-Z0-9]*", cinemasLineStrip, RegexOptions.IgnoreCase);
                            MatchCollection matches = Regex.Matches(cinemaLineSuf, "[a-zà-ú\\- ]*", RegexOptions.IgnoreCase);
                            if (indexStart > 0 && indexEnd > 0)
                            {
                                foreach (Match match1 in matches)
                                {
                                    string cinema = match1.Value;
                                    if (cinema.Length > 1)
                                    {
                                        cinemasList.Add(cinema);
                                        Response.Write(cinema);
                                    }
                                }
                            }
                        }
                        strToFind = "/?w=/";
                        indexStart = cinemasLineStrip.IndexOf(strToFind);
                        indexEnd = cinemasLineStrip.IndexOf("/@cinema");
                        if (indexStart > 0 && indexEnd > 0)
                        {
                            string cinemaId = cinemasLineStrip.Substring(indexStart + strToFind.Length, indexEnd - (indexStart + strToFind.Length));
                            cinemasIdList.Add(cinemaId);
                            Response.Write(cinemaId + "<BR>");

                            string timesPage = readPage1(@"http://movies.walla.co.il/?w=/@ajax.movie.projection.time&movie_id=" + movieId + "&cinema_id=" + cinemaId);
                            //Response.Write(timesPage+"<BR>");
                            string[] timesPageLines = timesPage.Split(new string[] { "</tr>" }, StringSplitOptions.RemoveEmptyEntries);
                            List<DateTime> dates = new List<DateTime>();
                            foreach (string timesLine in timesPageLines)
                            {

                                if (timesLine.Replace("<BR>", "").Replace(">", "").Replace("<", "").Replace(" ", "").Length < 4)
                                    continue;
                                GetTimesAndDays(timesLine, dates);
                            }
                            if (dates != null && dates.Count > 0)
                                dbControl.addMovieTimes(Int32.Parse(movieId), dates, Int32.Parse(cinemaId));
                        }
                    }
                }
                strToFind = "</span>";
                index = line.IndexOf(strToFind);
                Match match = Regex.Match(line, "[à-ú]");
                if (line.Replace("\t", "").Replace(" ", "").StartsWith(strToFind) && match.Success && index > 0 && line.Length > index + strToFind.Length)
                {
                    string name = line.Substring(index + strToFind.Length, line.Length - (index + strToFind.Length));
                    //	Response.Write(name + "<BR>");
                    //	Response.Write("found: " + line.Replace("<","") + "<br>");
                }

            }
    }