Exemplo n.º 1
0
        public void FilterAuditLogs(SqlDataSource logDataSource, DateTime from, DateTime to, string UserName = "")
        {
            StringBuilder strCommand = new StringBuilder();

            strCommand.Append("SELECT [ActionTaken], [DTStamp] FROM [AuditTrail] where DTStamp between '" + from.ToString() + "' and '" + to.ToString() + "' ");
            if (!string.IsNullOrEmpty(UserName))
            {
                strCommand.Append(" and UserName='******'");
            }
            strCommand.Append(" ORDER BY [DTStamp] DESC ");
            logDataSource.SelectCommand = strCommand.ToString();
            logDataSource.DataBind();
        }
    public static string report_build_report(string param1, string param2)
    {
        string results = "";

        string score_content = param2.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();

        string startd = DateTime.Now.Date.ToString("yyyy-MM-dd");
        string starth = Convert.ToInt32(DateTime.Now.ToString("HH")).ToString();
        string startm = DateTime.Now.Minute.ToString();
        string starts = DateTime.Now.Second.ToString();
        string start  = startd + " " + starth + ":" + startm + ":" + starts;

        SqlDataSource sql_f = new SqlDataSource();

        sql_f.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        sql_f.UpdateCommand    = "update user_information_appointment_check_deal set check_success=5 where id='" + param1 + "';";
        sql_f.Update();

        SqlDataSource sql_insert = new SqlDataSource();

        sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        sql_insert.InsertCommand    = "insert into user_information_appointment_check_deal_score(uiacdid,check_time,score_message)";
        sql_insert.InsertCommand   += " values('" + param1 + "','" + start + "','" + score_content + "');";
        sql_insert.Insert();

        sql_f = new SqlDataSource();
        sql_f.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        sql_f.SelectCommand    = "select uid,suppid";
        sql_f.SelectCommand   += " from user_information_appointment_check_deal";
        sql_f.SelectCommand   += " where id='" + param1 + "';";
        sql_f.DataBind();
        DataView ict_f = (DataView)sql_f.Select(DataSourceSelectArguments.Empty);

        if (ict_f.Count > 0)
        {
            sql_insert = new SqlDataSource();
            sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql_insert.InsertCommand    = "insert into user_chat_room(uid,to_uid,talk_message,year,month,day,hour,minute,second)";
            sql_insert.InsertCommand   += " values('" + ict_f.Table.Rows[0]["uid"].ToString() + "','" + ict_f.Table.Rows[0]["suppid"].ToString() + "','【評価送付完了】','" + DateTime.Now.Year.ToString() + "','" + DateTime.Now.Month.ToString() + "','" + DateTime.Now.Day.ToString() + "','" + Convert.ToInt32(DateTime.Now.ToString("HH")).ToString() + "','" + DateTime.Now.Minute.ToString() + "','" + DateTime.Now.Second.ToString() + "')";
            sql_insert.Insert();

            sql_insert = new SqlDataSource();
            sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql_insert.InsertCommand    = "insert into user_chat_room(uid,to_uid,talk_message,year,month,day,hour,minute,second)";
            sql_insert.InsertCommand   += " values('" + ict_f.Table.Rows[0]["uid"].ToString() + "','" + ict_f.Table.Rows[0]["suppid"].ToString() + "','" + score_content + "','" + DateTime.Now.Year.ToString() + "','" + DateTime.Now.Month.ToString() + "','" + DateTime.Now.Day.ToString() + "','" + Convert.ToInt32(DateTime.Now.ToString("HH")).ToString() + "','" + DateTime.Now.Minute.ToString() + "','" + DateTime.Now.Second.ToString() + "');";
            sql_insert.Insert();
        }


        return(results);
    }
Exemplo n.º 3
0
        public SqlDataSource SearchBookAdjustments(SqlDataSource adjustment_data_source, string search_paramenter, string Brand)
        {
            string search_query = string.Empty;

            search_query = "SELECT [RECORD_NO], [INVENTORY_DATE], [CUT_OFF_DATE], [OUTLET_NAME], [DATE_RECORDED], [ADJUSTMENT_CODE] FROM [BOOK_ADJUSTMENTS] ";
            if (search_paramenter != string.Empty)
            {
                search_query += " WHERE OUTLET_NAME LIKE '%" + search_paramenter + "%' ";
            }
            search_query += " ORDER BY DATE_RECORDED DESC";
            adjustment_data_source.SelectCommand = search_query;
            adjustment_data_source.DataBind();
            return(adjustment_data_source);
        }
Exemplo n.º 4
0
        public void SearchUserAccounts(SqlDataSource userAccountDataSource, string searchParameter)
        {
            StringBuilder strCommand = new StringBuilder();

            strCommand.Append("SELECT [ID], [FullName], [UserName], [image],[ContactNumber] FROM [Users] ");

            if (!string.IsNullOrEmpty(searchParameter))
            {
                strCommand.Append(" Where Users.UserName like '%" + searchParameter + "%' or Users.FullName like '%" + searchParameter + "%' ");
            }

            userAccountDataSource.SelectCommand = strCommand.ToString();
            userAccountDataSource.DataBind();
        }
Exemplo n.º 5
0
    protected void Page_LoadComplete(object sender, EventArgs e)
    {
        // awarding committee
        SqlDataSource dsApprover = (SqlDataSource)bac_bidApprovingCommittee1.FindControl("dsApprover");

        dsApprover.SelectCommand = "select BACId, NAME1, ApprovingLimit, ApprovedDt from ( SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_1 ApprovedDt, 1 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_1 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_2 ApprovedDt, 2 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_2 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_3 ApprovedDt, 3 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_3 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_4 ApprovedDt, 4 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_4 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_5 ApprovedDt, 5 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_5 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_6 ApprovedDt, 6 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_6 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_7 ApprovedDt, 7 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_7 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_8 ApprovedDt,  8 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_8 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_9 ApprovedDt,  9 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2   WHERE t1.BACId = t2.Approver_9 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t2.ApprovedDt_10 ApprovedDt, 10 AS ApprovingLimit  FROM tblBidAwardingCommittee t1, tblBacBidItems t2 WHERE t1.BACId = t2.Approver_10 AND t2.BidRefNo = " + Session["BuyerBidForBac"] + ") as table_1 order by ApprovingLimit";
        dsApprover.DataBind();
        Repeater RepeaterApprover1 = (Repeater)bac_bidApprovingCommittee1.FindControl("RepeaterApprover1");

        RepeaterApprover1.DataSourceID = null;
        RepeaterApprover1.DataBind();
        RepeaterApprover1.DataSourceID = "dsApprover";
        RepeaterApprover1.DataBind();
    }
Exemplo n.º 6
0
        public void SearchOnlineUserAccounts(SqlDataSource userAccountDataSource, string SearchParameter)
        {
            StringBuilder strCommand = new StringBuilder();

            strCommand.Append("SELECT  Users.ID, Users.FullName, Users.UserName, lstDept.ListDesc AS Department, lstUserLevel.ListDesc AS UserLevel, Users.Email,Users.ContactNumber,Users.image,Users.IsActive FROM Users INNER JOIN lstDept ON Users.DeptID = lstDept.ID INNER JOIN lstUserLevel ON Users.UserLevelID = lstUserLevel.ID where Users.IsOnline=1 ");

            if (!string.IsNullOrEmpty(SearchParameter))
            {
                strCommand.Append(" and Users.UserName like '%" + SearchParameter + "%' or Users.FullName like '%" + SearchParameter + "%' ");
            }

            strCommand.Append(" order by ID DESC");
            userAccountDataSource.SelectCommand = strCommand.ToString();
            userAccountDataSource.DataBind();
        }
Exemplo n.º 7
0
        public SqlDataSource SearchPCountAdjustmentDataSource(SqlDataSource adjusment_data_source, string search_parameter, string Brand)
        {
            string search_query = string.Empty;

            search_query = "SELECT [RECORD_NO], [INVENTORY_DATE], [CUT_OFF_DATE], [OUTLET_NAME], [DATE_RECORDED],[ADJUSTMENT_CODE] FROM [ADJUSTMENTS] INNER JOIN CustInfo ON ADJUSTMENTS.OUTLET_NUMBER = CustInfo.CustNo  ";
            if (search_parameter != string.Empty)
            {
                search_query += " WHERE [OUTLET_NAME] LIKE '%" + search_parameter + "%' ";
            }

            search_query += "ORDER BY RECORD_NO DESC";
            adjusment_data_source.SelectCommand = search_query;
            adjusment_data_source.DataBind();
            return(adjusment_data_source);
        }
Exemplo n.º 8
0
        public void SearchCustomerReturnSlip(SqlDataSource DataSource, string PostedStatus, string search_parameter)
        {
            string CommandText = string.Empty;

            CommandText = "SELECT [ID], [CRSID], [CRSNo], [CRSDate], [Customer], [PUSNo], [TotalAmt], [PkgNo], [ItemStatus] FROM [CRS] ";
            if (PostedStatus != "CONFIRMED")
            {
                if (search_parameter != string.Empty)
                {
                    CommandText += " WHERE  ";
                    if (PostedStatus == "POSTED")
                    {
                        CommandText += " ynPosted=1 AND ynCancelled=0";
                    }
                    else
                    {
                        CommandText += " ynPosted=0 AND ynCancelled=0";
                    }

                    CommandText += " AND CRSNo LIKE '%" + search_parameter + "%' OR  Customer LIKE '%" + search_parameter + "%'";
                }
                else
                {
                    if (PostedStatus == "POSTED")
                    {
                        CommandText += " WHERE ynPosted=1 AND ynCancelled=0";
                    }
                    else
                    {
                        CommandText += " WHERE ynPosted=0 AND ynCancelled=0";
                    }
                }
            }
            else
            {
                if (search_parameter != string.Empty)
                {
                    CommandText += " WHERE CRSNo LIKE '%" + search_parameter + "%' OR  Customer LIKE '%" + search_parameter + "%' ";
                    CommandText += " AND ynCancelled=1";
                }
                else
                {
                    CommandText += " WHERE ynCancelled=1";
                }
            }
            DataSource.SelectCommand = CommandText;
            DataSource.DataBind();
        }
Exemplo n.º 9
0
        public void SearchCustomer(SqlDataSource customerDataSource, string searchParameter, long groupNumber, string brandName = "")
        {
            StringBuilder strCommand = new StringBuilder();

            strCommand.Append("SELECT CustInfoEx.CustNo, CustInfoEx.CompName, CustInfoEx.brand,CustInfoEx.MainCustNo FROM CustInfoEx where  CustInfoEx.MainCustNo is not null and CustNo NOT IN(SELECT CUSTOMER_INVENTORY_GROUPS.CUSTOMER_NUMBER from CUSTOMER_INVENTORY_GROUPS Where CUSTOMER_INVENTORY_GROUPS.INVENTORY_GROUP_ID=" + groupNumber + ") ");
            if (!string.IsNullOrEmpty(searchParameter))
            {
                strCommand.Append(" AND CustInfoEx.CompName LIKE '%" + searchParameter + "%'");
            }

            if (brandName != "")
            {
                strCommand.Append(" and CustInfoEx.brand='" + brandName + "' ");
            }

            customerDataSource.SelectCommand = strCommand.ToString();
            customerDataSource.DataBind();
        }
Exemplo n.º 10
0
    public void BindGrid(string query, string dsID, GridView g, Page p)
    {
        SqlDataSource sql = new SqlDataSource(System.Configuration.ConfigurationManager.ConnectionStrings["SQLConnstr"].ConnectionString, query);

        sql.ID = dsID;
        sql.DataBind();
        sql.Dispose();
        Control c = p.FindControl(dsID);

        if (c == null)
        {
            p.Controls.Add(sql);
        }
        g.DataSourceID = dsID;
        g.AllowPaging  = true;
        g.AllowSorting = true;
        g.DataBind();
    }
Exemplo n.º 11
0
        public void SearchCustomer(SqlDataSource customerDataSource, string searchParameter, string brandName = "")
        {
            StringBuilder strCommand = new StringBuilder();

            strCommand.Append("SELECT [CustNo], [CompName], [brand],[MainCustNo] FROM [CustInfoEx] WHERE [MainCustNo] is not null ");
            if (!string.IsNullOrEmpty(searchParameter))
            {
                strCommand.Append(" AND CompName LIKE '%" + searchParameter + "%'");
            }

            if (brandName != "")
            {
                strCommand.Append(" and brand='" + brandName + "' ");
            }

            customerDataSource.SelectCommand = strCommand.ToString();
            customerDataSource.DataBind();
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AId"] == null)
            {
                Response.Redirect("~/admin/default.aspx");
            }


            SqlDataSource SqlDataSource1 = new SqlDataSource();

            SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlDataSource1.SelectCommand    = "SELECT [category_id], [category_name] FROM [Category]";

            SqlDataSource1.DataBind();

            GridView1.DataSource = SqlDataSource1;
            GridView1.DataBind();
            SqlDataSource1.Dispose();
        }
Exemplo n.º 13
0
    } //ok

    protected void btn_get_customer_entry_Sheetcount_OnClick(object sender, EventArgs e)
    {
        var startDate = dr_year0.Text + "/" + dr_month0.Text + "/" + dr_day0.Text;
        var endDate   = dr_year1.Text + "/" + dr_month1.Text + "/" + dr_day1.Text;
        var ds        = new SqlDataSource
        {
            // production
            //ConnectionString = "Server=server\\server;Database=flower_depot;User ID=sa;Password=Taghdis000",

            //development
            ConnectionString = "Data Source=.;Initial Catalog=flower_depot;Integrated Security=True",

            //SelectCommand = "SELECT '" + dr_cus_entr_sheetcount.SelectedItem.Text + "' as customer_name ," +
            //                " '" + dr_company.SelectedItem.Text + "' as company_name ," +
            //                " SUM(dbo.order_sheet_count.sheet_count) AS total_sheet " +
            //                "FROM dbo.flower_entry INNER JOIN " +
            //                "dbo.order_sheet_count ON dbo.flower_entry.id " +
            //                "= dbo.order_sheet_count.flower_id " +
            //                "WHERE(dbo.flower_entry.customer_name = " + dr_cus_entr_sheetcount.SelectedValue + " or " +
            //                dr_cus_entr_sheetcount.SelectedValue + " = -1) " +
            //                "AND(dbo.flower_entry.company_name = " + dr_company.SelectedValue + " or " +
            //                dr_company.SelectedValue + " = -1) " +
            //                "AND (order_sheet_count.recieve_date <= '" + endData +
            //                "') AND (order_sheet_count.recieve_date >= '" + startDate + "')"
            SelectCommand = "SELECT '" + dr_cus_entr_sheetcount.SelectedItem.Text + "' as customer_name ," +
                            "'" + dr_company.SelectedItem.Text + "' as company_name , " +
                            "SUM(order_sheet_count.sheet_count) AS total_sheet, " +
                            "flower_dimensions.flow_dimension as dimension FROM flower_entry " +
                            "INNER JOIN order_sheet_count ON flower_entry.id = order_sheet_count.flower_id " +
                            "inner join flower_forms_entry on order_sheet_count.form_id = flower_forms_entry.id " +
                            "inner join flower_dimensions on flower_forms_entry.dimension = flower_dimensions.dimension_id " +
                            "WHERE(flower_entry.customer_name = " + dr_cus_entr_sheetcount.SelectedValue + "  or " + dr_cus_entr_sheetcount.SelectedValue + " = -1) " +
                            "AND(flower_dimensions.dimension_id = " + drDimension.SelectedValue + " or " + drDimension.SelectedValue + " = -1) " +
                            "AND(flower_entry.company_name = " + dr_company.SelectedValue + "  or " + dr_company.SelectedValue + " = -1) " +
                            "AND(order_sheet_count.recieve_date <= '" + endDate + "') " +
                            "AND(order_sheet_count.recieve_date >= '" + startDate + "') " +
                            "group by flower_dimensions.flow_dimension"
        };

        ds.DataBind();
        grid_cus_enter_sheetcount.DataSource = ds;
        grid_cus_enter_sheetcount.DataBind();
    } //ok
    public static List <URL_data> ConvertUrlsToLinks_DIV(string msg)
    {
        string          regex    = @"((www\.|(http|https|ftp|news|file)+\:\/\/)[&#95;.a-z0-9-]+\.[a-z0-9\/&#95;:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])";
        Regex           r        = new Regex(regex, RegexOptions.IgnoreCase);
        List <URL_data> txt      = new List <URL_data>();
        MatchCollection mactches = r.Matches(msg);

        foreach (Match match in mactches)
        {
            SqlDataSource sql2 = new SqlDataSource();
            sql2.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql2.SelectCommand    = "select id from status_messages_link_info where link like '" + match.Value + "';";
            sql2.DataBind();
            DataView ict1 = (DataView)sql2.Select(DataSourceSelectArguments.Empty);
            if (ict1.Count == 0)
            {
                txt.Add(ConvertUrlsToDIV(match.Value));
            }
        }
        return(txt);
    }
Exemplo n.º 15
0
        public void FilterCustomerReturnSlip(SqlDataSource DataSource, string PostedStatus)
        {
            string CommandText = string.Empty;

            CommandText = "SELECT [ID], [CRSID], [CRSNo], [CRSDate], [Customer], [PUSNo], [TotalAmt], [PkgNo], [ItemStatus] FROM [CRS] ";
            if (PostedStatus != "CONFIRMED")
            {
                if (PostedStatus == "POSTED")
                {
                    if (CRSConfirmationCount() > 0)
                    {
                        CommandText += " INNER JOIN  CRS_CONFIRMATIONS ON CRS.CRSNo != CRS_CONFIRMATIONS.CRS_NUMBER WHERE ynPosted=1 AND ynCancelled=0 order by CRSDate DESC";
                    }
                    else
                    {
                        CommandText += " WHERE ynPosted=1 AND ynCancelled=0 order by CRSDate DESC";
                    }
                }
                else
                {
                    if (CRSConfirmationCount() > 0)
                    {
                        CommandText += " INNER JOIN  CRS_CONFIRMATIONS ON CRS.CRSNo != CRS_CONFIRMATIONS.CRS_NUMBER WHERE ynPosted=0 AND ynCancelled=0 order by CRSDate DESC";
                    }
                    else
                    {
                        CommandText += " WHERE ynPosted=0 AND ynCancelled=0 order by CRSDate DESC";
                    }
                }
            }
            else
            {
                CommandText  = "SELECT [ID], [CRSID], [CRSNo], [CRSDate], [Customer], [PUSNo], [TotalAmt], [PkgNo], [ItemStatus] FROM [CRS] ";
                CommandText += " INNER JOIN  CRS_CONFIRMATIONS ON CRS.CRSNo = CRS_CONFIRMATIONS.CRS_NUMBER order by CRSDate DESC";
            }
            DataSource.SelectCommand = CommandText;
            DataSource.DataBind();
        }
Exemplo n.º 16
0
    //匯出EXCEL
    public void export_excel(string v_verion, SqlDataSource v_sds, string v_Sqlcmd, string v_filename)
    {
        //匯出excel檔
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.Charset         = "UTF-8";
        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
        //Response.ContentType = "application/vnd.ms-excel";

        switch (v_verion)
        {
        case "2003":
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + DateTime.Today.ToString("yyyyMMdd") + "_" + v_filename + ".xls");//excel檔名
            HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
            break;

        case "2007":
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + DateTime.Today.ToString("yyyyMMdd") + "_" + v_filename + ".xlsx");//excel檔名
            HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            break;

        default:
            break;
        }

        HttpContext.Current.Response.Charset = "";
        System.IO.StringWriter       sw  = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
        DataGrid dg = new DataGrid();

        v_sds.SelectCommand = v_Sqlcmd;
        v_sds.DataBind();

        dg.DataSource = v_sds.Select(DataSourceSelectArguments.Empty);
        dg.DataBind();
        dg.RenderControl(htw);
        HttpContext.Current.Response.Write(sw.ToString());
        HttpContext.Current.Response.End();
    }
        public void FilterCustomer(SqlDataSource CustomerSqldataSource, string search_parameter, string BrandName = "")
        {
            StringBuilder command = new StringBuilder();

            command.Append("SELECT [CustNo], [CompName], [brand] FROM [CustInfoEx]  ");
            if (BrandName != "")
            {
                if (search_parameter != string.Empty)
                {
                    command.Append(" WHERE MainCustNo is not null and brand='" + BrandName + "' and CompName LIKE '%" + search_parameter + "%' ");
                }
            }
            else
            {
                if (search_parameter != string.Empty)
                {
                    command.Append(" WHERE MainCustNo is not null and CompName LIKE '%" + search_parameter + "%' ");
                }
            }

            CustomerSqldataSource.SelectCommand = command.ToString();
            CustomerSqldataSource.DataBind();
        }
Exemplo n.º 18
0
        protected void btnGetBricks_Click(object sender, EventArgs e)
        {
            string areasIDs = "99999";
            string comText  = "";

            foreach (ListItem item in chklAreas.Items)
            {
                if (item.Selected)
                {
                    areasIDs += ", " + item.Value;
                }
            }
            comText  = "SELECT DISTINCT AmounBrickID, AmounBrickName, CONCAT(AmounBrickName, ' (', AmounBrickID, ')') AS AmounBrickName2 FROM AreaHierarchy WHERE (RepAreaID IN(" + areasIDs + "))";
            dsBricks = new SqlDataSource(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCRMConnectionString"].ConnectionString, comText);
            dsBricks.SelectParameters.Add("areasIDs", TypeCode.String, areasIDs);
            DataView dv = (DataView)dsBricks.Select(DataSourceSelectArguments.Empty);

            dsBricks.DataBind();
            chklBricks.DataSource     = dsBricks;
            chklBricks.DataValueField = "AmounBrickID";
            chklBricks.DataTextField  = "AmounBrickName2";
            chklBricks.DataBind();
        }
Exemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string username = HttpContext.Current.User.Identity.Name;
            int    userRole = Convert.ToInt32(Session["user_role"]);

            if (username != "" && userRole >= 3)
            {
                SqlDataSource.SelectCommand = "SELECT * FROM dbo.[USER] WHERE role < (SELECT role FROM dbo.[USER] WHERE username = '******')";
                //SqlDataSource.SelectCommand = "SELECT * FROM dbo.[USER] WHERE role < (SELECT role FROM dbo.[USER] WHERE username = '******'");
                SaveButton.Visible    = true;
                CancelButton.Visible  = true;
                NoRightsLabel.Visible = false;
            }
            else
            {
                SqlDataSource.SelectCommand = "";
            }

            //SqlArticleSource.SelectParameters.Add("username", username);
            SqlDataSource.DataBind();
        }
    }
Exemplo n.º 20
0
        private static IEnumerable <MamutEmployee> GetEmployeesFromMamut()
        {
            List <MamutEmployee> list = new List <MamutEmployee>();

            SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStringMamut"].ConnectionString);
            SqlDataSource sqlDataSource = new SqlDataSource();

            sqlDataSource.ConnectionString = sqlConnection.ConnectionString;

            sqlDataSource.SelectCommand = "SELECT EMPID, FIRSTNAME, LASTNAME, PHONE_WORK, DATA15 FROM G_EMP WHERE (DATA15 = '3')";
            sqlDataSource.DataBind();

            IEnumerable iteratorObject = sqlDataSource.Select
                                             (DataSourceSelectArguments.Empty);

            try
            {
                list.AddRange(from DataRowView record in iteratorObject
                              select
                              new MamutEmployee(record.Row.ItemArray[1].ToString(),
                                                record.Row.ItemArray[2].ToString(),
                                                Convert.ToInt32(record.Row.ItemArray[0].ToString()),
                                                record.Row.ItemArray[3].ToString(),
                                                Convert.ToInt32(record.Row.ItemArray[4].ToString())));

                //list.AddRange(from DataRowView record in iteratorObject
                //              select new MamutOrder(Convert.ToInt32(record.Row.ItemArray["G_ORDER.STATUSID"].ToString()), Convert.ToInt32(record["G_ORDER.ORDERID"].ToString()), record["G_ORDER.CONTNAME"].ToString(), record["G_ORDER.ADRDELIV"].ToString(), record["G_ORDER.DATEDELIV"].ToString(), record["G_ORDER.DATEPROD"].ToString(), record["G_ORDER.REFYOUR"].ToString(), Convert.ToBoolean(record["G_ORDER.LORDERPICKED"].ToString()), (record["G_CONTAC.PHONE1"].ToString())));
            }
            catch
            {
                return(null);
            }


            return(list);
        }
Exemplo n.º 21
0
 public void SearchDeliveryReceiptList(SqlDataSource datasource, string search_parameter, string TransitStatus, string searchBy, string Brand)
 {
     datasource.SelectCommand = SearchCommand(search_parameter, TransitStatus, searchBy, Brand);
     datasource.DataBind();
 }
    protected void Button1_Click(object sender, EventArgs e)
    {
        ListBox1.Items.Clear();
        ListBox2.Items.Clear();
        ListBox3.Items.Clear();
        ListBox4.Items.Clear();
        ListBox5.Items.Clear();
        ListBox6.Items.Clear();

        //SqlDataSource sql2 = new SqlDataSource();
        //sql2.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        //sql2.SelectCommand = "select message from status_messages where id>=53234;";
        //sql2.DataBind();
        //DataView ict1 = (DataView)sql2.Select(DataSourceSelectArguments.Empty);
        //List<URL_data> URL_info = new List<URL_data>();
        //if (ict1.Count > 0)
        //{
        //    for (int ix = 0; ix < 100; ix++)
        //    {
        //       ListBox5.Items.Add(ict1.Table.Rows[ix]["message"].ToString());
        //       List<URL_data> URL_info_new = new List<URL_data>();
        //       URL_info_new = ConvertUrlsToLinks_DIV(ict1.Table.Rows[ix]["message"].ToString());
        //       //SWITCHOFFSET(SYSDATETIMEOFFSET(), '+09:00')

        //       //if ((DateTime.Now - dt).TotalDays < 14)
        //       //{
        //       //    Image img = new Image();
        //       //    img.ImageUrl = "~/images/home_images/new.png";
        //       //    pdn_list1.Controls.Add(img);
        //       //}
        //       for (int i = 0; i < URL_info_new.Count; i++)
        //       {
        //           URL_info.Add(URL_info_new[i]);
        //       }
        //    }
        //    for (int i = 0; i < URL_info.Count; i++)
        //    {
        //        ListBox1.Items.Add(URL_info[i].url);
        //        ListBox2.Items.Add(URL_info[i].title);
        //        ListBox3.Items.Add(URL_info[i].des);
        //        ListBox4.Items.Add(URL_info[i].image_url);
        //    }
        //}

        SqlDataSource sql3 = new SqlDataSource();

        sql3.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        sql3.SelectCommand    = "select * from status_messages where id>=53234;";
        sql3.DataBind();
        DataView        ict2     = (DataView)sql3.Select(DataSourceSelectArguments.Empty);
        List <URL_data> URL_info = new List <URL_data>();

        if (ict2.Count > 0)
        {
            for (int ix = 600; ix < ict2.Count; ix++)
            {
                ListBox5.Items.Add(ict2.Table.Rows[ix]["message"].ToString());
                List <URL_data> URL_info_new = new List <URL_data>();
                URL_info_new = ConvertUrlsToLinks_DIV(ict2.Table.Rows[ix]["message"].ToString());
                //SWITCHOFFSET(SYSDATETIMEOFFSET(), '+09:00')

                //if ((DateTime.Now - dt).TotalDays < 14)
                //{
                //    Image img = new Image();
                //    img.ImageUrl = "~/images/home_images/new.png";
                //    pdn_list1.Controls.Add(img);
                //}
                string indx = ict2.Table.Rows[ix]["year"].ToString() + "-" + ict2.Table.Rows[ix]["month"].ToString() + "-" + ict2.Table.Rows[ix]["day"].ToString()
                              + " " + ict2.Table.Rows[ix]["hour"].ToString() + ":" + ict2.Table.Rows[ix]["minute"].ToString() + ":" + ict2.Table.Rows[ix]["second"].ToString();
                DateTime indate = Convert.ToDateTime(indx);
                for (int i = 0; i < URL_info_new.Count; i++)
                {
                    URL_info_new[i].update_time = indate.ToString("yyyy-MM-dd HH:mm:ss.fff");
                }
                for (int i = 0; i < URL_info_new.Count; i++)
                {
                    SqlDataSource sql2 = new SqlDataSource();
                    sql2.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                    sql2.SelectCommand    = "select id from status_messages_link_info where link like '" + URL_info_new[i].url + "';";
                    sql2.DataBind();
                    DataView ict1 = (DataView)sql2.Select(DataSourceSelectArguments.Empty);
                    if (ict1.Count == 0)
                    {
                        SqlDataSource sql2_in = new SqlDataSource();
                        sql2_in.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                        sql2_in.InsertCommand    = "insert into status_messages_link_info(link,image_url,title,des,update_time)";
                        sql2_in.InsertCommand   += " values(N'" + URL_info_new[i].url + "',N'" + URL_info_new[i].image_url + "',N'" + URL_info_new[i].title + "',N'" + URL_info_new[i].des + "','" + URL_info_new[i].update_time + "');";
                        sql2_in.Insert();
                    }

                    URL_info.Add(URL_info_new[i]);
                }
            }
            for (int i = 0; i < URL_info.Count; i++)
            {
                ListBox1.Items.Add(URL_info[i].url);
                ListBox2.Items.Add(URL_info[i].title);
                ListBox3.Items.Add(URL_info[i].des);
                ListBox4.Items.Add(URL_info[i].image_url);
                ListBox6.Items.Add(URL_info[i].update_time);
            }
        }

        //ConvertUrlsToLinks(ict.Table.Rows[i]["message"].ToString())
    }
Exemplo n.º 23
0
 public void AdvanceSearch(SqlDataSource datasource, string search_parameter, string filter_type, DateTime date_from, DateTime date_to, string searchBy, string Brand)
 {
     datasource.SelectCommand = AdvanceSearchCommand(search_parameter, filter_type, date_from, date_to, searchBy, Brand);
     datasource.DataBind();
 }
Exemplo n.º 24
0
 public void FillData(String sql ,SqlDataSource sqldatasource, GridView gridview)
 {
     sqldatasource.SelectCommand = sql;
     sqldatasource.DataBind();
     gridview.DataBind();
 }
Exemplo n.º 25
0
        /// <summary>
        /// Handles the Click event of the btn_Buscar control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btn_Buscar_Click(object sender, EventArgs e)
        {
            //Inicializar variables.
            String sqlConsulta      = "";
            String sqlWhere         = "";
            String sqlConsultaFinal = "";

            try
            {
                #region Construcción de la consulta dependiendo de el nombre y número del plan/proyecto.

                if (txt_NombrePlan.Text.Trim() == "" && txt_NumeroPlan.Text.Trim() == "")
                {
                    sqlConsulta = " SELECT DISTINCT Id_Contacto, Nombres, Apellidos, Email, Identificacion, NomGrupo, " +
                                  /*Se debe colocar las columnas para evitar que se "dañe el flujo" del código.*/
                                  " '' AS Id_Proyecto, '' AS Id_Grupo, '' AS NomGrupo, '' AS NomProyecto " +
                                  " FROM Contacto c LEFT JOIN GrupoContacto gc  " +
                                  " ON c.Id_Contacto = gc.CodContacto LEFT JOIN Grupo g on gc.CodGrupo = g.Id_Grupo";
                }
                else
                {
                    sqlConsulta = " SELECT DISTINCT Id_Contacto, Nombres, Apellidos, Email, Identificacion, NomProyecto, " +
                                  " Id_Proyecto, Id_Grupo, NomGrupo " +
                                  " FROM contacto c LEFT JOIN proyectocontacto pc " +
                                  " ON c.Id_Contacto = pc.CodContacto LEFT JOIN proyecto p " +
                                  " ON pc.CodProyecto = p.id_proyecto LEFT JOIN GrupoContacto gc " +
                                  " ON c.Id_Contacto = gc.CodContacto LEFT JOIN Grupo g " +
                                  " ON gc.CodGrupo = g.id_Grupo";
                }

                #endregion



                if (sqlWhere.Trim() == "")
                {
                }

                //Consulta
                sqlConsultaFinal = sqlConsulta; // +" " + sqlWhere;


                if (!String.IsNullOrEmpty(txt_Nombres.Text) || !String.IsNullOrEmpty(txt_Apellidos.Text) ||
                    !String.IsNullOrEmpty(txt_Email.Text) || !String.IsNullOrEmpty(txt_Identificacion.Text) ||
                    !String.IsNullOrEmpty(txt_NombrePlan.Text) || !String.IsNullOrEmpty(txt_NumeroPlan.Text))
                {
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, " where ");
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Nombres.Text) ?
                                                               string.Format(" + Nombres LIKE'%{0}%' ", txt_Nombres.Text) : string.Empty);
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Apellidos.Text) ?
                                                               string.Format(" + Apellidos LIKE'%{0}%' ", txt_Apellidos.Text) : string.Empty);
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Email.Text) ?
                                                               string.Format(" + Email LIKE'%{0}%' ", txt_Email.Text) : string.Empty);
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Identificacion.Text) ?
                                                               string.Format(" + Identificacion IN ({0})", txt_Identificacion.Text) : string.Empty);
                    if (!String.IsNullOrEmpty(txt_NombrePlan.Text) || !String.IsNullOrEmpty(txt_NumeroPlan.Text))
                    {
                        sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_NombrePlan.Text) ?
                                                                   string.Format(" + NomProyecto LIKE'%{0}%'", txt_NombrePlan.Text) : string.Empty);
                        sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_NumeroPlan.Text) ?
                                                                   string.Format(" + Id_Proyecto IN({0})", txt_NumeroPlan.Text) : string.Empty);
                    }
                    sqlConsultaFinal = sqlConsultaFinal.IndexOf("+") > -1 ? sqlConsultaFinal.Remove(sqlConsultaFinal.IndexOf("+"), 1) : sqlConsultaFinal;
                    var ijn = sqlConsultaFinal.Split('+');
                    sqlConsultaFinal = ijn.Length >= 2 ? sqlConsultaFinal.Replace("+", " AND ") : sqlConsultaFinal.Replace("+", string.Empty);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Vldt", "alert('Especifique los parámetros de consulta.')", true);
                    return;
                }

                SqlDataSource sqlds = new SqlDataSource(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString + ";Connect Timeout=120", sqlConsultaFinal)
                {
                    DataSourceMode              = SqlDataSourceMode.DataReader,
                    ConflictDetection           = ConflictOptions.OverwriteChanges,
                    CancelSelectOnNullParameter = true,
                    SelectCommandType           = SqlDataSourceCommandType.Text,
                    ID = "sqlDs"
                };
                sqlds.DataBind();


                var dtEmpresas = new DataTable();

                GridView1.DataSource = sqlds.Select(new DataSourceSelectArguments());
                sqlds.DataBind();
                GridView1.DataBind();

                //Según el comportamiento del FONADE clásico, los campos son vaciados al terminar de consultar.
                txt_Nombres.Text        = "";
                txt_Apellidos.Text      = "";
                txt_Email.Text          = "";
                txt_Identificacion.Text = "";
                txt_NombrePlan.Text     = "";
                txt_NumeroPlan.Text     = "";
            }
            catch
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('Error en la consulta y/o procedimiento.')", true);
                return;
            }
        }
Exemplo n.º 26
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (Session["id"] == null)
        {
            ScriptManager.RegisterStartupScript(Button2, Button2.GetType(), "alert", "alert('Sorry you stay too long!')", true);
            Response.Redirect("home.aspx");
        }
        else
        {
            string uid = Session["id"].ToString();
            Session["id"] = uid;
            bool          check_db = false;
            SqlDataSource sql_f    = new SqlDataSource();
            sql_f.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql_f.SelectCommand    = "select id from user_information_store";
            sql_f.SelectCommand   += " where uid='" + uid + "';";
            sql_f.DataBind();
            DataView ict_f = (DataView)sql_f.Select(DataSourceSelectArguments.Empty);
            if (ict_f.Count > 0)
            {
                check_db = true;
            }

            if (check_db)
            {
                string uisid = ict_f.Table.Rows[0]["id"].ToString();

                string bank_name = bank_name_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
                string bank_name_detail = bank_name_detail_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
                string bank_number = bank_number_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
                string bank_person = bank_person_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
                int    bank_type = 0, bank_type_detail = 0;


                bool check_type0_Image = false, check_type1_Image = false, check_type2_Image = false
                , check_bank_type = false, check_bank_type_detail = false, check_bank_name = false, check_bank_name_detail = false
                , check_bank_number = false, check_bank_person = false;
                if (type0_Image.ImageUrl.ToString() != "")
                {
                    check_type0_Image = true;
                    image_Label.Text  = "";
                }
                else
                {
                    image_Label.Text = "This image not upload.";
                }
                if (type1_Image.ImageUrl.ToString() != "")
                {
                    check_type1_Image = true;
                    image_Label0.Text = "";
                }
                else
                {
                    image_Label0.Text = "This image not upload.";
                }
                if (type2_Image.ImageUrl.ToString() != "")
                {
                    check_type2_Image = true;
                    image_Label1.Text = "";
                }
                else
                {
                    image_Label1.Text = "This image not upload.";
                }

                //if (bank_type_RadioButtonList.SelectedIndex > -1)
                //{
                //    bank_type = bank_type_RadioButtonList.SelectedIndex;

                //    check_bank_type = true;
                //    bank_type_Label.Text = "";
                //}
                //else
                //{
                //    bank_type_Label.Text = "Bank type no select.";
                //}

                //if (bank_type_detail_RadioButtonList.SelectedIndex > -1)
                //{
                //    bank_type_detail = bank_type_detail_RadioButtonList.SelectedIndex;
                //    check_bank_type_detail = true;
                //    bank_type_detail_Label.Text = "";
                //}
                //else
                //{
                //    bank_type_detail_Label.Text = "Bank type detail no select.";
                //}

                //if (bank_name != "")
                //{
                //    check_bank_name = true;
                //    bank_name_Label.Text = "";
                //}
                //else
                //{
                //    bank_name_Label.Text = "Bank name have special word or not write.";
                //}
                //if (bank_name_detail != "")
                //{
                //    check_bank_name_detail = true;
                //    bank_name_detail_Label.Text = "";
                //}
                //else
                //{
                //    bank_name_detail_Label.Text = "Bank name detail have special word or not write.";
                //}
                //if (bank_number != "")
                //{
                //    try
                //    {
                //        int number = Convert.ToInt32(bank_number);
                //        check_bank_number = true;
                //        bank_number_Label.Text = "";
                //    }
                //    catch (Exception ex)
                //    {
                //        bank_number_Label.Text = "Bank number is not number.";
                //        return;
                //        throw ex;
                //    }
                //}
                //else
                //{
                //    bank_number_Label.Text = "Bank number have special word or not write.";
                //}
                //if (bank_person != "")
                //{
                //    check_bank_person = true;
                //    bank_person_Label.Text = "";
                //}
                //else
                //{
                //    bank_person_Label.Text = "Bank person have special word or not write.";
                //}


                //if (check_type0_Image && check_type1_Image && check_type2_Image && check_bank_person &&
                //    check_bank_number && check_bank_name_detail && check_bank_name && check_bank_type_detail &&
                //    check_bank_type)
                if (check_type0_Image && check_type1_Image && check_type2_Image)
                {
                    //SqlDataSource sql_update = new SqlDataSource();
                    //sql_update.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                    //sql_update.UpdateCommand = "update user_information_store";
                    //sql_update.UpdateCommand += " set bank_type='" + bank_type + "',bank_type_detail='" + bank_type_detail + "',bank_name='" + bank_name + "'";
                    //sql_update.UpdateCommand += ",bank_name_detail='" + bank_name_detail + "',bank_number='" + bank_number + "',bank_person='" + bank_person + "'";
                    //sql_update.UpdateCommand += " where id='" + uisid + "';";
                    //sql_update.Update();


                    sql_f = new SqlDataSource();
                    sql_f.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                    sql_f.SelectCommand    = "select id from user_information_store_important_image";
                    sql_f.SelectCommand   += " where uisid='" + uisid + "';";
                    sql_f.DataBind();
                    ict_f = (DataView)sql_f.Select(DataSourceSelectArguments.Empty);
                    if (ict_f.Count == 0)
                    {
                        SqlDataSource sql_insert = new SqlDataSource();
                        sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                        sql_insert.InsertCommand    = "insert into user_information_store_important_image(uisid,type,filename)";
                        sql_insert.InsertCommand   += " values('" + uisid + "','0','" + type0_Image.ImageUrl.ToString() + "');";
                        sql_insert.Insert();

                        sql_insert = new SqlDataSource();
                        sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                        sql_insert.InsertCommand    = "insert into user_information_store_important_image(uisid,type,filename)";
                        sql_insert.InsertCommand   += " values('" + uisid + "','1','" + type1_Image.ImageUrl.ToString() + "');";
                        sql_insert.Insert();

                        sql_insert = new SqlDataSource();
                        sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                        sql_insert.InsertCommand    = "insert into user_information_store_important_image(uisid,type,filename)";
                        sql_insert.InsertCommand   += " values('" + uisid + "','2','" + type2_Image.ImageUrl.ToString() + "');";
                        sql_insert.Insert();



                        bank_name_TextBox.Text        = "";
                        bank_name_detail_TextBox.Text = "";
                        bank_number_TextBox.Text      = "";
                        bank_person_TextBox.Text      = "";

                        type0_Image.ImageUrl = "";
                        type1_Image.ImageUrl = "";
                        type2_Image.ImageUrl = "";

                        bank_type_detail_RadioButtonList.SelectedIndex = -1;
                        bank_type_RadioButtonList.SelectedIndex        = -1;



                        result_Label.Text = "Success registered.";
                        Response.Redirect("registered_1_3.aspx");
                    }
                }
                else
                {
                    result_Label.Text = "登録に失敗しました。";
                }
            }
            else
            {
                result_Label.Text = "登録に失敗しました。";
            }
        }
    }
Exemplo n.º 27
0
    protected void Page_Init(object sender, EventArgs e)
    {
        SqlDataSource sql1 = new SqlDataSource();

        sql1.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        sql1.SelectCommand    = "select a.id,a.type,a.message_type,a.place,a.message,a.year,a.month,a.day,a.hour,a.minute,a.second,b.username,b.photo ";
        sql1.SelectCommand   += "from status_messages as a";
        sql1.SelectCommand   += " inner join user_login as b on b.id=a.uid";

        //if want to class by type use type=0,1,2 ; message_type=0,1,2

        //Before today's message
        sql1.SelectCommand += " where a.year<=" + DateTime.Now.Year.ToString() + " and a.month<=" + DateTime.Now.Month.ToString();
        sql1.SelectCommand += " and a.day<=" + DateTime.Now.Day.ToString() + " ";


        //sql1.SelectCommand += " and a.day<=" + DateTime.Now.Day.ToString() + " and a.hour<="+Convert.ToInt32(DateTime.Now.ToString("HH")).ToString();
        //sql1.SelectCommand += " and a.minute<=" + DateTime.Now.Minute.ToString() + " and a.second<=" + DateTime.Now.Second.ToString();

        sql1.SelectCommand += " ORDER BY a.year desc,a.month desc,a.day desc,a.hour desc,a.minute desc,a.second desc;";
        DataView ict = (DataView)sql1.Select(DataSourceSelectArguments.Empty);


        Literal li = new Literal();

        li.Text = @"<script>
function UploadFile(fileUpload,id) {
            if (fileUpload.value != '') {
                var cutname = id;
                var n = cutname.indexOf('_');
                var nn = cutname.substring(n, cutname.length );
                document.getElementById('btnUploadDoc' + nn).click();
            }
        }


$(function () {

";

        for (int i = 0; i < ict.Count; i++)
        {
            li.Text += @"

$('#btnFileUpload" + i + @"').fileupload({
    url: 'FileUploadHandler.ashx?upload=start',
    add: function(e, data) {
        console.log('add', data);
        $('#progressbar" + i + @"').show();
        $('#image_place" + i + @"').hide();
        $('#image_place" + i + @" div').css('width', '0%');
        data.submit();
    },
    progress: function(e, data) {
        var progress = parseInt(data.loaded / data.total * 100, 10);
        $('#progressbar" + i + @" div').css('width', progress + '%');
    },
    success: function(response, status) {
        $('#progressbar" + i + @"').hide();
        $('#progressbar" + i + @" div').css('width', '0%');
        $('#image_place" + i + @"').show();
        document.getElementById('make-image" + i + @"').src = response;
        console.log('success', response);
    },
    error: function(error) {
        $('#progressbar" + i + @"').hide();
        $('#progressbar" + i + @" div').css('width', '0%');
        $('#image_place" + i + @"').hide();
        $('#image_place" + i + @" div').css('width', '0%');
        console.log('error', error);
    }
});






$('.hidde" + i + @"').toggle(false);

            $('.box" + i + @"').click(function () {
                $('.hidde" + i + @"').toggle();
                $('.box" + i + @"').toggle(false);
            })

            $('.hidde" + i + @"').click(function () {
                $('.box" + i + @"').toggle();
                $('.hidde" + i + @"').toggle(false);
            })

            $('.likehidde" + i + @"').toggle(false);

            $('.likebox" + i + @"').click(function () {
                $('.likehidde" + i + @"').toggle();
                $('.likebox" + i + @"').toggle(false);
            })

            $('.likehidde" + i + @"').click(function () {
                $('.likebox" + i + @"').toggle();
                $('.likehidde" + i + @"').toggle(false);
            })

            $('.sharehidde" + i + @"').toggle(false);

            $('.sharebox" + i + @"').click(function () {
                $('.sharehidde" + i + @"').toggle();
                $('.sharebox" + i + @"').toggle(false);
            })

            $('.sharehidde" + i + @"').click(function () {
                $('.sharebox" + i + @"').toggle();
                $('.sharehidde" + i + @"').toggle(false);
            })

            $('.mess_hidde" + i + @"').toggle(false);

            $('.mess_box" + i + @"').click(function () {
                $('.mess_hidde" + i + @"').toggle();
                $('.mess_box" + i + @"').toggle(false);
            })

            $('.mess_hidde" + i + @"').click(function () {
                $('.mess_box" + i + @"').toggle();
                $('.mess_hidde" + i + @"').toggle(false);
            })

            $('.big_mess_hidde" + i + @"').toggle(false);

            $('.big_mess_box" + i + @"').click(function () {
                $('.big_mess_hidde" + i + @"').toggle();
                $('.big_mess_box" + i + @"').toggle(false);
                $('.status_message_hidde" + i + @"').toggle();
                $('.status_message_box" + i + @"').toggle(false);
            })

            $('.big_mess_hidde" + i + @"').click(function () {
                $('.big_mess_box" + i + @"').toggle();
                $('.big_mess_hidde" + i + @"').toggle(false);
                $('.status_message_box" + i + @"').toggle();
                $('.status_message_hidde" + i + @"').toggle(false);
            })

            $('.status_message_hidde" + i + @"').toggle(false);


";

            SqlDataSource sql3 = new SqlDataSource();
            sql3.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql3.SelectCommand    = "select filename from status_messages as a inner join status_messages_image as b on a.id=b.smid";
            sql3.SelectCommand   += " where b.smid=" + ict.Table.Rows[i]["id"].ToString() + ";";
            DataView ict2 = (DataView)sql3.Select(DataSourceSelectArguments.Empty);
            if (ict2.Count > 3)
            {
                li.Text += @"
$('.imhidde" + i + @"').toggle(false);

            $('.imbox" + i + @"').click(function () {
                $('.imhidde" + i + @"').toggle();
                $('.imbox" + i + @"').toggle(false);
            })

            $('.imhidde" + i + @"').click(function () {
                $('.imbox" + i + @"').toggle();
                $('.imhidde" + i + @"').toggle(false);
            })";
            }
        }

        li.Text += @"
                        })";
        li.Text += @"</script>";

        Panel pdn_j = (Panel)this.FindControl("javaplace");

        pdn_j.Controls.Add(li);

        //this.Page.Controls.Add(li);


        //this.Page.Header.Controls.Add(li);
        ////添加至指定位置
        //this.Page.Header.Controls.AddAt(0, li);



        Panel pdn2 = (Panel)this.FindControl("Panel2");


        for (int i = 0; i < ict.Count; i++)
        {
            //big message place
            pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td width='5%' height='5%'></td><td width='90%' height='5%'></td><td width='5%' height='5%'></td></tr>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("<td>"));
            //new message place
            pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            //Poster photo
            pdn2.Controls.Add(new LiteralControl("<td width='10%' rowspan='2' valign='top'>"));
            Image img = new Image();
            img.Width    = 50; img.Height = 50;
            img.ImageUrl = ict.Table.Rows[i]["photo"].ToString();
            pdn2.Controls.Add(img);
            pdn2.Controls.Add(new LiteralControl("</td>"));
            //poster username
            pdn2.Controls.Add(new LiteralControl("<td width='10%'>"));
            HyperLink hy = new HyperLink();
            hy.NavigateUrl    = "javascript:void(0);";
            hy.Target         = "_blank";
            hy.Text           = ict.Table.Rows[i]["username"].ToString();
            hy.Font.Underline = false;
            pdn2.Controls.Add(hy);
            pdn2.Controls.Add(new LiteralControl("</td>"));
            //poster message type and time
            pdn2.Controls.Add(new LiteralControl("<td align='right' width='80%'>"));
            Label la = new Label();
            la.ForeColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            la.Text      = "";
            if (Convert.ToInt32(ict.Table.Rows[i]["message_type"].ToString()) == 0)
            {
                la.Text += "お食事、";
            }
            else if (Convert.ToInt32(ict.Table.Rows[i]["message_type"].ToString()) == 1)
            {
                la.Text += "人気スポット、";
            }
            else if (Convert.ToInt32(ict.Table.Rows[i]["message_type"].ToString()) == 2)
            {
                la.Text += "イベント、";
            }
            else if (Convert.ToInt32(ict.Table.Rows[i]["message_type"].ToString()) == 3)
            {
                la.Text += "病院、";
            }
            else if (Convert.ToInt32(ict.Table.Rows[i]["message_type"].ToString()) == 4)
            {
                la.Text += "公園/レジャー、";
            }
            else if (Convert.ToInt32(ict.Table.Rows[i]["message_type"].ToString()) == 5)
            {
                la.Text += "授乳室、";
            }
            la.Text += ict.Table.Rows[i]["place"].ToString() + " ";
            la.Text += ict.Table.Rows[i]["year"].ToString() + "." + ict.Table.Rows[i]["month"].ToString() + "." + ict.Table.Rows[i]["day"].ToString();
            pdn2.Controls.Add(la);
            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            //poster message
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td colspan='3' style=" + '"' + "word-break:break-all; width:90%;" + '"' + ">"));
            pdn2.Controls.Add(new LiteralControl("<div class='box" + i + "'>"));
            HyperLink hyy;
            if (ict.Table.Rows[i]["message"].ToString().Length < 37)
            {
                pdn2.Controls.Add(new LiteralControl(ict.Table.Rows[i]["message"].ToString()));
            }
            else
            {
                pdn2.Controls.Add(new LiteralControl(ict.Table.Rows[i]["message"].ToString().Substring(0, 37) + "‧‧‧"));
                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "もっと見る";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);
            }


            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("<div class='hidde" + i + "'>"));

            Label la1 = new Label();
            la1.Style.Add("word-break", "break-all");
            la1.Style.Add("over-flow", "hidden");
            la1.Text = ict.Table.Rows[i]["message"].ToString();
            pdn2.Controls.Add(la1);
            pdn2.Controls.Add(new LiteralControl("<br/>"));


            if (ict.Table.Rows[i]["message"].ToString().Length > 36)
            {
                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "たたむ";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);
            }


            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            //poster images
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("<td colspan='3' width='90%' align='center'><br/><br/>"));
            SqlDataSource sql2 = new SqlDataSource();
            sql2.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql2.SelectCommand    = "select filename from status_messages as a inner join status_messages_image as b on a.id=b.smid";
            sql2.SelectCommand   += " where b.smid=" + ict.Table.Rows[i]["id"].ToString() + ";";
            DataView ict1 = (DataView)sql2.Select(DataSourceSelectArguments.Empty);
            if (ict1.Count > 3)
            {
                pdn2.Controls.Add(new LiteralControl("<div class='imbox" + i + "'>"));
                pdn2.Controls.Add(new LiteralControl("<div class='zoom-gallery'>"));
                for (int ii = 0; ii < 3; ii++)
                {
                    string cutstr  = ict1.Table.Rows[ii]["filename"].ToString();
                    int    ind     = cutstr.IndexOf(@"/");
                    string cutstr1 = cutstr.Substring(ind + 1, cutstr.Length - ind - 1);
                    pdn2.Controls.Add(new LiteralControl("<a href='" + cutstr1 + "' data-source='' title='" + ict.Table.Rows[i]["username"].ToString() + "' style='width:100px;height:100px;'>"));
                    pdn2.Controls.Add(new LiteralControl("<img src='" + cutstr1 + "' width='100' height='100' />"));
                    pdn2.Controls.Add(new LiteralControl("</a>"));


                    //Image imgg = new Image();
                    //imgg.Width = 100; imgg.Height = 100;
                    //imgg.ImageUrl = ict1.Table.Rows[ii]["filename"].ToString();
                    //pdn2.Controls.Add(imgg);
                    //pdn2.Controls.Add(new LiteralControl("&nbsp;"));
                }

                pdn2.Controls.Add(new LiteralControl("</div>"));
                pdn2.Controls.Add(new LiteralControl("<br/>"));
                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "もっと見る";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);
                pdn2.Controls.Add(new LiteralControl("</div>"));
                pdn2.Controls.Add(new LiteralControl("<div class='imhidde" + i + "'>"));
                for (int ii = 0; ii < ict1.Count; ii++)
                {
                    if (ii > 0 && ii % 3 == 0)
                    {
                        pdn2.Controls.Add(new LiteralControl("<br/>"));
                    }
                    Image imgg = new Image();
                    imgg.Width    = 100; imgg.Height = 100;
                    imgg.ImageUrl = ict1.Table.Rows[ii]["filename"].ToString();
                    pdn2.Controls.Add(imgg);
                    pdn2.Controls.Add(new LiteralControl("&nbsp;"));
                }
                pdn2.Controls.Add(new LiteralControl("<br/>"));
                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "たたむ";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);
                pdn2.Controls.Add(new LiteralControl("</div>"));
            }
            else
            {
                for (int ii = 0; ii < ict1.Count; ii++)
                {
                    Image imgg = new Image();
                    imgg.Width    = 100; imgg.Height = 100;
                    imgg.ImageUrl = ict1.Table.Rows[ii]["filename"].ToString();
                    pdn2.Controls.Add(imgg);
                    pdn2.Controls.Add(new LiteralControl("&nbsp;"));
                }
            }

            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            //poster message like and share
            pdn2.Controls.Add(new LiteralControl("<td width='15%' align='right'><br/><br/>"));
            pdn2.Controls.Add(new LiteralControl("<div style='cursor: pointer' class='likebox" + i + "'>"));
            Image img1 = new Image();
            img1.Width    = 25; img1.Height = 25;
            img1.ImageUrl = "~/images/like_b.png";
            pdn2.Controls.Add(img1);
            Label laa = new Label();
            laa.Font.Size = FontUnit.Point(10);
            laa.ForeColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            laa.Text      = "いいね";
            pdn2.Controls.Add(laa);


            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("<div style='cursor: pointer' class='likehidde" + i + "'>"));
            img1          = new Image();
            img1.Width    = 25; img1.Height = 25;
            img1.ImageUrl = "~/images/like.png";
            pdn2.Controls.Add(img1);
            laa           = new Label();
            laa.Font.Size = FontUnit.Point(10);
            laa.ForeColor = System.Drawing.ColorTranslator.FromHtml("#F06767");
            laa.Text      = "いいね";
            pdn2.Controls.Add(laa);
            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));


            pdn2.Controls.Add(new LiteralControl("<td>"));
            pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td align='center'><br/><br/>"));
            pdn2.Controls.Add(new LiteralControl("<div style='cursor: pointer' class='big_mess_box" + i + "'>"));
            img1          = new Image();
            img1.Width    = 25; img1.Height = 25;
            img1.ImageUrl = "~/images/mess_b.png";
            pdn2.Controls.Add(img1);
            laa           = new Label();
            laa.Font.Size = FontUnit.Point(10);
            laa.ForeColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            laa.Text      = "コメント";
            pdn2.Controls.Add(laa);


            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("<div style='cursor: pointer' class='big_mess_hidde" + i + "'>"));
            img1          = new Image();
            img1.Width    = 25; img1.Height = 25;
            img1.ImageUrl = "~/images/mess.png";
            pdn2.Controls.Add(img1);
            laa           = new Label();
            laa.Font.Size = FontUnit.Point(10);
            laa.ForeColor = System.Drawing.ColorTranslator.FromHtml("#F06767");
            laa.Text      = "コメント";
            pdn2.Controls.Add(laa);


            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("<td align='left'><br/><br/>"));
            pdn2.Controls.Add(new LiteralControl("<div style='cursor: pointer' class='sharebox" + i + "'>"));
            img1          = new Image();
            img1.Width    = 25; img1.Height = 25;
            img1.ImageUrl = "~/images/share_b.png";
            pdn2.Controls.Add(img1);
            laa           = new Label();
            laa.Font.Size = FontUnit.Point(10);
            laa.ForeColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            laa.Text      = "シェア";
            pdn2.Controls.Add(laa);


            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("<div style='cursor: pointer' class='sharehidde" + i + "'>"));
            img1          = new Image();
            img1.Width    = 25; img1.Height = 25;
            img1.ImageUrl = "~/images/share.png";
            pdn2.Controls.Add(img1);
            laa           = new Label();
            laa.Font.Size = FontUnit.Point(10);
            laa.ForeColor = System.Drawing.ColorTranslator.FromHtml("#F06767");
            laa.Text      = "シェア";
            pdn2.Controls.Add(laa);
            pdn2.Controls.Add(new LiteralControl("</div>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("</table>"));

            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("</table>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));

            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("<td>"));



            pdn2.Controls.Add(new LiteralControl("<div class='status_message_box" + i + "' style='background-color: #ffffff'>"));
            pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td width='5%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("<td width='90%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("<td width='5%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("</table>"));
            pdn2.Controls.Add(new LiteralControl("</div >"));
            pdn2.Controls.Add(new LiteralControl("<div class='status_message_hidde" + i + "' style='background-color: #dddddd'>"));


            pdn2.Controls.Add(new LiteralControl("<table width='100%' align='left'>"));
            //first space way
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td width='5%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("<td width='90%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("<td width='5%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            //second space way
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            //someone answer
            pdn2.Controls.Add(new LiteralControl("<td>"));
            pdn2.Controls.Add(new LiteralControl("<table width='100%' align='left'>"));
            //who like this message
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td width='100%'>"));
            img1          = new Image();
            img1.Width    = 15; img1.Height = 15;
            img1.ImageUrl = "~/images/like_b_1.png";
            pdn2.Controls.Add(img1);
            SqlDataSource sql4 = new SqlDataSource();
            sql4.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql4.SelectCommand    = "select b.username from status_messages_user_like as a inner join user_login as b on a.uid=b.id";
            sql4.SelectCommand   += " where a.smid=" + ict.Table.Rows[i]["id"].ToString() + "";
            sql4.SelectCommand   += " ORDER BY a.year desc,a.month desc,a.day desc,a.hour desc,a.minute desc,a.second desc;";
            sql4.DataBind();
            DataView ict3 = (DataView)sql4.Select(DataSourceSelectArguments.Empty);
            if (ict3.Count > 2)
            {
                for (int iii = 0; iii < 2; iii++)
                {
                    hyy                = new HyperLink();
                    hyy.NavigateUrl    = "javascript:void(0);";
                    hyy.Target         = "_blank";
                    hyy.Text           = ict3.Table.Rows[iii]["username"].ToString();
                    hyy.Font.Underline = false;
                    pdn2.Controls.Add(hyy);
                    pdn2.Controls.Add(new LiteralControl("、"));
                }
                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "他" + (ict3.Count - 2) + "人";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);
            }
            else
            {
                for (int iii = 0; iii < ict3.Count; iii++)
                {
                    hyy                = new HyperLink();
                    hyy.NavigateUrl    = "javascript:void(0);";
                    hyy.Target         = "_blank";
                    hyy.Text           = ict3.Table.Rows[iii]["username"].ToString();
                    hyy.Font.Underline = false;
                    pdn2.Controls.Add(hyy);
                    if (iii != ict3.Count - 1)
                    {
                        pdn2.Controls.Add(new LiteralControl("、"));
                    }
                }
            }


            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            //who talk about this status message before
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td width='100%'>"));



            sql4.SelectCommand  = "select e.id,e.message,e.filename,b.username,b.photo,e.pointer_message_id,e.pointer_user_id,e.structure_level";
            sql4.SelectCommand += " from status_messages as a inner join status_messages_user as c";
            sql4.SelectCommand += " on a.id=c.smid inner join user_login as b on b.id=c.uid";
            sql4.SelectCommand += " inner join status_messages_user_talk as e on e.smuid=c.id";
            sql4.SelectCommand += " where a.id=" + ict.Table.Rows[i]["id"].ToString() + "";
            sql4.SelectCommand += " ORDER BY e.year desc,e.month desc,e.day desc,e.hour desc,e.minute desc,e.second desc;";
            sql4.DataBind();
            ict3 = (DataView)sql4.Select(DataSourceSelectArguments.Empty);
            List <sorttalk> talk_list = new List <sorttalk>();
            sorttalk        so        = new sorttalk();
            for (int iy = 0; iy < ict3.Count; iy++)
            {
                so          = new sorttalk();
                so.id       = Convert.ToInt32(ict3.Table.Rows[iy]["id"].ToString());
                so.level    = Convert.ToInt32(ict3.Table.Rows[iy]["structure_level"].ToString());
                so.point_id = Convert.ToInt32(ict3.Table.Rows[iy]["pointer_message_id"].ToString());
                so.uid      = Convert.ToInt32(ict3.Table.Rows[iy]["pointer_user_id"].ToString());
                so.filename = ict3.Table.Rows[iy]["filename"].ToString();
                so.mess     = ict3.Table.Rows[iy]["message"].ToString();

                if (ict3.Table.Rows[iy]["pointer_user_id"].ToString() == "0")
                {
                    so.username = ict3.Table.Rows[iy]["username"].ToString();
                    so.photo    = ict3.Table.Rows[iy]["photo"].ToString();
                }
                else
                {
                    SqlDataSource sql6 = new SqlDataSource();
                    sql6.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                    sql6.SelectCommand    = "select username,photo from user_login";
                    sql6.SelectCommand   += " where id=" + ict3.Table.Rows[iy]["pointer_user_id"].ToString() + ";";
                    sql6.DataBind();
                    DataView ict5 = (DataView)sql6.Select(DataSourceSelectArguments.Empty);
                    so.username = ict5.Table.Rows[0]["username"].ToString();
                    so.photo    = ict5.Table.Rows[0]["photo"].ToString();
                }
                talk_list.Add(so);
            }

            SqlDataSource sql5 = new SqlDataSource();
            sql5.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            sql5.SelectCommand    = "select max(e.structure_level) as maxlevel";
            //sql5.SelectCommand = "select e.id,e.message,e.filename,b.username,b.photo,e.pointer_message_id,e.pointer_user_id,e.structure_level";
            sql5.SelectCommand += " from status_messages as a inner join status_messages_user as c";
            sql5.SelectCommand += " on a.id=c.smid inner join user_login as b on b.id=c.uid";
            sql5.SelectCommand += " inner join status_messages_user_talk as e on e.smuid=c.id";
            sql5.SelectCommand += " where a.id=" + ict.Table.Rows[i]["id"].ToString() + ";";
            sql5.DataBind();
            DataView ict4 = (DataView)sql5.Select(DataSourceSelectArguments.Empty);

            int maxlevel = 0;
            if (ict4.Table.Rows[0]["maxlevel"].ToString() != "")
            {
                maxlevel = Convert.ToInt32(ict4.Table.Rows[0]["maxlevel"].ToString());
            }

            List <sorttalk> talk_list_tmp = new List <sorttalk>();
            so = new sorttalk();
            for (int ik = 0; ik < talk_list.Count; ik++)
            {
                if (talk_list[ik].level == 0)
                {
                    so          = new sorttalk();
                    so.id       = talk_list[ik].id;
                    so.level    = talk_list[ik].level;
                    so.filename = talk_list[ik].filename;
                    so.mess     = talk_list[ik].mess;
                    so.photo    = talk_list[ik].photo;
                    so.point_id = talk_list[ik].point_id;
                    so.uid      = talk_list[ik].uid;
                    so.username = talk_list[ik].username;
                    talk_list_tmp.Add(so);
                }
            }
            talk_list.Sort((a, b) => a.id.CompareTo(b.id));
            for (int ik = 0; ik < talk_list.Count; ik++)
            {
                for (int le = 1; le < maxlevel + 1; le++)
                {
                    if (talk_list[ik].level == le)
                    {
                        so          = new sorttalk();
                        so.id       = talk_list[ik].id;
                        so.level    = talk_list[ik].level;
                        so.filename = talk_list[ik].filename;
                        so.mess     = talk_list[ik].mess;
                        so.photo    = talk_list[ik].photo;
                        so.point_id = talk_list[ik].point_id;
                        so.uid      = talk_list[ik].uid;
                        so.username = talk_list[ik].username;
                        for (int ikk = 0; ikk < talk_list_tmp.Count; ikk++)
                        {
                            if (talk_list_tmp[ikk].id == talk_list[ik].point_id)
                            {
                                talk_list_tmp.Insert(ikk + 1, so);
                            }
                        }
                    }
                }
            }
            Image img2 = new Image();
            if (ict3.Count > 1)
            {
                //show div
                pdn2.Controls.Add(new LiteralControl("<div class='mess_box" + i + "'>"));
                pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
                pdn2.Controls.Add(new LiteralControl("<tr>"));
                pdn2.Controls.Add(new LiteralControl("<td width='100%' align='left' colspan='2'>"));

                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "以前のコメントを見る";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);

                pdn2.Controls.Add(new LiteralControl("</td>"));
                pdn2.Controls.Add(new LiteralControl("</tr>"));
                pdn2.Controls.Add(new LiteralControl("<tr>"));
                pdn2.Controls.Add(new LiteralControl("<td width='10%' rowspan='2' valign='top'>"));

                img2          = new Image();
                img2.Height   = 50; img2.Width = 50;
                img2.ImageUrl = talk_list_tmp[0].photo;

                pdn2.Controls.Add(img2);
                pdn2.Controls.Add(new LiteralControl("</td>"));
                pdn2.Controls.Add(new LiteralControl("<td width='90%' style=" + '"' + "word-break:break-all;" + '"' + ">"));

                pdn2.Controls.Add(new LiteralControl(ict3.Table.Rows[0]["username"].ToString()));
                pdn2.Controls.Add(new LiteralControl("<br/>"));
                pdn2.Controls.Add(new LiteralControl(ict3.Table.Rows[0]["message"].ToString()));
                pdn2.Controls.Add(new LiteralControl("<br/>"));

                if (talk_list_tmp[0].filename != "")
                {
                    img2          = new Image();
                    img2.Height   = 50; img2.Width = 50;
                    img2.ImageUrl = talk_list_tmp[0].filename;
                    pdn2.Controls.Add(img2);
                    pdn2.Controls.Add(new LiteralControl("<br/>"));
                }

                pdn2.Controls.Add(new LiteralControl("</td>"));
                pdn2.Controls.Add(new LiteralControl("</tr>"));
                pdn2.Controls.Add(new LiteralControl("<tr>"));
                pdn2.Controls.Add(new LiteralControl("<td>"));
                //who talk about status message and who like
                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "いいね!";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);
                pdn2.Controls.Add(new LiteralControl("&nbsp;&nbsp;"));
                hyy                = new HyperLink();
                hyy.NavigateUrl    = "javascript:void(0);";
                hyy.Target         = "_blank";
                hyy.Text           = "返信";
                hyy.Font.Underline = false;
                pdn2.Controls.Add(hyy);

                pdn2.Controls.Add(new LiteralControl("</td>"));
                pdn2.Controls.Add(new LiteralControl("</tr>"));
                pdn2.Controls.Add(new LiteralControl("</table>"));
                pdn2.Controls.Add(new LiteralControl("</div>"));
                //hidde message
                pdn2.Controls.Add(new LiteralControl("<div class='mess_hidde" + i + "'>"));
                pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
                for (int iiii = 0; iiii < talk_list_tmp.Count; iiii++)
                {
                    pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
                    pdn2.Controls.Add(new LiteralControl("<tr>"));
                    int wid = (10 + (10 * talk_list_tmp[iiii].level));
                    if (wid > 90)
                    {
                        wid = 90;
                    }
                    pdn2.Controls.Add(new LiteralControl("<td width='" + wid + "%' align='right' rowspan='2' valign='top'>"));

                    img2          = new Image();
                    img2.Width    = 50; img2.Height = 50;
                    img2.ImageUrl = talk_list_tmp[iiii].photo;
                    pdn2.Controls.Add(img2);

                    pdn2.Controls.Add(new LiteralControl("</td>"));

                    pdn2.Controls.Add(new LiteralControl("<td width='" + (100 - wid) + "%'  style=" + '"' + "word-break:break-all;" + '"' + ">"));

                    pdn2.Controls.Add(new LiteralControl(talk_list_tmp[iiii].username.ToString()));
                    pdn2.Controls.Add(new LiteralControl("<br/>"));
                    pdn2.Controls.Add(new LiteralControl(talk_list_tmp[iiii].mess.ToString()));
                    pdn2.Controls.Add(new LiteralControl("<br/>"));

                    if (talk_list_tmp[iiii].filename.ToString() != "")
                    {
                        img2          = new Image();
                        img2.Height   = 50; img2.Width = 50;
                        img2.ImageUrl = talk_list_tmp[iiii].filename.ToString();
                        pdn2.Controls.Add(img2);
                        pdn2.Controls.Add(new LiteralControl("<br/>"));
                    }

                    pdn2.Controls.Add(new LiteralControl("</td>"));
                    pdn2.Controls.Add(new LiteralControl("</tr>"));
                    pdn2.Controls.Add(new LiteralControl("<tr>"));
                    pdn2.Controls.Add(new LiteralControl("<td>"));


                    //who talk about status message and who like
                    hyy                = new HyperLink();
                    hyy.NavigateUrl    = "javascript:void(0);";
                    hyy.Target         = "_blank";
                    hyy.Text           = "いいね!";
                    hyy.Font.Underline = false;
                    pdn2.Controls.Add(hyy);
                    pdn2.Controls.Add(new LiteralControl("&nbsp;&nbsp;"));
                    hyy                = new HyperLink();
                    hyy.NavigateUrl    = "javascript:void(0);";
                    hyy.Target         = "_blank";
                    hyy.Text           = "返信";
                    hyy.Font.Underline = false;
                    pdn2.Controls.Add(hyy);

                    pdn2.Controls.Add(new LiteralControl("</td>"));
                    pdn2.Controls.Add(new LiteralControl("</tr>"));


                    pdn2.Controls.Add(new LiteralControl("</table>"));
                }
                pdn2.Controls.Add(new LiteralControl("</div>"));
            }
            else
            {
                if (ict3.Count > 0)
                {
                    for (int iiii = 0; iiii < talk_list_tmp.Count; iiii++)
                    {
                        pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
                        pdn2.Controls.Add(new LiteralControl("<tr>"));
                        int wid = (10 + (10 * talk_list_tmp[iiii].level));
                        if (wid > 90)
                        {
                            wid = 90;
                        }
                        pdn2.Controls.Add(new LiteralControl("<td width='" + wid + "%' align='right' rowspan='2' valign='top'>"));

                        img2          = new Image();
                        img2.Width    = 50; img2.Height = 50;
                        img2.ImageUrl = talk_list_tmp[iiii].photo;
                        pdn2.Controls.Add(img2);

                        pdn2.Controls.Add(new LiteralControl("</td>"));

                        pdn2.Controls.Add(new LiteralControl("<td width='" + (100 - wid) + "%'  style=" + '"' + "word-break:break-all;" + '"' + ">"));

                        pdn2.Controls.Add(new LiteralControl(talk_list_tmp[iiii].username.ToString()));
                        pdn2.Controls.Add(new LiteralControl("<br/>"));
                        pdn2.Controls.Add(new LiteralControl(talk_list_tmp[iiii].mess.ToString()));
                        pdn2.Controls.Add(new LiteralControl("<br/>"));

                        if (talk_list_tmp[iiii].filename.ToString() != "")
                        {
                            img2          = new Image();
                            img2.Height   = 50; img2.Width = 50;
                            img2.ImageUrl = talk_list_tmp[iiii].filename.ToString();
                            pdn2.Controls.Add(img2);
                            pdn2.Controls.Add(new LiteralControl("<br/>"));
                        }

                        pdn2.Controls.Add(new LiteralControl("</td>"));
                        pdn2.Controls.Add(new LiteralControl("</tr>"));
                        pdn2.Controls.Add(new LiteralControl("<tr>"));
                        pdn2.Controls.Add(new LiteralControl("<td>"));


                        //who talk about status message and who like
                        hyy                = new HyperLink();
                        hyy.NavigateUrl    = "javascript:void(0);";
                        hyy.Target         = "_blank";
                        hyy.Text           = "いいね!";
                        hyy.Font.Underline = false;
                        pdn2.Controls.Add(hyy);
                        pdn2.Controls.Add(new LiteralControl("&nbsp;&nbsp;"));
                        hyy                = new HyperLink();
                        hyy.NavigateUrl    = "javascript:void(0);";
                        hyy.Target         = "_blank";
                        hyy.Text           = "返信";
                        hyy.Font.Underline = false;
                        pdn2.Controls.Add(hyy);

                        pdn2.Controls.Add(new LiteralControl("</td>"));
                        pdn2.Controls.Add(new LiteralControl("</tr>"));


                        pdn2.Controls.Add(new LiteralControl("</table>"));
                    }
                }
            }

            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));


            pdn2.Controls.Add(new LiteralControl("</table>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));
            //second space way
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            //third space way
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("<td>"));

            pdn2.Controls.Add(new LiteralControl("<table width='100%'>"));
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td width='10%' valign='top'>"));
            //user photo

            img1          = new Image();
            img1.Width    = 50; img1.Height = 50;
            img1.ImageUrl = "~/images/mike.jpg";

            pdn2.Controls.Add(img1);

            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("<td width='90%'>"));

            //user answer

            TextBox tex = new TextBox();
            tex.Width  = Unit.Percentage(100);
            tex.Height = 30;
            tex.Attributes.Add("placeholder", "コメントする");
            pdn2.Controls.Add(tex);
            pdn2.Controls.Add(new LiteralControl("<br/>"));

            pdn2.Controls.Add(new LiteralControl(@"
<label class='file-upload'><span><strong style='font-size: 20px;'>画像を登録</strong></span>
            <input type='file' name='file' id='btnFileUpload" + i + @"' />
</label>
<br />
            <div id='progressbar" + i + @"' style='width:100px;display:none;'>
                <div>
                    読み込み中
                </div>
            </div>
<br />
                <div id='image_place" + i + @"' style='width:100px;display:none;'>
                    <div>
                        <img id='make-image" + i + @"' alt='' src='' width='100px' height='100px'/>
                    </div>
                </div>
"));



            //pdn2.Controls.Add(new LiteralControl(@"<label class='file-upload'><span><strong>画像を登録</strong></span>"));

            //FileUpload fi=new FileUpload();
            //fi.ID="fuDocument_"+i;
            //fi.Attributes.Add("onchange", "UploadFile(this,this.id);");
            //pdn2.Controls.Add(fi);
            //pdn2.Controls.Add(new LiteralControl(@"</label><br />"));



            //Button but = new Button();
            //but.ID = "btnUploadDoc_" + i;
            //but.Text = "Upload";
            //but.Click += new System.EventHandler(this.UploadDocument);
            //but.OnClientClick = "ShowProgressBar();";
            //but.Style["display"] = "none";
            //pdn2.Controls.Add(but);

            //img1 = new Image();
            //img1.Width = 100; img1.Height = 150;
            //img1.ID = "Image_" + i;
            //img1.Visible = false;


            //pdn2.Controls.Add(img1);



            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("</table>"));


            pdn2.Controls.Add(new LiteralControl("</div>"));


            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            //fourth space way
            pdn2.Controls.Add(new LiteralControl("<tr>"));
            pdn2.Controls.Add(new LiteralControl("<td width='5%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("<td width='90%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("<td width='5%' height='5%'></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));
            pdn2.Controls.Add(new LiteralControl("</table>"));
            pdn2.Controls.Add(new LiteralControl("</td>"));
            pdn2.Controls.Add(new LiteralControl("<td></td>"));
            pdn2.Controls.Add(new LiteralControl("</tr>"));



            pdn2.Controls.Add(new LiteralControl("</table>"));
            pdn2.Controls.Add(new LiteralControl("<hr/>"));
        }



        //this.form1.Controls.Add(pdn2);



        //pdn.Controls.Add(new LiteralControl("<table align='center'>"));
        //pdn.Controls.Add(new LiteralControl("<tr><td align='center'>"));
        //pdn.Controls.Add(la);


        //string startd = DateTime.Now.Date.ToString("yyyy-MM-dd");
        //string starth = Convert.ToInt32(DateTime.Now.ToString("HH")).ToString();
        //string startm = DateTime.Now.Minute.ToString();
        //string starts = DateTime.Now.Second.ToString();
        //string d = Convert.ToString(DateTime.Now.ToLocalTime());
        //string start = startd + " " + starth + ":" + startm + ":" + starts;
        //string star = starth + ":" + startm + ":" + starts;
        //Session["student_starttimeh"] = starth;
        //Session["student_starttimem"] = startm;
        //Session["student_starttimes"] = starts;


        //sql1.SelectCommand = "select date,starttime,endtime from fordate where date='" + startd + "' and starttime<'" + start + "' and endtime>'" + start + "';";
        //DataView ict = (DataView)sql1.Select(DataSourceSelectArguments.Empty);
        //this.form1.Controls.Add(sql1);
    }
Exemplo n.º 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ArrayList prods = new ArrayList();
        ArrayList qtys  = new ArrayList();

        //prods = (ArrayList)Session["cartprod"];
        //qtys = (ArrayList)Session["cartqty"];
        prods = Session["cartprod"] == null ? prods : (ArrayList)Session["cartprod"];
        qtys  = Session["cartqty"] == null ? qtys : (ArrayList)Session["cartqty"];

        /*if (!this.IsPostBack)
         * {
         *  prods.Add(Request.QueryString["product_id"]);
         *  qtys.Add(Request.QueryString["qty"]);
         * }
         *
         * Session["cartprod"] = prods;
         * Session["cartqty"] = qtys;*/

        if (prods.Count > 0)
        {
            // ====================

            SqlDataSource ds = new SqlDataSource();

            string sqlstatement = "SELECT ROW_NUMBER() over(order by product_id) as ROWNUM, product_id, productname, saleprice, 0 as QTY_ORDER, 0 as LineTotal  FROM [Product] ";

            if (prods.Count > 1)
            {
                sqlstatement = sqlstatement + " WHERE product_id = " + prods[0].ToString();
                for (int i = 1; i < prods.Count; i++)
                {
                    sqlstatement = sqlstatement + " OR product_id = " + prods[i].ToString();
                }
            }
            else
            {
                sqlstatement = sqlstatement + "WHERE product_id = " + prods[0].ToString();
            }
            ds.SelectCommand = sqlstatement;

            ds.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["divdevConnectionString"].ConnectionString;

            ds.DataBind();

            GridView1.DataSource = ds;
            GridView1.DataBind();


            // Populate Quantities
            for (int i = 0; i < qtys.Count; i++)
            {
                GridView1.Rows[i].Cells[5].Text = qtys[i].ToString();
            }

            decimal prodprice;
            int     qtypur;
            decimal linetotresult = 0;
            decimal basket_total  = 0;
            int     qty_total     = 0;

            // Populate Line Totals and Accumulate Basket Total
            for (int i = 1; i <= prods.Count; i++)
            {
                prodprice     = Decimal.Parse(GridView1.Rows[i - 1].Cells[4].Text);
                qtypur        = Int16.Parse(GridView1.Rows[i - 1].Cells[5].Text);
                linetotresult = prodprice * qtypur;
                qty_total     = (int)qty_total + qtypur;
                basket_total  = basket_total + linetotresult;
                GridView1.Rows[i - 1].Cells[6].Text = linetotresult.ToString("C", CultureInfo.CurrentCulture);
            }

            // Provide Summary
            GridView1.FooterRow.Cells[4].Text            = "Totals";
            GridView1.FooterRow.Cells[4].HorizontalAlign = HorizontalAlign.Right;
            GridView1.FooterRow.Cells[5].Text            = qty_total.ToString();
            GridView1.FooterRow.Cells[6].Text            = basket_total.ToString("C", CultureInfo.CurrentCulture);
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        //user photo and name user_photo
        //預かり日時 sandbox-container
        //預かり内容 report_content
        //預かり時の様子 report_list
        string        selectdate = "", photo = "", username = "", howtoget_there = "";
        string        cutstr_h = "", cutstr_h1 = "";
        int           ind_h   = 0;
        List <string> kidlist = new List <string>();
        DateTime      todate  = new DateTime();
        string        week    = "";

        string constr         = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        string activationCode = !string.IsNullOrEmpty(Request.QueryString["ActivationCode"]) ? Request.QueryString["ActivationCode"] : Guid.Empty.ToString();


        SqlDataSource sql_f = new SqlDataSource();

        sql_f.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        sql_f.SelectCommand    = "select uid,supp_id,uiacdid";
        sql_f.SelectCommand   += " from user_information_store_week_appointment_check_check";
        sql_f.SelectCommand   += " where ActivationCode='" + activationCode + "';";
        sql_f.DataBind();
        DataView ict_f = (DataView)sql_f.Select(DataSourceSelectArguments.Empty);
        string   id = "", supid = "", uiacdid = "";

        for (int i = 0; i < ict_f.Count; i++)
        {
            id      = ict_f.Table.Rows[i]["uid"].ToString();
            supid   = ict_f.Table.Rows[i]["supp_id"].ToString();
            uiacdid = ict_f.Table.Rows[i]["uiacdid"].ToString();
        }
        //now time
        string startd = DateTime.Now.Date.ToString("yyyy-MM-dd");
        string starth = Convert.ToInt32(DateTime.Now.ToString("HH")).ToString();
        string startm = DateTime.Now.Minute.ToString();
        string starts = DateTime.Now.Second.ToString();
        string start  = startd + " " + starth + ":" + startm + ":" + starts;

        //now time
        if (Session["id"] != null)
        {
            if (Session["id"].ToString() == id.ToString())
            {
                bool check_again = false;
                //select 定期 one day
                sql_f.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                sql_f.SelectCommand    = "select d.money_hour,d.hour,d.total_money,f.login_name,d.uisccid,a.id,d.uiswaid,d.uid,f.photo,f.username,a.type,a.check_success,d.start_date,d.end_date,d.start_hour,d.start_minute,d.end_hour,d.end_minute,d.howtoget_there";
                sql_f.SelectCommand   += " from user_information_appointment_check_deal as a";
                sql_f.SelectCommand   += " inner join user_information_appointment_check_connect_deal as b on a.id=b.uiacdid";
                sql_f.SelectCommand   += " inner join user_information_store_week_appointment_check as d on b.uiswacid=d.id";
                sql_f.SelectCommand   += " inner join user_login as f on f.id=a.uid ";
                sql_f.SelectCommand   += " where a.type='1' and a.suppid='" + supid + "' and a.id='" + uiacdid + "' and check_success=4";
                sql_f.SelectCommand   += " order by DATEPART(day, d.start_date) asc,a.first_check_time asc,d.uid asc;";
                sql_f.DataBind();
                ict_f = (DataView)sql_f.Select(DataSourceSelectArguments.Empty);

                if (ict_f.Count > 0)
                {
                    check_again = true;

                    for (int i = 0; i < ict_f.Count; i++)
                    {
                        DateTime.TryParse(ict_f.Table.Rows[i]["start_date"].ToString(), out todate);
                        if (todate.DayOfWeek == DayOfWeek.Monday)
                        {
                            week = "月曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Tuesday)
                        {
                            week = "火曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Wednesday)
                        {
                            week = "水曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Thursday)
                        {
                            week = "木曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Friday)
                        {
                            week = "金曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Saturday)
                        {
                            week = "土曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Sunday)
                        {
                            week = "日曜日";
                        }
                        selectdate  = "<br/><span style='font-size:large;color:#EA9494;'>単発</span><br/>";
                        selectdate += "<br/><span style='font-size:large;color:#EA9494;'>" + week + ", " + todate.Month + " 月 " + todate.Day + " 日, ";
                        selectdate += ict_f.Table.Rows[i]["start_hour"].ToString() + ":" + ict_f.Table.Rows[i]["start_minute"].ToString() + "~" + ict_f.Table.Rows[i]["end_hour"].ToString() + ":" + ict_f.Table.Rows[i]["end_minute"].ToString() + "</span><br/>";

                        howtoget_there = "<br/><span>" + ict_f.Table.Rows[i]["howtoget_there"].ToString() + "</span><br/>";
                    }
                }

                //select 定期 more than one day
                SqlDataSource sql_f1 = new SqlDataSource();
                sql_f1.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                sql_f1.SelectCommand    = "select a.id,f.login_name,d.uisccid,d.uiswaid,d.uid,f.photo,f.username,a.type,a.check_success,d.start_date,d.end_date,d.start_hour,d.start_minute,d.end_hour,d.end_minute,d.howtoget_there";
                sql_f1.SelectCommand   += " from user_information_appointment_check_deal as a";
                sql_f1.SelectCommand   += " inner join user_information_appointment_check_connect_deal as b on a.id=b.uiacdid";
                sql_f1.SelectCommand   += " inner join user_information_store_week_appointment_check as d on b.uiswacid=d.id";
                sql_f1.SelectCommand   += " inner join user_login as f on f.id=a.uid";
                sql_f1.SelectCommand   += " where a.type='2' and a.suppid='" + supid + "' and a.id='" + uiacdid + "' and check_success=4";
                sql_f1.SelectCommand   += " order by DATEPART(day, d.start_date) asc,a.first_check_time asc,a.id asc;";
                sql_f1.DataBind();
                DataView ict_f1 = (DataView)sql_f1.Select(DataSourceSelectArguments.Empty);


                if (ict_f1.Count > 0)
                {
                    check_again = true;
                    for (int ii = 0; ii < ict_f1.Count; ii++)
                    {
                        DateTime.TryParse(ict_f1.Table.Rows[ii]["start_date"].ToString(), out todate);

                        if (todate.DayOfWeek == DayOfWeek.Monday)
                        {
                            week = "月曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Tuesday)
                        {
                            week = "火曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Wednesday)
                        {
                            week = "水曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Thursday)
                        {
                            week = "木曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Friday)
                        {
                            week = "金曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Saturday)
                        {
                            week = "土曜日";
                        }
                        else if (todate.DayOfWeek == DayOfWeek.Sunday)
                        {
                            week = "日曜日";
                        }
                        selectdate  = "<br/><span style='font-size:large;color:#EA9494;'>定期</span><br/>";
                        selectdate += "<br/><span style='font-size:large;color:#EA9494;'>" + todate.Month + " 月 " + todate.Day + " 日 ~ ";

                        DateTime.TryParse(ict_f1.Table.Rows[ii]["end_date"].ToString(), out todate);
                        selectdate += todate.Month + " 月 " + todate.Day + " 日</span><br/>";

                        sql_f.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                        sql_f.SelectCommand    = "select d.money_hour,d.hour,d.total_money,d.uisccid,g.week_of_day_jp,g.week_of_day,a.id,d.uiswaid,d.uid,f.photo,f.username,a.type,a.check_success,d.start_date,d.end_date,d.start_hour,d.start_minute,d.end_hour,d.end_minute,d.howtoget_there";
                        sql_f.SelectCommand   += " from user_information_appointment_check_deal as a";
                        sql_f.SelectCommand   += " inner join user_information_appointment_check_connect_deal as b on a.id=b.uiacdid";
                        sql_f.SelectCommand   += " inner join user_information_store_week_appointment_check as d on b.uiswacid=d.id";
                        sql_f.SelectCommand   += " inner join user_login as f on f.id=a.uid";
                        sql_f.SelectCommand   += " inner join user_information_store_week_appointment as g on g.id=d.uiswaid";
                        sql_f.SelectCommand   += " where a.id='" + uiacdid + "' and a.type='2' and a.suppid='" + supid + "'";
                        sql_f.SelectCommand   += " order by DATEPART(day, d.start_date) asc,a.first_check_time asc,d.uid asc;";
                        sql_f.DataBind();
                        ict_f = (DataView)sql_f.Select(DataSourceSelectArguments.Empty);
                        string temp_uiswaid = "", temp_uid = "";
                        bool   check_same = false;
                        if (ict_f.Count > 0)
                        {
                            for (int i = 0; i < ict_f.Count; i++)
                            {
                                check_same = false;
                                if (i == 0)
                                {
                                    temp_uiswaid = ict_f.Table.Rows[i]["uiswaid"].ToString();
                                    temp_uid     = ict_f.Table.Rows[i]["uid"].ToString();
                                    check_same   = true;
                                }
                                else
                                {
                                    if (temp_uiswaid != ict_f.Table.Rows[i]["uiswaid"].ToString() || temp_uid != ict_f.Table.Rows[i]["uid"].ToString())
                                    {
                                        temp_uiswaid = ict_f.Table.Rows[i]["uiswaid"].ToString();
                                        temp_uid     = ict_f.Table.Rows[i]["uid"].ToString();
                                        check_same   = true;
                                    }
                                }
                                if (check_same)
                                {
                                    week = ict_f.Table.Rows[i]["week_of_day_jp"].ToString() + "曜日";

                                    selectdate += "<br/><span style='font-size:large;color:#EA9494;'>" + week + ", ";
                                    selectdate += ict_f.Table.Rows[i]["start_hour"].ToString() + ":" + ict_f.Table.Rows[i]["start_minute"].ToString() + "~" + ict_f.Table.Rows[i]["end_hour"].ToString() + ":" + ict_f.Table.Rows[i]["end_minute"].ToString() + "</span><br/>";
                                }
                            }
                        }


                        howtoget_there = "<br/><span>" + ict_f1.Table.Rows[ict_f1.Count - 1]["howtoget_there"].ToString() + "</span><br/><br/>";
                    }
                }

                sql_f1 = new SqlDataSource();
                sql_f1.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                sql_f1.SelectCommand    = "select photo,username";
                sql_f1.SelectCommand   += " from user_login";
                sql_f1.SelectCommand   += " where id='" + supid + "';";
                sql_f1.DataBind();
                ict_f1 = (DataView)sql_f1.Select(DataSourceSelectArguments.Empty);
                if (ict_f1.Count > 0)
                {
                    //user photo
                    photo     = "<div class='zoom-gallery'>";
                    cutstr_h  = ict_f1.Table.Rows[0]["photo"].ToString();
                    ind_h     = cutstr_h.IndexOf(@"/");
                    cutstr_h1 = cutstr_h.Substring(ind_h + 1, cutstr_h.Length - ind_h - 1);
                    photo    += "<a href='" + cutstr_h1 + "' data-source='" + cutstr_h1 + "' title='" + ict_f1.Table.Rows[0]["username"].ToString() + "' style='width:100px;height:100px;'>";
                    photo    += "<img src='" + cutstr_h1 + "' width='100' height='100' />";
                    photo    += "</a>";
                    photo    += "</div>";
                    username  = "******" + ict_f1.Table.Rows[0]["username"].ToString() + "</span><br/>";
                }
                //user photo and name user_photo
                //預かり日時 sandbox-container
                //預かり内容 report_content
                //預かり時の様子 report_list
                string information_pan = "";
                information_pan += @"<table width='100%' height='100%' style='background-color: #F5F5F5;'>
                            <tr><td width='5%'></td><td width='90%'>
            ";
                //user photo
                information_pan += @"<table width='100%'>
<tr><td width='10%'></td><td width='80%' align='center' valign='top'>" + photo + @"
</td><td width='10%'></td></tr>
</table>";
                //user name
                information_pan += @"<table width='100%'>
<tr><td width='10%'></td><td width='80%' align='center' valign='top'>";
                information_pan += username;

                information_pan += @"<br/><br/></td><td width='10%'></td></tr>
</table>";
                user_photo.Controls.Add(new LiteralControl(information_pan));
                sandboxcontainer.Controls.Add(new LiteralControl(selectdate));
                report_content.Controls.Add(new LiteralControl(howtoget_there));
                //string relist = "";
                //sql_f1 = new SqlDataSource();
                //sql_f1.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
                //sql_f1.SelectCommand = "select content_success";
                //sql_f1.SelectCommand += " from user_information_appointment_check_deal";
                //sql_f1.SelectCommand += " where id='" + uiacdid + "';";
                //sql_f1.DataBind();
                //ict_f1 = (DataView)sql_f1.Select(DataSourceSelectArguments.Empty);
                //if (ict_f1.Count > 0)
                //{
                //    relist = "<span style='text-align: center;font-size:medium;'>" + ict_f1.Table.Rows[0]["content_success"].ToString() + "</span><br/>";
                //}



                if (check_again)
                {
                    button_pan.Controls.Add(new LiteralControl("<input type='button' id='buttonsub_" + uiacdid + "' value='評価を送付' onclick='report_create_success(this.id)' style='width: 100%;text-shadow: none;cursor: pointer;text-align: center;' class='file-upload'>"));
                }
            }
            else
            {
                Response.Redirect("main.aspx");
            }
        }
        else
        {
            Response.Redirect("main.aspx");
        }
    }
Exemplo n.º 30
0
        /// <summary>
        /// Mauricio Arias Olave.
        /// 25/04/2014.
        /// Mostrar la grilla con los resultados de la búsqueda.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Buscar_Click(object sender, EventArgs e)
        {
            //Inicializar variables.
            String sqlConsulta      = "";
            String sqlWhere         = "";
            String sqlConsultaFinal = "";

            try
            {
                #region Construcción de la consulta dependiendo de el nombre y número del plan/proyecto.

                if (txt_NombrePlan.Text.Trim() == "" && txt_NumeroPlan.Text.Trim() == "")
                {
                    sqlConsulta = " SELECT DISTINCT Id_Contacto, Nombres, Apellidos, Email, Identificacion, o.NombreOperador" +
                                  ", NomGrupo, " +
                                  /*Se debe colocar las columnas para evitar que se "dañe el flujo" del código.*/
                                  " '' AS Id_Proyecto, '' AS Id_Grupo, '' AS NomGrupo, '' AS NomProyecto " +
                                  " FROM Contacto c LEFT JOIN GrupoContacto gc  " +
                                  " ON c.Id_Contacto = gc.CodContacto LEFT JOIN Grupo g on gc.CodGrupo = g.Id_Grupo" +
                                  "  left join Operador o on c.codOperador = o.IdOperador";
                }
                else
                {
                    sqlConsulta = " SELECT DISTINCT Id_Contacto, Nombres, Apellidos, Email, Identificacion, o.NombreOperador" +
                                  ", NomProyecto, " +
                                  " Id_Proyecto, Id_Grupo, NomGrupo " +
                                  " FROM contacto c LEFT JOIN proyectocontacto pc " +
                                  " ON c.Id_Contacto = pc.CodContacto LEFT JOIN proyecto p " +
                                  " ON pc.CodProyecto = p.id_proyecto LEFT JOIN GrupoContacto gc " +
                                  " ON c.Id_Contacto = gc.CodContacto LEFT JOIN Grupo g " +
                                  " ON gc.CodGrupo = g.id_Grupo" +
                                  "  left join Operador o on p.codOperador = o.IdOperador";
                }

                #endregion

                /*
                 *
                 #region Evaluación del nombre del usuario digitado.
                 *
                 * if (txt_Nombres.Text.Trim() != "")
                 * {
                 *  sqlWhere = " WHERE Nombres LIKE '%'+'" + txt_Nombres.Text.Trim() + "'+'%' ";
                 * }
                 *
                 #endregion
                 *
                 #region Evaluación de los apellidos.
                 *
                 * if (txt_Apellidos.Text.Trim() != "")
                 * {
                 *  if (sqlWhere == "")
                 *  {
                 *      sqlWhere = "WHERE Apellidos LIKE '%'+'" + txt_Apellidos.Text.Trim() + "'+'%' ";
                 *  }
                 *  else
                 *  {
                 *      sqlWhere = sqlWhere + " AND Apellidos LIKE '%'+'" + txt_Apellidos.Text.Trim() + "'+'%' ";
                 *  }
                 * }
                 *
                 #endregion
                 *
                 #region Evaluación del correo electrónico.
                 *
                 * if (txt_Email.Text.Trim() != "")
                 * {
                 *  if (sqlWhere == "")
                 *  {
                 *      sqlWhere = "WHERE Email LIKE '%'+'" + txt_Email.Text.Trim() + "'+'%' ";
                 *  }
                 *  else
                 *  {
                 *      sqlWhere = sqlWhere + " AND Email LIKE '%'+'" + txt_Email.Text.Trim() + "'+'%' ";
                 *  }
                 * }
                 *
                 #endregion
                 *
                 #region Evaluación del número de identificación.
                 *
                 * if (txt_Identificacion.Text.Trim() != "")
                 * {
                 *  if (sqlWhere == "")
                 *  {
                 *      sqlWhere = "WHERE Identificacion = " + txt_Identificacion.Text.Trim() + " ";
                 *  }
                 *  else
                 *  {
                 *      sqlWhere = sqlWhere + " AND Identificacion = " + txt_Identificacion.Text.Trim() + " ";
                 *  }
                 * }
                 *
                 #endregion
                 *
                 #region Evaluación del nombre del proyecto.
                 *
                 * if (txt_NombrePlan.Text.Trim() != "")
                 * {
                 *  if (sqlWhere == "")
                 *  {
                 *      sqlWhere = "WHERE NomProyecto LIKE '%'+'" + txt_NombrePlan.Text.Trim() + "'+'%' ";
                 *  }
                 *  else
                 *  {
                 *      sqlWhere = sqlWhere + " AND NomProyecto LIKE '%'+'" + txt_NombrePlan.Text.Trim() + "'+'%' ";
                 *  }
                 * }
                 *
                 #endregion
                 *
                 #region Evaluación del número del proyecto.
                 *
                 * if (txt_NumeroPlan.Text.Trim() != "")
                 * {
                 *  if (sqlWhere == "")
                 *  {
                 *      sqlWhere = "WHERE Id_Proyecto = " + txt_NumeroPlan.Text.Trim() + " ";
                 *  }
                 *  else
                 *  {
                 *      sqlWhere = sqlWhere + " AND Id_Proyecto = " + txt_NumeroPlan.Text.Trim() + " ";
                 *  }
                 * }
                 *
                 #endregion
                 *
                 */

                if (sqlWhere.Trim() == "")
                {
                    //sqlWhere = "WHERE Nombres LIKE '%'+'Ninguno... .+''%'"; //Creo debe ser modificarlo y dejarse así: "LIKE '%'+' '+'%'"
                }

                //Consulta
                sqlConsultaFinal = sqlConsulta; // +" " + sqlWhere;

                //var dtEmpresas = consultas.ObtenerDataTable(sqlConsultaFinal, "text");

                //La consulta estuvo bien armada y continúa el flujo; es decir, generar la grilla.
                //Actualización: No se pone la condicional IF porque si no hay datos, NO se debe mostrar la grilla
                //ni resultados "según el comportamiento del FONADE clásico".
                //Session["dtEmpresas"] = dtEmpresas;

                if (!String.IsNullOrEmpty(txt_Nombres.Text) || !String.IsNullOrEmpty(txt_Apellidos.Text) ||
                    !String.IsNullOrEmpty(txt_Email.Text) || !String.IsNullOrEmpty(txt_Identificacion.Text) ||
                    !String.IsNullOrEmpty(txt_NombrePlan.Text) || !String.IsNullOrEmpty(txt_NumeroPlan.Text))
                {
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, " where ");
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Nombres.Text) ?
                                                               string.Format(" + Nombres LIKE'%{0}%' ", txt_Nombres.Text) : string.Empty);
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Apellidos.Text) ?
                                                               string.Format(" + Apellidos LIKE'%{0}%' ", txt_Apellidos.Text) : string.Empty);
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Email.Text) ?
                                                               string.Format(" + Email LIKE'%{0}%' ", txt_Email.Text) : string.Empty);
                    sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_Identificacion.Text) ?
                                                               string.Format(" + Identificacion IN ({0})", txt_Identificacion.Text) : string.Empty);
                    if (!String.IsNullOrEmpty(txt_NombrePlan.Text) || !String.IsNullOrEmpty(txt_NumeroPlan.Text))
                    {
                        sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_NombrePlan.Text) ?
                                                                   string.Format(" + NomProyecto LIKE'%{0}%'", txt_NombrePlan.Text) : string.Empty);
                        sqlConsultaFinal = sqlConsultaFinal.Insert(sqlConsultaFinal.Length, !String.IsNullOrEmpty(txt_NumeroPlan.Text) ?
                                                                   string.Format(" + Id_Proyecto IN({0})", txt_NumeroPlan.Text) : string.Empty);
                    }
                    sqlConsultaFinal = sqlConsultaFinal.IndexOf("+") > -1?sqlConsultaFinal.Remove(sqlConsultaFinal.IndexOf("+"), 1):sqlConsultaFinal;
                    var ijn = sqlConsultaFinal.Split('+');
                    sqlConsultaFinal = ijn.Length >= 2 ? sqlConsultaFinal.Replace("+", " AND ") : sqlConsultaFinal.Replace("+", string.Empty);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Vldt", "alert('Especifique los parámetros de consulta.')", true);
                    return;
                }

                SqlDataSource sqlds = new SqlDataSource(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString + ";Connect Timeout=120", sqlConsultaFinal)
                {
                    DataSourceMode    = SqlDataSourceMode.DataReader, ConflictDetection = ConflictOptions.OverwriteChanges, CancelSelectOnNullParameter = true,
                    SelectCommandType = SqlDataSourceCommandType.Text, ID = "sqlDs"
                };
                sqlds.DataBind();

                //gv_ResultadosBusqueda.DataSource = dtEmpresas;
                //gv_ResultadosBusqueda.DataBind();

                //gv_ResultadosBusqueda.DataSource = sqlds;
                //gv_ResultadosBusqueda.DataBind();

                var dtEmpresas = new DataTable();

                GridView1.DataSource = sqlds.Select(new DataSourceSelectArguments());
                sqlds.DataBind();
                GridView1.DataBind();

                //Según el comportamiento del FONADE clásico, los campos son vaciados al terminar de consultar.
                txt_Nombres.Text        = "";
                txt_Apellidos.Text      = "";
                txt_Email.Text          = "";
                txt_Identificacion.Text = "";
                txt_NombrePlan.Text     = "";
                txt_NumeroPlan.Text     = "";
            }
            catch
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('Error en la consulta y/o procedimiento.')", true);
                return;
            }
        }
Exemplo n.º 31
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //  TextBox1.Text = (string)Request.QueryString["itemid"];
        //  TextBox2.Text = (string)Request.QueryString["qty"];


        ArrayList prods = new ArrayList();
        ArrayList qtys  = new ArrayList();

        prods = (ArrayList)Session["cartprod"];
        qtys  = (ArrayList)Session["cartqty"];
        ;



        // ====================

        SqlDataSource ds = new SqlDataSource();

        string sqlstatement = "SELECT ROW_NUMBER() over(order by itemid) as ROWNUM, itemid, itemname,  saleprice, 0 as QTY_ORDER, 0 as LineTotal  FROM [item] ";

        if (prods.Count > 1)
        {
            sqlstatement = sqlstatement + " WHERE itemid = " + prods[0].ToString();
            for (int i = 1; i < prods.Count; i++)
            {
                sqlstatement = sqlstatement + " OR itemid = " + prods[i].ToString();
            }
        }
        else
        {
            sqlstatement = sqlstatement + "WHERE itemid = " + prods[0].ToString();
        }
        ds.SelectCommand = sqlstatement;

        ds.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["pateltechConnectionString2"].ConnectionString;

        ds.DataBind();

        GridView1.DataSource = ds;
        GridView1.DataBind();

        for (int i = 0; i < qtys.Count; i++)
        {
            GridView1.Rows[i].Cells[5].Text = qtys[i].ToString();
        }

        decimal salesprice;
        int     qtypur        = 0;
        decimal linetotresult = 0;
        decimal basket_total  = 0;
        int     qty_total     = 0;

        // Populate Line Totals and Accumulate Basket Total
        for (int i = 0; i < prods.Count; i++)
        {
            salesprice    = Decimal.Parse(GridView1.Rows[i].Cells[4].Text);
            qtypur        = Int16.Parse(GridView1.Rows[i].Cells[5].Text);
            linetotresult = salesprice * qtypur;
            qty_total     = (int)qty_total + qtypur;
            basket_total  = basket_total + linetotresult;
            GridView1.Rows[i].Cells[6].Text = linetotresult.ToString("C", CultureInfo.CurrentCulture);
        }
        // Provide Summary
        GridView1.FooterRow.Cells[4].Text            = "Totals";
        GridView1.FooterRow.Cells[4].HorizontalAlign = HorizontalAlign.Right;
        GridView1.FooterRow.Cells[5].Text            = qty_total.ToString();
        GridView1.FooterRow.Cells[6].Text            = basket_total.ToString("C", CultureInfo.CurrentCulture);
    }