Exemplo n.º 1
0
 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
     string selectString = "SELECT * FROM tb_Userinfo WHERE Username='******'";//select string for search currency name correspond with the input
     SqlDataSource dsrc = new SqlDataSource(conString, selectString);
     DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
     if (DV.Table.Rows.Count > 0)
     {
         string password = (string)DV.Table.Rows[0][7];
         if (password.Equals(Login1.Password))
         {
             //Label1.Text = "Congratulations! Login succeed! Please wait for redirect to Homepage!";
             Session["Username"] = Login1.UserName;
             Session["Call"] = DV.Table.Rows[0][1].ToString();
             Server.Transfer("~/WebSite2/Default.aspx");
             //Response.Write("<script language=javascript>alert('Congratulations! Login succeed!')</script>");
             //System.Threading.Thread.Sleep(5000);
             //Response.Redirect("~/WebSite2/Default.aspx");
         }
         else
             e.Authenticated = false;
     }
     else
         e.Authenticated = false;
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         String userName = Session["Username"].ToString();
         string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
         string selectString = "SELECT * FROM [tb_Userinfo] WHERE Username='******'";//select string for search currency name correspond with the input
         SqlDataSource dsrc = new SqlDataSource(conString, selectString);
         DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
         username.Text = DV.Table.Rows[0][6].ToString();
         Call.Text = DV.Table.Rows[0][1].ToString();
         email.Text = DV.Table.Rows[0][3].ToString();
         Phone.Text = DV.Table.Rows[0][5].ToString();
         if(DV.Table.Rows[0][2].ToString()=="Male")
             RadioGenderList.Items[0].Selected=true;
         else
             RadioGenderList.Items[1].Selected = true;
         switch (DV.Table.Rows[0][4].ToString())
         {
             case "BuCentral": RadioAreaList.Items[1].Selected = true; break;
             case "BuWest": RadioAreaList.Items[0].Selected = true; break;
             case "BuEast": RadioAreaList.Items[2].Selected = true; break;
             case "BuOther": RadioAreaList.Items[3].Selected = true; break;
         }
         Register.Text = "Update";
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Exemplo n.º 3
0
    private void executeQuery()
    {
        x = new SqlDataSource();
        x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd";
        x.SelectCommand = "Select * from Company where companyID='" + companyID + "'";
        DataView dv = x.Select(DataSourceSelectArguments.Empty) as DataView;

        txtCounterInput.Text = dv.Table.Rows[0]["name"].ToString();
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            RestaurantName = Session["Restaurantname"].ToString();
            LabelRname.Text = RestaurantName;
            //Session.Remove("Restaurantname");
            Image1.ImageUrl = "~/WebSite2/Image/BU Central/" + RestaurantName + ".jpg";
            string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
            string selectString = "SELECT * FROM tb_Restaurant WHERE Name='" + RestaurantName +"'";//select string for search currency name correspond with the input
            SqlDataSource dsrc = new SqlDataSource(conString, selectString);
            DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
            LabelAddress.Text = DV.Table.Rows[0][2].ToString();
            LabelContact.Text = DV.Table.Rows[0][3].ToString();
            LabelCuisine.Text = DV.Table.Rows[0][4].ToString();
            float a = float.Parse(DV.Table.Rows[0][5].ToString());

            float b = (float)(Math.Round(a * 100)) / 100;
            LabelRate.Text = b.ToString();

            LabelDescription.Text = DV.Table.Rows[0][7].ToString();

        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
        try
        {
            UserName = Session["Username"].ToString();
            UserCall = Session["Call"].ToString();
            string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
            string selectString = "SELECT * FROM tb_Review WHERE Uname='" + UserCall + "' AND Rname='" + RestaurantName + "'";//select string for search currency name correspond with the input
            SqlDataSource dsrc = new SqlDataSource(conString, selectString);
            DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
            if (DV.Table.Rows.Count > 0)
            {
                LabelReviewRate.Visible = false;
                LabelReviewContent.Visible = false;
                TextBoxRate.Visible = false;
                TextBox1.Visible = false;
                Button1.Visible = false;
            }
        }
        catch (Exception ex)
        {
            LabelReviewRate.Visible = false;
            LabelReviewContent.Visible = false;
            TextBoxRate.Visible = false;
            TextBox1.Visible = false;
            Button1.Visible = false;
            Console.WriteLine(ex.ToString());
        }
    }
Exemplo n.º 5
0
    protected void SubmitButton_Click1(object sender, EventArgs e)
    {
        string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
        string selectString = "SELECT * FROM tb_Userinfo WHERE Username='******'";//select string for search currency name correspond with the input
        SqlDataSource dsrc = new SqlDataSource(conString, selectString);
        DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
        if (DV.Table.Rows.Count > 0)
        {

            Session["UserForgetName"] = PasswordRecovery1.UserName;
            Server.Transfer("ForgetPassword.aspx");
        }
        else
            PasswordRecovery1.UserNameFailureText = "Username not exists! ";
    }
Exemplo n.º 6
0
    public ronUtil2(int id)
    {
        DaysAvailable = getDaysAvailable(id);
        SqlDataSource SqlDataSource3 = new SqlDataSource();
        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource3.SelectCommand = "Select First_Name,Last_Name,Employee_ID,Dept_id,Image From Advisor Where Employee_ID='" + id.ToString() + "'";

        DataView view3 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table3 = view3.ToTable();

        if (table3.Rows.Count > 0)
            FullName = table3.Rows[0][0].ToString() + " " + table3.Rows[0][1].ToString();
        First_Name = table3.Rows[0][0].ToString();
        Last_Name = table3.Rows[0][1].ToString();
        Employee_ID = table3.Rows[0][2].ToString();
        Dept_id = table3.Rows[0][2].ToString();
        Image = table3.Rows[0][3].ToString();
    }
Exemplo n.º 7
0
    protected void btnNewsUpdate_Click(object sender, EventArgs e)
    {
        //actID 已知的活動代碼
        //用where查狀態是否還為"待審中"
        //是待審中再進行更新動作
        //是上架就進行Question 警告使用者 更新後, 將重新送審
        x = new SqlDataSource();
        x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd";
        x.SelectCommand = "Select *from Promotions where activityID ='" + activity.Text + "'";
        DataView dv = x.Select(DataSourceSelectArguments.Empty) as DataView;
        statusID = dv.Table.Rows[0]["statusID"].ToString();

        if (statusID == "3" || statusID == "4")
        {
            //壓縮圖片並存檔
            CImageProess.get().UploadImage(FileUpload1, 資料夾路徑, CDictionary.SET_PROMOTION_PX);

            x = new SqlDataSource();
            x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd";

            string sql = "UPDATE Promotions set ";
            if (!string.IsNullOrEmpty(titleInput.Text))
            {
                sql += " title=N'" + titleInput.Text + "', ";
                if (FileUpload1.HasFile)
                    sql += " picPath='" + CImageProess.imageName + "', ";
                sql += " startDate='" + startDate.Text + "', ";
                sql += " endDate='" + endDate.Text + "', ";
                sql += " onShelfDate = convert(varchar, DATEADD(hour, 8, GETUTCDATE()), 113)," ;
                sql += " statusID = 3 ,";
                sql += " content=N'" + txtNewsContent.Text + "' ";
                sql += " WHERE activityID='" + activity.Text + "'";
                x.UpdateCommand = sql;
                x.Update();
                Response.Redirect("~/windowCompany/companyCheck.aspx");
            }
            else
                return;
        }
        else
            return;
    }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string username = Session["Username"].ToString();
         string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
         string selectString = "SELECT * FROM tb_Userinfo WHERE Username='******'";//select string for search currency name correspond with the input
         SqlDataSource dsrc = new SqlDataSource(conString, selectString);
         DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
         Call.Text = DV.Table.Rows[0][1].ToString();
         Gender.Text = DV.Table.Rows[0][2].ToString();
         email.Text = DV.Table.Rows[0][3].ToString();
         phone.Text = DV.Table.Rows[0][5].ToString();
         area.Text = DV.Table.Rows[0][4].ToString();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Exemplo n.º 9
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DateTime date = DateTime.Now;
        string content = TextBox1.Text.Trim();
        float rate=float.Parse(TextBoxRate.Text.Trim());
        string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
        SqlConnection conn = new SqlConnection(conString);
        conn.Open();
        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = "INSERT INTO tb_Review (Rname, Uname, Content, Date, Rate)VALUES ('" + RestaurantName + "', '" + Session["Call"] + "', '" + content + "', '" + date + "','"+rate+"')";
        cmd.ExecuteNonQuery();

        //Complete Insertion then update new rate
        string conString2 = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
        string selectString = "SELECT * FROM tb_Review WHERE Rname='" + RestaurantName + "'";//select string for search currency name correspond with the input
        SqlDataSource dsrc = new SqlDataSource(conString2, selectString);
        DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
        int rowsCount=DV.Table.Rows.Count;
        float Ratesum=0;
        float newRate = 0;
        if (rowsCount > 0)
        {
            for(int i=0;i<rowsCount;i++)
                Ratesum+=float.Parse(DV.Table.Rows[i][5].ToString());
            newRate = Ratesum / rowsCount;
            cmd.CommandText = "Update tb_Restaurant set Rate='"+newRate+"',Ratenum='"+rowsCount+"' where Name='"+RestaurantName+"'";
            cmd.ExecuteNonQuery();
        }
        conn.Close();
        TextBox1.Visible = false;
        Button1.Visible = false;

        Session["Restaurantname"] = RestaurantName;
        Session["Username"] = UserName;
        Server.Transfer("Restaurant.aspx");
        //Response.Redirect(Request.Url.ToString());
        //string selectString = "INSERT INTO tb_Review (Rname, Uname, Content, Date)VALUES ('RestaurantName', 'Username', 'content', 'date')";//select string for search currency name correspond with the input
        //SqlDataSource dsrc = new SqlDataSource(conString, selectString);
    }
Exemplo n.º 10
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง COURSESUBJECTTYPE
    /// </summary>
    /// <param name="sql">SQL Command</param>
    /// <returns>ข้อมูลจากตาราง COURSESUBJECTTYPE</returns>
    public List <CourseSubjectType> getCourseGroupManual(string sql)
    {
        List <CourseSubjectType> CourseSubjectTypeData = new List <CourseSubjectType>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = sql;

        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            CourseSubjectType CourseSubjectTypeRow = new CourseSubjectType();

            CourseSubjectTypeRow.CourseTypeCode     = rowData["COURSETYPECODE"].ToString();
            CourseSubjectTypeRow.CourseTypeThaiName = rowData["COURSETYPETHAINAME"].ToString();
            CourseSubjectTypeRow.CourseTypeEngName  = rowData["COURSETYPEENGNAME"].ToString();

            CourseSubjectTypeData.Add(CourseSubjectTypeRow);
        }

        return(CourseSubjectTypeData);
    }
Exemplo n.º 11
0
    //Pongsarun 26/2/2016: use for config system
    public List <SpecialFieldData> getSpecialFieldManual(string sql)
    {
        List <SpecialFieldData> SpecialFielData = new List <SpecialFieldData>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        oracleObj.SelectCommand = sql;
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            SpecialFieldData SpecialField_data = new SpecialFieldData();
            SpecialField_data.SpecialField_Code        = rowData["SPEC_FIELD_CODE"].ToString();
            SpecialField_data.SpecialField_Thai        = rowData["SPEC_FIELD_THAINAME"].ToString();
            SpecialField_data.SpecialField_Eng         = rowData["SPEC_FIELD_ENGNAME"].ToString();
            SpecialField_data.SpecialField_ShortName   = rowData["SPEC_FIELD_SHORTNAME"].ToString();
            SpecialField_data.SpecialField_FacultyCode = rowData["FACULTY_CODE"].ToString();
            SpecialField_data.SpecialField_Status      = rowData["SPEC_FIELD_STATUS"].ToString();
            SpecialFielData.Add(SpecialField_data);
        }

        return(SpecialFielData);
    }
Exemplo n.º 12
0
    public List <OfficeData> getOffice()
    {
        List <OfficeData> Office_data = new List <OfficeData>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        oracleObj.SelectCommand = "Select * From OFFICE Order By OFFICE_CODE";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            OfficeData Office = new OfficeData();
            Office.Office_Code       = rowData["OFFICE_CODE"].ToString();
            Office.Office_Thai       = rowData["OFFICE_THAINAME"].ToString();
            Office.Office_Eng        = rowData["OFFICE_ENGNAME"].ToString();
            Office.Office_ShortName  = rowData["OFFICE_SHORTNAME"].ToString();
            Office.Office_CampusCode = rowData["CAMPUS_CODE"].ToString();
            Office.Office_Status     = rowData["OFFICE_STATUS"].ToString();
            Office_data.Add(Office);
        }

        return(Office_data);
    }
Exemplo n.º 13
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง TQF1LEANING
    /// </summary>
    /// <returns>ข้อมูลจากตาราง TQF1LEANING</returns>
    public List <TQF1Leaning> getTQF1Leaning()
    {
        List <TQF1Leaning> TQF1LeaningData = new List <TQF1Leaning>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From TQF1LEANING Order By NUMTQF1";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            TQF1Leaning TQF1LeaningRow = new TQF1Leaning();
            TQF1LeaningRow.NUMTQF1Leaning = rowData["NUMTQF1LEANING"].ToString();
            TQF1LeaningRow.DomainTypeCode = rowData["DOMAINTYPECODE"].ToString();
            TQF1LeaningRow.NUMTQF1        = rowData["NUMTQF1"].ToString();
            TQF1LeaningRow.Detailtype     = rowData["DETAILTYPE"].ToString();
            TQF1LeaningRow.UUIDNumber     = rowData["UUIDNUMBER"].ToString();

            TQF1LeaningData.Add(TQF1LeaningRow);
        }

        return(TQF1LeaningData);
    }
Exemplo n.º 14
0
        protected void dbLoad2() //load資料
        {
            intuId = Convert.ToInt32(Session["Uid"]);
            SqlDataSource sds = new SqlDataSource();

            sds.ConnectionString = @"Data Source=.;Initial Catalog=Guardian_Angel;Integrated Security=True;";
            sds.SelectCommand    = "SELECT * FROM Message INNER JOIN Oldman_Data ON Message.O_Id = Oldman_Data.O_Id where U_id = " + intuId + " ORDER BY M_date DESC";
            GridView1.DataSource = sds.Select(DataSourceSelectArguments.Empty);

            GridView1.Font.Bold = true;
            //GridView
            GridView1.BorderColor        = Color.Blue;
            GridView1.BorderWidth        = 2;
            GridView1.RowStyle.Font.Size = 13;
            GridView1.RowStyle.Font.Name = "微軟正黑體";
            GridView1.Style.Add("word-break", "keep-all");
            //標題列
            GridView1.ForeColor                       = Color.Black;
            GridView1.HeaderStyle.Height              = 40;
            GridView1.HeaderStyle.HorizontalAlign     = HorizontalAlign.Center;
            GridView1.EmptyDataRowStyle.VerticalAlign = VerticalAlign.Middle;

            GridView1.DataBind();
        }
Exemplo n.º 15
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN
    /// </summary>
    /// <param name="CourseCode">รหัสวิชา(Course)</param>
    /// <returns>ข้อมูลจากตาราง TQF2SEC3SEMESTERPLAN</returns>
    public TQF2Sec3SemesterPlan getTQF2Sec3SemesterPlan(string CourseCode)
    {
        TQF2Sec3SemesterPlan TQF2Sec3SemesterPlanData = new TQF2Sec3SemesterPlan();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From TQF2SEC3SEMESTERPLAN Where COURSECODE='" + CourseCode + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            TQF2Sec3SemesterPlanData.CurrCode          = rowData["CURRCODE"].ToString();
            TQF2Sec3SemesterPlanData.YearVersion       = rowData["YEARVERSION"].ToString();
            TQF2Sec3SemesterPlanData.CurrFormatCode    = rowData["CURRFORMATCODE"].ToString();
            TQF2Sec3SemesterPlanData.CurrTypeCode      = rowData["CURRTYPECODE"].ToString();
            TQF2Sec3SemesterPlanData.MajorCode         = rowData["MAJORCODE"].ToString();
            TQF2Sec3SemesterPlanData.CourseCode        = rowData["COURSECODE"].ToString();
            TQF2Sec3SemesterPlanData.EducationYear     = rowData["EDUCATIONYEAR"].ToString();
            TQF2Sec3SemesterPlanData.EducationSemester = rowData["EDUCATIONSEMESTER"].ToString();
        }

        return(TQF2Sec3SemesterPlanData);
    }
Exemplo n.º 16
0
    public ronUtil(int id)
    {
        DaysAvailable = getDaysAvailable(id);

        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();

        SqlDataSource2.SelectCommand = "Select * From AdvisorSchedule Where Advisor_Id='" + id.ToString() + "'";
        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        DayStart = table.Rows[0][2].ToString();
        DayFinish = table.Rows[0][3].ToString();
        StartDate = table.Rows[0][4].ToString();
        FinishDate = table.Rows[0][5].ToString();
        SqlDataSource SqlDataSource3 = new SqlDataSource();
        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource3.SelectCommand = "Select * From Advisor_Master Where Advisor_Id='" + id.ToString() + "'";

        DataView view3 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table3 = view3.ToTable();

        FullName = table3.Rows[0][1].ToString() + " " + table3.Rows[0][2].ToString();
    }
Exemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            login_data = (UserLoginData)Session["login_data"];

            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                divFail.Visible = false;

                if ((Session["save_data"] != null) && (Session["service_course"] != null))
                {
                    ConnectDB     db        = new ConnectDB();
                    SqlDataSource oracleObj = db.ConnectionOracle();

                    available_data = (AvailableCourseData)Session["save_data"];
                    service_code   = (bool)Session["service_course"];

                    CurriculumGeneralData curr = new Curriculum().getCurriculum(available_data.Curr_Code);
                    degree_char = curr.Degree_Char;


                    CourseData course_data = new CourseData();
                    Course     course      = new Course();

                    List <string> all_course = new List <string>();
                    string        TableName  = new AvailableCourse().getTableName(degree_char);

                    string sql = "";

                    if (service_code == true)
                    {
                        lblFaculty.Text = "วิชาบริการศึกษา";
                        lblCurri.Text   = curr.Curr_ThaiName + " (ปีหลักสูตร " + curr.Curr_Year + ")";

                        // ตรวจสอบกำหนดการ

                        int diffDate = -1;


                        config_data1 = new TeachExamConfig().getTeachExamConfig();

                        if (config_data1.Date_Stop != null)
                        {
                            diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                        }

                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And CURR_CODE='" + available_data.Curr_Code + "' And (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "FACULTY_CODE= '" + fac + "'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") GROUP By COURSE_CODE Order By COURSE_CODE";
                        }
                        //วิชาการภาค
                        else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                        {
                            List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                            sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And CURR_CODE='" + available_data.Curr_Code + "' And (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "DEPARTMENT_CODE= '" + dep + "'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") GROUP By COURSE_CODE Order By COURSE_CODE";
                        }

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(rowData["COURSE_CODE"].ToString().Substring(0, 4));
                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                all_course.Add(rowData["COURSE_CODE"].ToString());
                            }
                            else if (diffExtDate >= 0)
                            {
                                all_course.Add(rowData["COURSE_CODE"].ToString());
                            }
                        }
                    }
                    else if (service_code == false)
                    {
                        lblFaculty.Text = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                        lblCurri.Text   = curr.Curr_Code + " " + curr.Curr_ThaiName;

                        sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And FACULTY_CODE='" + available_data.Faculty_Code + "' And DEPARTMENT_CODE='" + available_data.Department_Code + "' And CURR_CODE='" + available_data.Curr_Code + "' GROUP By COURSE_CODE Order By COURSE_CODE";

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        foreach (DataRowView rowData in allData)
                        {
                            all_course.Add(rowData["COURSE_CODE"].ToString());
                        }
                    }



                    RadioButton[] radio = new RadioButton[all_course.Count];
                    int           i     = 0;

                    // Head Table
                    string[] ar  = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เลือก" };
                    Table    tb1 = new Table();
                    tb1.Attributes.Add("class", "table table-bordered table-hover");
                    tb1.Attributes.Add("id", "dt_basic");
                    TableHeaderRow tRowHead = new TableHeaderRow();
                    tRowHead.TableSection = TableRowSection.TableHeader;
                    for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                    {
                        // Create a new cell and add it to the row.
                        TableHeaderCell cellHead = new TableHeaderCell();
                        cellHead.Attributes.Add("class", "text-center");
                        cellHead.Text = ar[cellCtr - 1];
                        tRowHead.Cells.Add(cellHead);
                    }

                    tb1.Rows.Add(tRowHead);

                    foreach (string course_code in all_course)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        course_data = course.getCourse(course_code);

                        if (course_data.Practice != 0 && course_data.Theory != 0)
                        {
                            TableCell cellCourse_Code = new TableCell();
                            cellCourse_Code.Text = course_data.Course_Code;
                            tRowBody.Cells.Add(cellCourse_Code);

                            TableCell cellCourse_Name = new TableCell();
                            cellCourse_Name.Text = course_data.Course_Thainame + "<br/>" + course_data.Course_Engname;
                            tRowBody.Cells.Add(cellCourse_Name);

                            TableCell cellCourse_Credit = new TableCell();
                            cellCourse_Credit.Attributes.Add("class", "text-center");
                            cellCourse_Credit.Text = Convert.ToString(course_data.Credit) + "(" + Convert.ToString(course_data.Theory) + "-" + Convert.ToString(course_data.Practice) + "-" + course_data.Self_Study.ToString() + ")";
                            tRowBody.Cells.Add(cellCourse_Credit);

                            TableCell cellCourse_Radio = new TableCell();
                            cellCourse_Radio.Attributes.Add("class", "text-center");
                            radio[i]              = new RadioButton();
                            radio[i].ID           = course_data.Course_Code;
                            radio[i].AutoPostBack = true;
                            radio[i].GroupName    = "course_group";
                            if (Session["selected_course"] != null)
                            {
                                if (radio[i].ID == (string)Session["selected_course"])
                                {
                                    radio[i].Checked = true;
                                }
                            }
                            radio[i].CheckedChanged += new EventHandler(radioButtons_CheckedChanged);
                            cellCourse_Radio.Controls.Add(radio[i]);
                            tRowBody.Cells.Add(cellCourse_Radio);

                            tb1.Rows.Add(tRowBody);

                            i++;
                        }
                    }

                    if (!Page.IsPostBack)
                    {
                        //A1.Disabled = true;
                    }

                    TableRow  row  = new TableRow();
                    TableCell cell = new TableCell();
                    cell.Controls.Add(tb1);
                    row.Cells.Add(cell);
                    tblCourse.Rows.Add(row);
                }
                else
                {
                    divShow.Visible = false;
                    divFail.Visible = true;
                }
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Exemplo n.º 18
0
    /*
     *  Register_onClick Method:
     *
     *  Takes care of validation.
     *  Ensures uniqueness of Email ID, username and Mobile Number.
     *
     */

    protected void Register_onClick(object Sender, EventArgs e)
    {
        string storagePath = Server.MapPath("~/Images/");

        if (prof.FileName != "")
        {
            prof.SaveAs(storagePath + Path.GetFileName(prof.FileName));
            fpath = "/Images/" + Path.GetFileName(prof.FileName);
        }
        else
        {
            fpath = "/Images/defaultuser.png";
        }



        SqlDataSource sds = new SqlDataSource();

        sds.ConnectionString = connstring();
        sds.SelectParameters.Add("username", TypeCode.String, this.uname.Text);
        sds.SelectParameters.Add("email", TypeCode.String, this.email.Text);
        sds.SelectParameters.Add("mobile", TypeCode.String, this.mobile.Text);

        sds.SelectCommand = "SELECT * FROM [Users] WHERE [username] = @username";
        DataView dv1 = (DataView)sds.Select(DataSourceSelectArguments.Empty);

        sds.SelectCommand = "SELECT * FROM [Users] WHERE [email] = @email";
        DataView dv2 = (DataView)sds.Select(DataSourceSelectArguments.Empty);

        sds.SelectCommand = "SELECT * FROM [Users] WHERE [mobile] = @mobile";
        DataView dv3 = (DataView)sds.Select(DataSourceSelectArguments.Empty);

        if (dv1 != null && dv1.Count != 0)
        {
            lblmsg.ForeColor = System.Drawing.Color.Red;
            lblmsg.Text      = "Username already exists";
            return;
        }
        else if ((dv2 != null && dv2.Count != 0))
        {
            lblmsg.ForeColor = System.Drawing.Color.Red;
            lblmsg.Text      = "Email ID already in use";
            return;
        }
        else if ((dv3 != null && dv3.Count != 0))
        {
            lblmsg.ForeColor = System.Drawing.Color.Red;
            lblmsg.Text      = "Mobile Number already in use";
            return;
        }
        else
        {
            Random rnd = new Random();
            vcode = rnd.Next(100000, 999999);
            sendemail(email.Text, vcode);
            a1  = uname.Text;
            a2  = name.Text;
            a3  = gender.Text;
            a4  = Add1.Text;
            a5  = TextBox1.Text;
            a6  = city.SelectedItem.Value;
            a7  = TextBox2.SelectedItem.Value;
            a8  = pin.Text;
            a9  = mobile.Text;
            a10 = telephone.Text;
            a11 = email.Text;
            a12 = dob.Text;
            a13 = security.SelectedItem.Value;
            MultiView1.SetActiveView(view2);
        }
    }
Exemplo n.º 19
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.º 20
0
    //For Calendar ------------------------------------
    public string[] getDaysAvailable(int id)
    {
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();

        SqlDataSource2.SelectCommand = "Select Distinct(DayAvailable) From Availability Where Employee_Id='" + id + "'";
        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        string[] days = new string[table.Rows.Count];
        for (int ii = 0; ii < table.Rows.Count; ii++)
        { days[ii] = table.Rows[ii][0].ToString().Trim();

        }
        return days;
    }
Exemplo n.º 21
0
        private GridDefault BuildGridFromSqlDataSource(SqlDataSource sds)
        {
            var result = new GridDefault();

            OnRowHeadBinding(new RowHeadBindingEventArgs(result));

            DataView dataView = null;

            if (!PagingDisabled)
            {
                if (GridDataSource.SqlDataSourceSelectCommandType == SqlDataSourceCommandType.StoredProcedure)
                {
                    var nvc = new NameValueCollection(Request.QueryString);

                    nvc.Remove("page");

                    var dataKey = Request.Url.AbsolutePath;

                    if (nvc.Count > 0)
                    {
                        dataKey += "?" + nvc.NameValueToQueryString(false);
                    }

                    dataView = Cache[dataKey] as DataView;

                    if (dataView == null)
                    {
                        dataView = sds.Select(DataSourceSelectArguments.Empty) as DataView;

                        if (dataView == null)
                        {
                            dataView = new DataView(new DataTable());
                        }

                        var expires = DateTime.Now;

                        expires = expires.Add(new TimeSpan(0, 1, 0));
                        Cache.Add(dataKey, dataView, null, expires, System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
                    }

                    var rowsCount = dataView.Table.AsEnumerable().Skip(GridDataSource.SqlDataSourceStartRowIndex).Take(GridDataSource.SqlDataSourceMaximumRows).Count();

                    for (var i = 0; i < rowsCount; i++)
                    {
                        OnRowDataBinding(new RowDataBindingEventArgs(i, dataView.Table.Rows[GridDataSource.SqlDataSourceStartRowIndex + i], result));
                    }

                    result.Body.TotalRecords = dataView.Table.Rows.Count;
                }
            }

            if (dataView == null)
            {
                dataView = sds.Select(DataSourceSelectArguments.Empty) as DataView;

                for (var i = 0; i < dataView.Table.Rows.Count; i++)
                {
                    OnRowDataBinding(new RowDataBindingEventArgs(i, dataView.Table.Rows[i], result));
                }

                result.Body.TotalRecords = dataView.Table.Rows.Count > 0 && dataView.Table.Columns.Contains("TotalRecords") ? (Int32)dataView.Table.Rows[0]["TotalRecords"] : 0;

                if (result.Body.TotalRecords == 0 && PagingDisabled)
                {
                    result.Body.TotalRecords = dataView.Table.Rows.Count;
                }
            }

            return(result);
        }
Exemplo n.º 22
0
    /// ==========================================================================
    /// <summary>
    /// Show grid even if datasource is empty
    /// <param name="grdView">GridView</param>
    /// ==========================================================================
    protected void EmptyGridFix(GridView grdView)
    {
        // normally executes after a grid load method
        if (grdView.Rows.Count == 0 &&
            grdView.DataSource != null)
        {
            DataTable dt = null;

            // need to clone sources otherwise it will be indirectly adding to
            // the original source

            if (grdView.DataSource is DataSet)
            {
                dt = ((DataSet)grdView.DataSource).Tables[0].Clone();
            }
            else if (grdView.DataSource is DataTable)
            {
                dt = ((DataTable)grdView.DataSource).Clone();
            }

            else if (grdView.DataSource is SqlDataSource)
            {
                SqlDataSource sds = new SqlDataSource();
                DataView      dv  = new DataView();
                sds = (SqlDataSource)grdView.DataSource;
                dv  = (DataView)sds.Select(DataSourceSelectArguments.Empty);
                dt  = dv.ToTable().Clone();

                /*
                 * DataView dv = new DataView();
                 * DataTable dt = new DataTable();
                 * dv = mySQLDataSource.Select(DataSourceSelectArguments.Empty);
                 * dt = dv.ToTable();
                 * */
            }
            if (dt == null)
            {
                return;
            }

            dt.Rows.Add(dt.NewRow()); // add empty row
            grdView.DataSource = dt;
            grdView.DataBind();

            // hide row
            grdView.Rows[0].Visible = false;
            grdView.Rows[0].Controls.Clear();
        }

        // normally executes at all postbacks
        if (grdView.Rows.Count == 1 &&
            grdView.DataSource == null)
        {
            bool bIsGridEmpty = true;

            // check first row that all cells empty
            for (int i = 0; i < grdView.Rows[0].Cells.Count; i++)
            {
                if (grdView.Rows[0].Cells[i].Text != string.Empty)
                {
                    bIsGridEmpty = false;
                }
            }
            // hide row
            if (bIsGridEmpty)
            {
                grdView.Rows[0].Visible = false;
                grdView.Rows[0].Controls.Clear();
            }
        }
    }
Exemplo n.º 23
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.º 24
0
    protected void Page_Load(object sender, EventArgs e)

    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            login_data = (UserLoginData)Session["login_data"];

            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                divFail.Visible = false;

                if ((Session["save_data"] != null) && (Session["service_course"] != null))
                {
                    ConnectDB     db        = new ConnectDB();
                    SqlDataSource oracleObj = db.ConnectionOracle_tqf2();


                    available_data = (AvailableCourseData)Session["save_data"];
                    service_code   = (bool)Session["service_course"];



                    if (service_code == true)
                    {
                        // ตรวจสอบกำหนดการ

                        int diffDate = -1;


                        config_data1 = new TeachExamConfig().getTeachExamConfig();

                        if (config_data1.Date_Stop != null)
                        {
                            diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                        }



                        string sql = "";
                        curr_year       = available_data.Curr_Code.Substring(0, 4);
                        curr_code       = available_data.Curr_Code.Substring(4);
                        lblFaculty.Text = "วิชาบริการศึกษา";
                        //available_data.Faculty_Code = "xx";
                        //available_data.Department_Code = "xxxx";
                        available_data.Major_Code = "xxxxxx";
                        lblCurri.Text             = new Curriculum().getCurriculum(available_data.Curr_Code).Curr_ThaiName + " (" + curr_year + ")";


                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + fac + "%'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                            // lblCurri.Text = sql;
                        }

                        //วิชาการภาค
                        else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                        {
                            List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + dep + "%'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(rowData["COURSECODE"].ToString().Substring(0, 4));
                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                if (course.checkStatus(rowData["COURSECODE"].ToString()))
                                {
                                    all_course.Add(rowData["COURSECODE"].ToString());
                                }
                            }
                            else if (diffExtDate >= 0)
                            {
                                if (course.checkStatus(rowData["COURSECODE"].ToString()))
                                {
                                    all_course.Add(rowData["COURSECODE"].ToString());
                                }
                            }
                        }
                    }
                    else if (service_code == false)
                    {
                        curr_year = available_data.Curr_Code.Substring(0, 4);
                        curr_code = available_data.Curr_Code.Substring(4);

                        lblFaculty.Text = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                        lblCurri.Text   = curr_code + " " + new Curriculum().getCurriculum(available_data.Curr_Code).Curr_ThaiName + " (" + curr_year + ")";

                        string sql = "";

                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + fac + "%'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        //วิชาการภาค
                        else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                        {
                            List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + dep + "%'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        oracleObj.SelectCommand = sql;

                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            if (course.checkStatus(rowData["COURSECODE"].ToString()))
                            {
                                all_course.Add(rowData["COURSECODE"].ToString());
                            }
                        }
                    }


                    RadioButton[] radio = new RadioButton[all_course.Count];
                    int           i     = 0;

                    // Head Table
                    string[] ar  = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เลือก" };
                    Table    tb1 = new Table();
                    tb1.Attributes.Add("class", "table table-bordered table-hover");
                    tb1.Attributes.Add("id", "dt_basic");
                    TableHeaderRow tRowHead = new TableHeaderRow();
                    tRowHead.TableSection = TableRowSection.TableHeader;
                    for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                    {
                        // Create a new cell and add it to the row.
                        TableHeaderCell cellHead = new TableHeaderCell();
                        cellHead.Attributes.Add("class", "text-center");
                        cellHead.Text = ar[cellCtr - 1];
                        tRowHead.Cells.Add(cellHead);
                    }

                    tb1.Rows.Add(tRowHead);

                    foreach (string course_code in all_course)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        course_data = course.getCourse(course_code);


                        TableCell cellCourse_Code = new TableCell();
                        cellCourse_Code.Text = course_data.Course_Code;
                        tRowBody.Cells.Add(cellCourse_Code);

                        TableCell cellCourse_Name = new TableCell();
                        cellCourse_Name.Text = course_data.Course_Thainame + "<br/>" + course_data.Course_Engname;
                        tRowBody.Cells.Add(cellCourse_Name);

                        TableCell cellCourse_Credit = new TableCell();
                        cellCourse_Credit.Text = Convert.ToString(course_data.Credit) + "(" + Convert.ToString(course_data.Theory) + "-" + Convert.ToString(course_data.Practice) + "-" + course_data.Self_Study.ToString() + ")";
                        cellCourse_Credit.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellCourse_Credit);

                        TableCell cellCourse_Radio = new TableCell();

                        radio[i]    = new RadioButton();
                        radio[i].ID = course_data.Course_Code;
                        cellCourse_Radio.Attributes.Add("class", "text-center");
                        radio[i].AutoPostBack    = true;
                        radio[i].GroupName       = "course_group";
                        radio[i].CheckedChanged += new EventHandler(radioButtons_CheckedChanged);
                        cellCourse_Radio.Controls.Add(radio[i]);


                        tRowBody.Cells.Add(cellCourse_Radio);

                        tb1.Rows.Add(tRowBody);

                        i++;
                    }

                    TableRow  row  = new TableRow();
                    TableCell cell = new TableCell();
                    cell.Controls.Add(tb1);
                    row.Cells.Add(cell);
                    tblCourse.Rows.Add(row);

                    //Disable Next button when page load
                    btnNext.Disabled = true;
                }
                else
                {
                    divShow.Visible = false;
                    divFail.Visible = true;
                }
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Exemplo n.º 25
0
        void exportFile(string what)
        {
            ExcelPackage pck         = new ExcelPackage();
            string       shStartDate = webStartDate.SelectedValue;
            string       exStartDate = webStartDate.SelectedItem.Text.Replace("/", "-");
            string       filename    = string.Empty;
            string       MainSheet   = string.Empty;


            MainSheet = "Summary";



            filename = "RS Week Ending " + exStartDate + " - " + what;

            using (pck)
            {
                if (ReportType == "payout")
                {
                    string selectedOwner = string.Empty;

                    if (userType == "Owner")
                    {
                        selectedOwner = userFullname;
                    }
                    else
                    {
                        selectedOwner = webOwner.SelectedValue;
                    }

                    ExcelWorksheet wss  = pck.Workbook.Worksheets.Add(MainSheet);
                    SqlDataSource  SQLs = new SqlDataSource();
                    SQLs.ID = "SqlDataSource-SummarydashDivPre";
                    SQLs.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
                    SQLs.SelectParameters.Add("webStartDate", shStartDate);
                    SQLs.SelectParameters.Add("webDuration", "14");
                    SQLs.SelectParameters.Add("webProgram", webProgram.SelectedValue);
                    SQLs.SelectParameters.Add("webStoreName", webStoreName.SelectedValue);
                    SQLs.SelectParameters.Add("webStoreNumber", "All");
                    SQLs.SelectParameters.Add("webOwner", selectedOwner);
                    SQLs.SelectParameters.Add("UserType", userType);
                    SQLs.SelectParameters.Add("userFullname", userFullname);
                    SQLs.SelectParameters.Add("webLocation", webLocation.SelectedValue);
                    SQLs.SelectParameters.Add("webTrainer", webTrainer.SelectedValue);
                    if (webProgram.SelectedValue == "Chipio - Chip Repair")
                    {
                        SQLs.SelectParameters.Add("cols", "Chipio");
                    }
                    else
                    {
                        SQLs.SelectParameters.Add("cols", "All");
                    }
                    SQLs.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                    SQLs.Selecting       += SQLSelecting;

                    SQLs.SelectCommand = "spx_PAYOUTTrainerReports";


                    DataSourceSelectArguments argss = new DataSourceSelectArguments();
                    DataView  DVs = (DataView)SQLs.Select(argss);
                    DataTable DTs = DVs.ToTable();
                    wss.Cells["A1"].LoadFromDataTable(DTs, true);
                    wss.Cells["A1:Z2000"].AutoFitColumns();
                    //wss.Column("A").Hidden = true;
                }


                if (what == "All")
                {
                    foreach (string[] i in storeList)
                    {
                        //storeList = tbStoreNumber, tbStoreName, tbLocation, tbOwner, tbHub, tbProgram
                        string SheetName     = "#" + i[0] + " " + i[1] + " " + i[5];
                        string shStoreNumber = i[0];
                        string shStoreName   = i[1];
                        string shLocation    = i[2];
                        string shOwner       = i[3];
                        string shHub         = i[4];
                        string shProgram     = i[5];

                        ExcelWorksheet ws;
                        try
                        {
                            ws = pck.Workbook.Worksheets.Add(SheetName);
                        }
                        catch
                        {
                            string n = new Random().Next(1, 9).ToString();
                            ws = pck.Workbook.Worksheets.Add(SheetName + " " + n);
                        }

                        SqlDataSource SQL1 = new SqlDataSource();
                        SQL1.ID = "SqlDataSource1";
                        SQL1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
                        SQL1.SelectParameters.Add("webStartDate", shStartDate);
                        SQL1.SelectParameters.Add("webDuration", "14");
                        SQL1.SelectParameters.Add("webProgram", shProgram);
                        SQL1.SelectParameters.Add("webStoreNumber", shStoreNumber);
                        SQL1.SelectParameters.Add("webStoreName", shStoreName);
                        SQL1.SelectParameters.Add("webLocation", shLocation);
                        SQL1.SelectParameters.Add("webOwner", shOwner);
                        SQL1.SelectParameters.Add("UserType", userType);
                        SQL1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                        SQL1.Selecting       += SQLSelecting;
                        SQL1.SelectCommand    = "spx_PAYOUTQty";

                        SqlDataSource SQL2 = new SqlDataSource();
                        SQL2.ID = "SqlDataSource2";
                        SQL2.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
                        SQL2.SelectParameters.Add("webStartDate", shStartDate);
                        SQL2.SelectParameters.Add("webDuration", "14");
                        SQL2.SelectParameters.Add("webProgram", shProgram);
                        SQL2.SelectParameters.Add("webStoreNumber", shStoreNumber);
                        SQL2.SelectParameters.Add("webStoreName", shStoreName);
                        SQL2.SelectParameters.Add("webLocation", shLocation);
                        SQL2.SelectParameters.Add("webOwner", shOwner);
                        SQL2.SelectParameters.Add("UserType", userType);
                        if (shProgram == "Chipio - Chip Repair")
                        {
                            SQL2.SelectParameters.Add("gross", "Chipio - Chip Repair");
                        }
                        else
                        {
                            SQL2.SelectParameters.Add("gross", "All");
                        }
                        SQL2.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                        SQL2.Selecting       += SQLSelecting;
                        SQL2.SelectCommand    = "spx_PAYOUTRev";

                        DataSourceSelectArguments args1 = new DataSourceSelectArguments();
                        DataView  DV1 = (DataView)SQL1.Select(args1);
                        DataTable DT1 = DV1.ToTable();
                        DataSourceSelectArguments args2 = new DataSourceSelectArguments();
                        DataView  DV2 = (DataView)SQL2.Select(args2);
                        DataTable DT2 = DV2.ToTable();

                        int j1 = DV1.Table.Rows.Count + 12;
                        int j2 = j1 + 1;

                        ws.Cells["A1"].Value           = "Store:";
                        ws.Cells["A1"].Style.Font.Bold = true;
                        ws.Cells["B1"].Value           = shStoreName;

                        ws.Cells["A2"].Value           = "Program:";
                        ws.Cells["A2"].Style.Font.Bold = true;
                        ws.Cells["B2"].Value           = shProgram;

                        ws.Cells["A3"].Value           = "Owner:";
                        ws.Cells["A3"].Style.Font.Bold = true;
                        ws.Cells["B3"].Value           = shOwner;

                        ws.Cells["A4"].Value           = "Hub:";
                        ws.Cells["A4"].Style.Font.Bold = true;
                        ws.Cells["B4"].Value           = shHub;

                        ws.Cells["A5"].Value           = "Whse #:";
                        ws.Cells["A5"].Style.Font.Bold = true;
                        ws.Cells["B5"].Value           = shStoreNumber;

                        ws.Cells["A6"].Value           = "Location:";
                        ws.Cells["A6"].Style.Font.Bold = true;
                        ws.Cells["B6"].Value           = shLocation;

                        ws.Cells["A9"].Value           = "Quantity";
                        ws.Cells["A9"].Style.Font.Bold = true;

                        ws.Cells["A10"].LoadFromDataTable(DT1, true);

                        ws.Cells["A" + j1.ToString()].Value           = "Revenue";
                        ws.Cells["A" + j1.ToString()].Style.Font.Bold = true;

                        ws.Cells["A" + j2.ToString()].LoadFromDataTable(DT2, true);

                        ws.Cells["A1:Z2000"].AutoFitColumns();

                        Page.Controls.Remove(SQL1);
                        Page.Controls.Remove(SQL2);
                    }
                }

                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.AddHeader("content-disposition", "attachment;  filename=" + filename + ".xlsx");
                Response.BinaryWrite(pck.GetAsByteArray());
                Response.Flush();
                Response.End();
            }
        }
Exemplo n.º 26
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง SYSUSER
    /// </summary>
    /// <param name="sql">SQL Command</param>
    /// <returns>ข้อมูลจากตาราง SYSUSER</returns>
    public List <SysUser> getSysUserManual(string sql)
    {
        List <SysUser> data = new List <SysUser>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = sql;

        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            SysUser row = new SysUser();

            row.IdCode               = rowData["IDCODE"].ToString();
            row.FacultyCode          = rowData["FACULTYCODE"].ToString();
            row.TitleNameCode        = rowData["TITLENAMECODE"].ToString();
            row.DepartmentCode       = rowData["DEPARTMENTCODE"].ToString();
            row.UserTypeCode         = rowData["USERTYPECODE"].ToString();
            row.ThName               = rowData["THNAME"].ToString();
            row.EnName               = rowData["ENNAME"].ToString();
            row.ThSurName            = rowData["THSURNAME"].ToString();
            row.EnSurName            = rowData["ENSURNAME"].ToString();
            row.UserName             = rowData["USERNAME"].ToString();
            row.Password             = rowData["PASSWORD"].ToString();
            row.Position             = rowData["POSITION"].ToString();
            row.Address              = rowData["ADDRESS"].ToString();
            row.Tel                  = rowData["TEL"].ToString();
            row.Email                = rowData["EMAIL"].ToString();
            row.OpenStatus           = rowData["OPENSTATUS"].ToString();
            row.PassportCode         = rowData["PASSSPORTCODE"].ToString();
            row.Sex                  = rowData["SEX"].ToString();
            row.AcademicPositionCode = rowData["ACADEMICPOSITIONCODE"].ToString();
            row.DivisionCode         = rowData["DIVISIONCODE"].ToString();
            row.BirthDay             = rowData["BIRTHDAY"].ToString();
            row.BirthProvince        = rowData["BIRTHPROVINCE"].ToString();
            row.BirthPlace           = rowData["BIRTHPLACE"].ToString();
            row.Country              = rowData["COUNTRY"].ToString();
            row.Nationality          = rowData["NATIONALITY"].ToString();
            row.Ethnicity            = rowData["ETHNICITY"].ToString();
            row.Height               = float.Parse(rowData["HEIGHT"].ToString());
            row.Weight               = float.Parse(rowData["WEIGHT"].ToString());
            row.Marital              = rowData["MARITAL"].ToString();
            row.Occupation           = rowData["OCCUPATION"].ToString();
            row.MobileNumber         = rowData["MOBILENUMBER"].ToString();
            row.Talent               = rowData["TALENT"].ToString();
            row.HomeNumber           = rowData["HOMENUMBER"].ToString();
            row.HomeBuilding         = rowData["HOMEBUILDING"].ToString();
            row.HomeVillage          = rowData["HOMEVILLAGE"].ToString();
            row.HomeMoo              = rowData["HOMEMOO"].ToString();
            row.HomeSoi              = rowData["HOMESOI"].ToString();
            row.HomeRoad             = rowData["HOMEROAD"].ToString();
            row.HomeTumbol           = rowData["HOMETUMBOL"].ToString();
            row.HomeAmphur           = rowData["HOMEAMPHUR"].ToString();
            row.HomeProvince         = rowData["HOMEPROVINCE"].ToString();
            row.HomePostCode         = rowData["HOMEPOSTCODE"].ToString();
            row.OfficeName           = rowData["OFFICENAME"].ToString();
            row.OfficeNumber         = rowData["OFFICENUMBER"].ToString();
            row.OfficeBuilding       = rowData["OFFICEBUILDING"].ToString();
            row.OfficeVillage        = rowData["OFFICEVILLAGE"].ToString();
            row.OfficeMoo            = rowData["OFFICEMOO"].ToString();
            row.OfficeSoi            = rowData["OFFICESOI"].ToString();
            row.OfficeRoad           = rowData["OFFICEROAD"].ToString();
            row.OfficeTumbol         = rowData["OFFICETUMBOL"].ToString();
            row.OfficeAmphur         = rowData["OFFICEAMPHUR"].ToString();
            row.OfficeProvince       = rowData["OFFICEPROVINCE"].ToString();
            row.OfficePostCode       = rowData["OFFICEPOSTCODE"].ToString();
            row.Affiliation          = rowData["AFFILIATION"].ToString();
            row.GradLecturer         = rowData["GRAD_LECTURER"].ToString();
            row.ShortName            = rowData["SHORT_NAME"].ToString();
            data.Add(row);
        }

        return(data);
    }
Exemplo n.º 27
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        Clear();
        string        connectionStr = ConfigurationManager.ConnectionStrings["UcccPubMedDB"].ConnectionString;
        SqlConnection myConnection  = new SqlConnection(connectionStr);
        string        sqlStatement  = "";
        string        sqlStatement2 = "";
        string        sqlStatement3 = "";

        if (txtPmid.Text != "" || txtPmcid.Text != "")
        {
            if (txtPmid.Text != "")
            {
                sqlStatement =
                    "select p.*,pp.authorlist, lyn.description as final_confirm, pp.review_editorial" +
                    " from publication p" +
                    " inner join publication_processing pp on p.publication_id = pp.publication_id" +
                    " left outer join l_yes_no lyn" +
                    " on pp.final_confirm_id = lyn.l_yes_no_id" +
                    " where p.pmid = " + txtPmid.Text;

                sqlStatement2 =
                    "select pp.publication_program_id," +
                    " lp.abbreviation as program," +
                    " case when lfg.group_number >= 0 then" +
                    " 'FG ' + convert(varchar,lfg.group_number) + '-' + lfg.description" +
                    " else lfg.description end" +
                    " as focus_group" +
                    " from publication_program pp" +
                    " inner join publication p" +
                    " on pp.publication_id = p.publication_id" +
                    " inner join l_program lp" +
                    " on pp.l_program_id = lp.l_program_id" +
                    " left outer join l_focus_group lfg" +
                    " on pp.l_focus_group_id = lfg.l_focus_group_id" +
                    " where p.pmid = " +
                    txtPmid.Text;

                sqlStatement3 =
                    "select" +
                    " lr.description as resource" +
                    " from publication_resource pr" +
                    " inner join publication p" +
                    " on pr.publication_id = p.publication_id" +
                    " inner join l_resource lr" +
                    " on pr.l_resource_id = lr.l_resource_id" +
                    " where p.pmid = " +
                    txtPmid.Text;
            }
            else if (txtPmcid.Text != "")
            {
                sqlStatement =
                    "select p.*,pp.authorlist, lyn.description as final_confirm, pp.review_editorial" +
                    " from publication p" +
                    " inner join publication_processing pp on p.publication_id = pp.publication_id" +
                    " left outer join l_yes_no lyn" +
                    " on pp.final_confirm_id = lyn.l_yes_no_id" +
                    " where p.pmcid = '" + txtPmcid.Text + "'";

                sqlStatement2 =
                    "select pp.publication_program_id," +
                    " lp.abbreviation as program," +
                    " case when lfg.group_number >= 0 then" +
                    " 'FG ' + convert(varchar,lfg.group_number) + '-' + lfg.description" +
                    " else lfg.description end" +
                    " as focus_group" +
                    " from publication_program pp" +
                    " inner join publication p" +
                    " on pp.publication_id = p.publication_id" +
                    " inner join l_program lp" +
                    " on pp.l_program_id = lp.l_program_id" +
                    " left outer join l_focus_group lfg" +
                    " on pp.l_focus_group_id = lfg.l_focus_group_id" +
                    " where p.pmcid = '" +
                    txtPmcid.Text + "'";

                sqlStatement3 =
                    "select" +
                    " lr.description as resource" +
                    " from publication_resource pr" +
                    " inner join publication p" +
                    " on pr.publication_id = p.publication_id" +
                    " inner join l_resource lr" +
                    " on pr.l_resource_id = lr.l_resource_id" +
                    " where p.pmcid = '" +
                    txtPmcid.Text + "'";
            }
            SqlDataSource ds = new SqlDataSource(connectionStr, sqlStatement);
            dvPublication.DataSource = ds;

            DataSourceSelectArguments dssa = new DataSourceSelectArguments();
            dssa.AddSupportedCapabilities(DataSourceCapabilities.RetrieveTotalRowCount);
            dssa.RetrieveTotalRowCount = true;
            DataView dv = (DataView)ds.Select(dssa);
            if (dv.Table.Rows.Count > 0)
            {
                dvPublication.DataBind();
                btnEdit.Visible = true;
            }
            else
            {
                ErrorMessage.Text = "No pub in database. You can import it.";
                btnImport.Visible = true;
            }

            SqlDataSource ds2 = new SqlDataSource(connectionStr, sqlStatement2);
            gvProgram.DataSource = ds2;
            gvProgram.DataBind();

            SqlDataSource ds3 = new SqlDataSource(connectionStr, sqlStatement3);
            gvResource.DataSource = ds3;
            gvResource.DataBind();
        }
        else if (txtTitle.Text != "")
        {
            sqlStatement =
                "select p.publication_id," +
                " p.pmid," +
                " p.article_title" +
                " from publication p" +
                " where p.article_title like '%" +
                txtTitle.Text +
                "%'";

            Helper.BindGridview(sqlStatement, gvPublication);
        }
        else if (txtLastName.Text != "")
        {
            sqlStatement =
                "select p.publication_id," +
                " p.pmid," +
                " p.article_title" +
                " from publication p" +
                " inner join publication_processing pp" +
                " on p.publication_id = pp.publication_id" +
                " where pp.authorlist like '%" +
                txtLastName.Text +
                "%'";

            Helper.BindGridview(sqlStatement, gvPublication);
        }
    }
Exemplo n.º 28
0
    public string[] getDaysAvailable(int id)
    {
        string[] DaysAvailable2 = new string[5];
        DaysAvailable2[0] = "Monday";
        DaysAvailable2[1] = "Tuesday";
        DaysAvailable2[2] = "Wednesday";
        DaysAvailable2[3] = "Thursday";
        DaysAvailable2[4] = "Friday";

        DateTime now = DateTime.Today.AddDays(1);
        DateTime last = now.AddDays(7);
        DateTime[] allDays = new DateTime[7];

        string[] bookingDates = new string[5];
        int[] weekNumber = new int[5];

        int counter3 = 0;
        for (int i = 0; i < allDays.Length; i++)
        {
            allDays[i] = now.AddDays(i);
        }

        string[] date = new string[5];
        for (int i = 0; i < allDays.Length; i++)
        {
            for (int ii = 0; ii < DaysAvailable2.Length; ii++)
            {
                if (allDays[i].DayOfWeek.ToString() == DaysAvailable2[ii])
                {

                    try
                    {
                        date[counter3] = allDays[i].ToShortDateString();
                        bookingDates[counter3] = DaysAvailable2[ii];
                        weekNumber[counter3] = GetWeekNumber(allDays[i]); counter3++; ;
                    }
                    catch { }
                }
            }
        }

        string[] query = new string[5];

        for (int i = 0; i < 5; i++)
        {
            query[i] = "(Week='" + weekNumber[i] + "' AND Day='" + bookingDates[i] + "')";
        }

        SqlDataSource SqlDataSource3 = new SqlDataSource();

        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["AdvisorBookingConnectionString"].ToString();
           //  SqlDataSource3.SelectCommand = "Select Distinct(Day) From AdvisorSchedules";
        SqlDataSource3.SelectCommand = "Select Distinct(Day) From AdvisorSchedules Where Advisor_ID='" + id+ "' AND ( " + query[0] + ") OR " + query[1] + " OR " + query[2] + " OR " + query[3] + " OR " + query[4];

        DataView view = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        string[] days = new string[table.Rows.Count];
        for (int ii = 0; ii < table.Rows.Count; ii++)
        { days[ii] = table.Rows[ii][0].ToString().Trim(); }
        return days;
    }
Exemplo n.º 29
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        // Data source control that works with Sql databases

        SqlDataSource sds = new SqlDataSource();



        // Get connection string from application's default configuration

        sds.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();



        // Create parameters with specified names and values

        sds.SelectParameters.Add("Username", TypeCode.String, this.TextBox1.Text);

        sds.SelectParameters.Add("Password", TypeCode.String, this.TextBox2.Text);



        // Set the SQL string to retrieve data from the underlying database

        sds.SelectCommand = "SELECT * FROM [UserTable] WHERE [Username] = @Username AND [Password] = @Password";



        // Retrieve data

        DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);



        // Display error message and return if the number of record is zero

        if (dv.Count == 0)
        {
            this.Label1.ForeColor = System.Drawing.Color.Red;

            this.Label1.Text = "Login Failed!";

            return;
        }



        // Create session variables

        this.Session["Username"] = dv[0].Row["UserType"].ToString();

        this.Session["UserType"] = dv[0].Row["UserType"].ToString();



        // Redirect to respective page based on user type

        if (this.Session["UserType"].ToString().Equals("user"))
        {
            Response.Redirect("MainPageUsers.aspx");
        }

        else if (this.Session["UserType"].ToString().Equals("admin"))
        {
            Response.Redirect("MainPageAdmin.aspx");
        }
    }
Exemplo n.º 30
0
    public string getWednesday(int advisor_Id)
    {
        string Wednesday = "-";
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource2.SelectCommand = "Select (CONVERT(varchar, Time_Start, 100)+ '-'+CONVERT(varchar, Time_End, 100)) As Time From Availability Where DayAvailable='Wednesday' AND Employee_ID='" + advisor_Id + "'";
        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        if (table.Rows.Count > 0)
        {Wednesday = table.Rows[0][0].ToString();}
        return Wednesday;
    }
Exemplo n.º 31
0
    //----------------------------------------Basics-----------------------------
    public string[] getDaysAvailable(int id)
    {
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();

        SqlDataSource2.SelectCommand = "Select DaysAvailable From AdvisorSchedule Where Advisor_Id='" + id + "'";
        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

            string days = table.Rows[0][0].ToString();
            string[] splitDays = days.Split(',');
            return splitDays;

        return splitDays;
    }
Exemplo n.º 32
0
    // V 1.0.0
    public List <CurriculumGeneralData> getCurriculum_Degree(string degree_char)
    {
        List <CurriculumGeneralData> Curriculum_data = new List <CurriculumGeneralData>();
        string        degree_level = "";
        ConnectDB     db           = new ConnectDB();
        SqlDataSource oracleObj    = db.ConnectionOracle_tqf2();

        if (degree_char == "U")
        {
            degree_level = "01";
        }
        else if (degree_char == "B")
        {
            degree_level = "02";
        }
        else if (degree_char == "M")
        {
            degree_level = "03";
        }
        else if (degree_char == "D")
        {
            degree_level = "04";
        }
        else if (degree_char == "P")
        {
            degree_level = "05";
        }

        oracleObj.SelectCommand = "Select * From CURRICULUM Where LEVELCODE = '" + degree_level + "' AND CURRCODE !='999999999' AND APPROVESTATUS='Y' Order By CURRCODE";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            CurriculumGeneralData Curriculum = new CurriculumGeneralData();
            Curriculum.Curr_Code       = rowData["CURRCODE"].ToString();
            Curriculum.Curr_Year       = rowData["YEARVERSION"].ToString();
            Curriculum.Faculty_Code    = rowData["FACULTYCODE"].ToString();
            Curriculum.Department_Code = rowData["DEPARTMENTCODE"].ToString();
            //Curriculum.Major_Code = rowData["DIVISIONCODE"].ToString();
            Curriculum.Curr_ThaiName = rowData["CURRTHNAME"].ToString();
            Curriculum.Curr_EngName  = rowData["CURRENNAME"].ToString();
            Curriculum.Degree_Level  = rowData["LEVELCODE"].ToString();

            if (Curriculum.Degree_Level == "01")
            {
                Curriculum.Degree_Char = "U";
            }
            else if (Curriculum.Degree_Level == "02")
            {
                Curriculum.Degree_Char = "B";
            }
            else if (Curriculum.Degree_Level == "03")
            {
                Curriculum.Degree_Char = "M";
            }
            else if (Curriculum.Degree_Level == "04")
            {
                Curriculum.Degree_Char = "D";
            }
            else if (Curriculum.Degree_Level == "05")
            {
                Curriculum.Degree_Char = "P";
            }

            Curriculum_data.Add(Curriculum);
        }

        return(Curriculum_data);
    }
Exemplo n.º 33
0
    public DateTime[] getTaken(int advisor_Id, string date)
    {
        SqlDataSource SqlDataSource3 = new SqlDataSource();
        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource3.SelectCommand = "Select Time From Scheduling  Where Advisor_Id='" + advisor_Id + "' AND Date='" + date + "'";

        DataView view = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        //   string[] slotsTaken = new string[table.Rows.Count];

        DateTime[] slotsTaken = new DateTime[table.Rows.Count];

            for (int ii = 0; ii < table.Rows.Count; ii++)
            { slotsTaken[ii] = DateTime.Parse(table.Rows[ii][0].ToString()); }

        //  Label1.Text = slotsTaken[0].ToShortTimeString();
        return slotsTaken;
    }
Exemplo n.º 34
0
    public int[] getAdvisorIDs()
    {
        SqlDataSource SqlDataSource3 = new SqlDataSource();
        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["AdvisorBookingConnectionString"].ToString();
        SqlDataSource3.SelectCommand = "Select Distinct(Advisor_ID) From AdvisorSchedules";

        DataView view = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        //   string[] slotsTaken = new string[table.Rows.Count];

        int[] Employee_ID = new int[table.Rows.Count];

        for (int ii = 0; ii < table.Rows.Count; ii++)
        { Employee_ID[ii] = Convert.ToInt32(table.Rows[ii][0].ToString()); }
        return Employee_ID;
    }
    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.º 36
0
    public string getAdvisorImage(int advisor_Id)
    {
        SqlDataSource SqlDataSource3 = new SqlDataSource();
        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["AdvisorBookingConnectionString"].ToString();
        SqlDataSource3.SelectCommand = "Select Image From Advisor Where Employee_ID='" + advisor_Id + "'";

        DataView view = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        //   string[] slotsTaken = new string[table.Rows.Count];

        string Employee_Image = "";
        if (table.Rows.Count > 0)
            Employee_Image = table.Rows[0][0].ToString();
        return Employee_Image;
    }
Exemplo n.º 37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Finder IDet fra vores QueryString (?id=X)
            string ID = Request.QueryString["id"];

            //Hvis der er uploadet et profilbillede vised dette og baggrunden gøres hvid
            if (System.IO.File.Exists(Server.MapPath("/Uploads/" + ID + "/profile.jpg")))               //Ser om der ligger et profilbillede i brugerens mappe
            {
                imgProfil.Visible = true; imgProfil.ImageUrl = "./Uploads/" + ID + "/profile.jpg";      //Gør billedet synligt og indsætter det
                billedeSkift.Attributes.Add("style", "background:color(white/" + ID + "/profile.jpg); ");
            }                                                                                           //Skifter bagrunden fra placeholder til hvid

            //Forbindelse til SQL Databasen
            SqlDataSource SqlDataSource1 = new SqlDataSource();                                                                                            //Laver en SqlDataSource

            SqlDataSource1.ID = "SqlDataSource1";                                                                                                          //Giver den et ID
            this.Page.Controls.Add(SqlDataSource1);                                                                                                        //Tilføjer den til siden
            SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["memorialtagConnectionString"].ConnectionString; //Vores connection string som er defineret i web.config
            SqlDataSource1.SelectCommand    = "SELECT * FROM [Grav] WHERE ([GravID] = " + ID + ")";                                                        //Vores SELECT statement

            //Error handling med try catch
            try
            {
                DataView test = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);       //Laver et test dataview til vores template
                labFornavn.Text = test.Table.Rows[0][2].ToString();                                     //Tester om der er lagt data i vores dataview
            }
            catch
            {
                Response.Redirect("./default.aspx");                                                    //Hvis ikke der ligger data i vores dataview ...
            }

            DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);             //Laver det egentlige dataview der bruges

            //Indsætter teksten fra placeringen i vores dataview i de valgte textboxes
            labFuldeNavn.Text = dv.Table.Rows[0][2].ToString() + " " + dv.Table.Rows[0][3].ToString();
            labKirkegård.Text = "Kirkegård: " + dv.Table.Rows[0][1].ToString();
            labID.Text        = "ID: " + dv.Table.Rows[0][0].ToString();
            labFornavn.Text   = dv.Table.Rows[0][2].ToString();
            labEfternavn.Text = dv.Table.Rows[0][3].ToString();
            DateTime føsdag = DateTime.Parse(dv.Table.Rows[0][4].ToString());

            labFødselsdato.Text     = føsdag.ToShortDateString();
            tidslinjeFødselsår.Text = føsdag.Year.ToString();
            DateTime dødsdag = DateTime.Parse(dv.Table.Rows[0][5].ToString());

            labDødsdato.Text          = dødsdag.ToShortDateString();
            tidslinjeDødsår.Text      = dødsdag.Year.ToString();
            labFødeby.Text            = dv.Table.Rows[0][6].ToString();
            labSidsteBopæl.Text       = dv.Table.Rows[0][7].ToString();
            labStilling.Text          = dv.Table.Rows[0][8].ToString();
            labNærmestePårørende.Text = dv.Table.Rows[0][9].ToString();
            btnLinkFB.PostBackUrl     = dv.Table.Rows[0][10].ToString();
            btnLinkMH.PostBackUrl     = dv.Table.Rows[0][11].ToString();
            labBiografi.Text          = dv.Table.Rows[0][12].ToString();
            labUddannelse.Text        = dv.Table.Rows[0][13].ToString();
            labKarriere.Text          = dv.Table.Rows[0][14].ToString();
            labBedrifter.Text         = dv.Table.Rows[0][15].ToString();

            //Collapser links, labels og boxes hvis de er tomme
            if (btnLinkFB.PostBackUrl == "")
            {
                btnLinkFB.Visible = false;
            }
            if (btnLinkMH.PostBackUrl == "")
            {
                btnLinkMH.Visible = false;
            }
            if (labBiografi.Text == "")
            {
                labBiografi.Visible = false && labBiografiOverskrift.Visible == false;
            }
            if (labUddannelse.Text == "")
            {
                labUddannelse.Visible = false && labUdannelseOverskrift.Visible == false;
            }
            if (labKarriere.Text == "")
            {
                labKarriere.Visible = false && labKarriereOverskrift.Visible == false;
            }
            if (labBedrifter.Text == "")
            {
                labBedrifter.Visible = false && labBedrifterOverskrift.Visible == false;
            }
            if (labBiografi.Text == "" && labUddannelse.Text == "" && labKarriere.Text == "" && labBedrifter.Text == "")
            {
                Biografi.Visible = false;
            }

            PopulateImages();
        }
Exemplo n.º 38
0
    // V 1.0.0
    public List <BankData> getBankData_AllDegree(string selected_date)
    {
        List <BankData> bankData = new List <BankData>();
        string          sql      = "";

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        sql = "Select * From BANK_DATA Where BANK_SUMDATE = '" + selected_date + "' ";

        oracleObj.SelectCommand = sql;
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            BankData   bank_data   = new BankData();
            DegreeData degree_data = new DegreeData();

            bank_data.Amount             = rowData["AMOUNT"].ToString().ToCharArray();
            bank_data.BankCode           = rowData["BANK_CODE"].ToString().ToCharArray();
            bankcode_data                = bankcodeObj.getBankCode(new string(bank_data.BankCode));
            bank_data.Bank_ShortName     = bankcode_data.Bank_ShortName;
            bank_data.Bank_ThaiName      = bankcode_data.Bank_ThaiName;
            bank_data.TrancCode          = rowData["TRANSACTION_CODE"].ToString().ToCharArray();
            bank_data.Student_Name       = rowData["STUDENT_NAME"].ToString();
            bank_data.Student_ID         = rowData["STUDENT_ID"].ToString();
            bank_data.Nation_Passport_ID = rowData["NATION_PASSPORT_ID"].ToString();
            bank_data.AcademicYear       = rowData["ACADEMIC_YEAR"].ToString();
            bank_data.Semester           = rowData["SEMESTER"].ToString();
            bank_data.Paymenty_ID        = rowData["PAYMENT_ID"].ToString();
            bank_data.Payment_Date       = rowData["PAYMENT_DATE"].ToString();
            bank_data.Payment_Time       = rowData["PAYMENT_TIME"].ToString();
            bank_data.ThaiPayment_Date   = new utility().getThaiBirthDay(bank_data.Payment_Date);
            bank_data.Degree_Level       = bank_data.Paymenty_ID.Substring(0, 1);
            degree_data               = new DegreeAdmission().getDegreeAdmission(bank_data.Degree_Level);
            bank_data.Degree_Char     = degree_data.Degree_Char;
            bank_data.Degree_ThaiName = degree_data.Degree_Thai;
            bank_data.DueDate         = rowData["DUE_DATE"].ToString();
            bank_data.ThaiDueDate     = new utility().getThaiBirthDay(bank_data.DueDate);
            bank_data.SumDate         = rowData["BANK_SUMDATE"].ToString();
            bank_data.ThaiSumDate     = new utility().getThaiBirthDay(bank_data.SumDate);
            bank_data.Status          = rowData["STATUS"].ToString();

            bankData.Add(bank_data);
        }

        sql = "Select * From GRAD_BANK_DATA Where BANK_SUMDATE = '" + selected_date + "' ";

        oracleObj.SelectCommand = sql;
        DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData2)
        {
            BankData   bank_data   = new BankData();
            DegreeData degree_data = new DegreeData();

            bank_data.Amount             = rowData["AMOUNT"].ToString().ToCharArray();
            bank_data.BankCode           = rowData["BANK_CODE"].ToString().ToCharArray();
            bankcode_data                = bankcodeObj.getBankCode(new string(bank_data.BankCode));
            bank_data.Bank_ShortName     = bankcode_data.Bank_ShortName;
            bank_data.Bank_ThaiName      = bankcode_data.Bank_ThaiName;
            bank_data.TrancCode          = rowData["TRANSACTION_CODE"].ToString().ToCharArray();
            bank_data.Student_Name       = rowData["STUDENT_NAME"].ToString();
            bank_data.Student_ID         = rowData["STUDENT_ID"].ToString();
            bank_data.Nation_Passport_ID = rowData["NATION_PASSPORT_ID"].ToString();
            bank_data.AcademicYear       = rowData["ACADEMIC_YEAR"].ToString();
            bank_data.Semester           = rowData["SEMESTER"].ToString();
            bank_data.Paymenty_ID        = rowData["PAYMENT_ID"].ToString();
            bank_data.Payment_Date       = rowData["PAYMENT_DATE"].ToString();
            bank_data.ThaiPayment_Date   = new utility().getThaiBirthDay(bank_data.Payment_Date);
            bank_data.Degree_Level       = bank_data.Paymenty_ID.Substring(0, 1);
            degree_data               = new DegreeAdmission().getDegreeAdmission(bank_data.Degree_Level);
            bank_data.Degree_Char     = degree_data.Degree_Char;
            bank_data.Degree_ThaiName = degree_data.Degree_Thai;
            bank_data.DueDate         = rowData["DUE_DATE"].ToString();
            bank_data.ThaiDueDate     = new utility().getThaiBirthDay(bank_data.DueDate);
            bank_data.SumDate         = rowData["BANK_SUMDATE"].ToString();
            bank_data.ThaiSumDate     = new utility().getThaiBirthDay(bank_data.SumDate);
            bank_data.Status          = rowData["STATUS"].ToString();

            bankData.Add(bank_data);
        }

        return(bankData);
    }
Exemplo n.º 39
0
    private void executeQuery()
    {
        x = new SqlDataSource();
        x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd";
        x.SelectCommand = "Select *,convert(varchar(100),startDate,111) as SDate,convert(varchar(100),endDate,111) as EDate from Promotions where activityID ='" + activity.Text + "'";
        DataView dv = x.Select(DataSourceSelectArguments.Empty) as DataView;

        //查完一定只有一筆, 所以Rows[0]選第一筆資料即可
        titleInput.Text = dv.Table.Rows[0]["title"].ToString();
        startDate.Text = dv.Table.Rows[0]["SDate"].ToString();
        endDate.Text = dv.Table.Rows[0]["EDate"].ToString();
        txtNewsContent.Text = dv.Table.Rows[0]["content"].ToString();
        txtRemark.Text = dv.Table.Rows[0]["comment"].ToString();
        picUP.ImageUrl = "~/pic/" + dv.Table.Rows[0]["picPath"].ToString();
    }
Exemplo n.º 40
0
    public DateTime[] getTaken(int advisor_Id, string date)
    {
        SqlDataSource SqlDataSource3 = new SqlDataSource();
        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource3.SelectCommand = "Select Time From Appointment,Availability  Where Appointment.Availability_Id=Availability.Availability_Id AND Employee_ID='" + advisor_Id + "' AND Date='" + date + "'";
        DataView view = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        DateTime[] slotsTaken = new DateTime[table.Rows.Count];

            for (int ii = 0; ii < table.Rows.Count; ii++)
            { slotsTaken[ii] = DateTime.Parse(table.Rows[ii][0].ToString()); }

        return slotsTaken;
    }
Exemplo n.º 41
0
        public static bool DuplicateProject(string projectID, string projectNewName)
        {
            SqlDataSource dataSource = new SqlDataSource();

            // Super bad? Copy pasta from web.config
            dataSource.ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\sunspace_db.mdf;Integrated Security=True;Connect Timeout=30";
            Project aProject = new Project();

            System.Data.DataView selectProject = new System.Data.DataView();
            string        sqlSelect;
            string        sqlInsert;
            List <string> tableNames = new List <string>();
            int           newProjectID; // New project ID for all the compenents of a project
            int           tableCount;   // Number of tables

            // Select the project
            sqlSelect = "SELECT 	project_type,"+
                        "installation_type," +
                        "customer_id," +
                        "user_id," +
                        "date_created," +
                        "status," +
                        "revised_date," +
                        "revised_user_id," +
                        "msrp," +
                        "project_notes," +
                        "hidden," +
                        "cut_pitch" +
                        " FROM Projects" +
                        " WHERE project_ID = " + projectID + ";";

            dataSource.SelectCommand = sqlSelect;
            selectProject            = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            Debug.WriteLine(selectProject[0].Row[0]);

            // Insert the new project with the duplicated data!
            sqlInsert = "INSERT INTO Projects(project_type, " +
                        "installation_type, " +
                        "customer_id, " +
                        "user_id, " +
                        "date_created, " +
                        "status, " +
                        "revised_date, " +
                        "revised_user_id, " +
                        "msrp, " +
                        "project_notes, " +
                        "hidden, " +
                        "cut_pitch, " +
                        "project_name " +
                        ") VALUES ( '" + selectProject[0].Row[0] + "'," +
                        "'" + selectProject[0].Row[1] + "'," +
                        "'" + selectProject[0].Row[2] + "'," +
                        "'" + selectProject[0].Row[3] + "'," +
                        "'" + selectProject[0].Row[4] + "'," +
                        "'" + selectProject[0].Row[5] + "'," +
                        "'" + selectProject[0].Row[6] + "'," +
                        "'" + selectProject[0].Row[7] + "'," +
                        "'" + selectProject[0].Row[8] + "'," +
                        "'" + selectProject[0].Row[9] + "'," +
                        "'" + selectProject[0].Row[10] + "'," +
                        "'" + selectProject[0].Row[11] + "'," +
                        "'" + projectNewName + "' ); "; //+
            //" WHERE project_ID = '" + projectID + "';";

            dataSource.InsertCommand = sqlInsert;
            dataSource.Insert();

            // Grab project id from the last insert!
            sqlSelect = "SELECT project_ID from Projects WHERE project_ID = IDENT_CURRENT('Projects');";


            dataSource.SelectCommand = sqlSelect;
            selectProject            = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            // Set new project id
            newProjectID = (int)selectProject[0].Row[0];

            Debug.WriteLine(selectProject[0].Row[0]);

            // Get table count
            sqlSelect = "Select Count(*) From INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE 'project_id' AND TABLE_NAME <> 'projects'";

            dataSource.SelectCommand = sqlSelect;
            selectProject            = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            // Set table count
            tableCount = (int)selectProject[0].Row[0];

            Debug.WriteLine(selectProject[0].Row[0]);

            // Essentially this gets a compenent table info and re-inserts it with the new project ID
            for (int index = 0; index < tableCount; index++)
            {
                // Get table names
                sqlSelect = "SELECT TABLE_NAME From INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE 'project_id' AND TABLE_NAME <> 'projects' ORDER BY TABLE_NAME ASC OFFSET " + index + " ROWS FETCH NEXT 1 ROWS ONLY";
                dataSource.SelectCommand = sqlSelect;
                selectProject            = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                tableNames.Add((string)selectProject[0].Row[0]);
                Debug.WriteLine("Table Name: " + selectProject[0].Row[0]);
                Debug.WriteLine("Table Count:" + tableNames.Count());

                // Select rows with the old project id
                sqlSelect = "SELECT * FROM " + selectProject[0].Row[0] + " WHERE project_ID = " + projectID;
                dataSource.SelectCommand = sqlSelect;
                selectProject            = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                //
                // If we actually need this table..
                //
                if (selectProject.Count > 0)
                {
                    Debug.WriteLine(selectProject[0].Row[0]);

                    // Start the insert statement
                    sqlInsert = "INSERT INTO " + tableNames[index] + " VALUES (";

                    // Inserts the values
                    for (int index2 = 0; index2 < selectProject[0].Row.ItemArray.Count(); index2++)
                    {
                        Debug.WriteLine(selectProject[0].Row[index2]);
                        if (index2 == 0)
                        {
                            sqlInsert += "'" + newProjectID + "', ";
                        }
                        else if (index2 != (selectProject[0].Row.ItemArray.Count() - 1))
                        {
                            sqlInsert += "'" + selectProject[0].Row[index2] + "', ";
                        }
                        else
                        {
                            sqlInsert += "'" + selectProject[0].Row[index2] + "'";
                        }
                    }
                    // Close the insert
                    sqlInsert += ");";
                    Debug.WriteLine(sqlInsert);


                    // Actually insert the data
                    dataSource.InsertCommand = sqlInsert;
                    dataSource.Insert();
                }
            }

            return(true);
        }
Exemplo n.º 42
0
    public int[] getAdvisorId(DateTime date)
    {
        string container;
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();

        SqlDataSource2.SelectCommand = "Select AdvisorSchedule.Advisor_Id From AdvisorSchedule,Advisor_Master Where AdvisorSchedule.Advisor_Id=Advisor_Master.Advisor_Id AND StartDate < '" + date.ToShortDateString() + "' AND FinishDate > '" + date.ToShortDateString() + "' AND DaysAvailable Like '%" + date.DayOfWeek.ToString() + "%'";
        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        int[] advisorId = new int[table.Rows.Count];
        for (int i = 0; i < table.Rows.Count; i++)
        {
            container = table.Rows[i][0].ToString();
            advisorId[i] = Convert.ToInt16(container);
        }

        return advisorId;
        //Label1.Text = Session["date"].ToString();
    }
    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.º 44
0
    public bool getCheck(string stID)
    {
        int Student_Id = Convert.ToInt32(stID);
        DateTime date = DateTime.Now;
        SqlDataSource SqlDataSource3 = new SqlDataSource();
        SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource3.SelectCommand = "Select Time From Scheduling  Where Student_Id='" + Student_Id + "' AND Date>'" + date + "'";

        DataView view = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        //   string[] slotsTaken = new string[table.Rows.Count];
        bool check=false;
        if (table.Rows.Count==0)
        {check=true;}

        return check;
    }
Exemplo n.º 45
0
        private void Initial_loadpageAD()
        {
            Literal ltlCarouselAD = (Literal)home.FindControl("ltlCarouselAD");
            String  strCarouselAD = "";
            int     countAD       = 0;

            SqlDataSource sds_carousel = new SqlDataSource();

            sds_carousel.DataSourceMode   = SqlDataSourceMode.DataReader;
            sds_carousel.ConnectionString = str_Data_Source;
            sds_carousel.SelectCommand    = "SELECT fId, fPic, fFirst, fSecond, fThird from t前台輪播";
            System.Data.SqlClient.SqlDataReader sdr輪播 = (System.Data.SqlClient.SqlDataReader)sds_carousel.Select(DataSourceSelectArguments.Empty);

            if (sdr輪播.HasRows)
            {
                while (sdr輪播.Read())
                {
                    countAD++;

                    if (countAD == 1)
                    {
                        strCarouselAD += "<div class='item active'>";
                        strCarouselAD += "<img class='img-responsive' src='" + sdr輪播["fPic"].ToString() + "' alt='slider' style='width:1600px;height:300px' />";
                        strCarouselAD += "<div class='slider-content'>";
                        strCarouselAD += "<div class='col-md-12 text-center'>";
                        strCarouselAD += "<h3 class='animated2 white'>";
                        strCarouselAD += "<span><strong>" + sdr輪播["fFirst"].ToString() + "</strong>" + sdr輪播["fSecond"].ToString() + "</span>";
                        strCarouselAD += "</h3><br />";
                        strCarouselAD += "<h4 class='animated3'>";
                        strCarouselAD += "<span>" + sdr輪播["fThird"].ToString() + "</span></h4></div></div></div>";
                    }

                    if (countAD == 2)
                    {
                        strCarouselAD += "<div class='item'>";
                        strCarouselAD += "<img class='img-responsive' src='" + sdr輪播["fPic"].ToString() + "' alt='slider' style='width:1600px;height:300px' />";
                        strCarouselAD += "<div class='slider-content'>";
                        strCarouselAD += "<div class='col-md-12 text-center'>";
                        strCarouselAD += "<h3 class='animated4 white'>";
                        strCarouselAD += "<span><strong>" + sdr輪播["fFirst"].ToString() + "</strong>" + sdr輪播["fSecond"].ToString() + "</span>";
                        strCarouselAD += "</h3><br />";
                        strCarouselAD += "<h4 class='animated5'>";
                        strCarouselAD += "<span>" + sdr輪播["fThird"].ToString() + "</span></h4></div></div></div>";
                    }

                    if (countAD == 3)
                    {
                        strCarouselAD += "<div class='item'>";
                        strCarouselAD += "<img class='img-responsive' src='" + sdr輪播["fPic"].ToString() + "' alt='slider' style='width:1600px;height:300px' />";
                        strCarouselAD += "<div class='slider-content'>";
                        strCarouselAD += "<div class='col-md-12 text-center'>";
                        strCarouselAD += "<h3 class='animated7 white'>";
                        strCarouselAD += "<span><strong>" + sdr輪播["fFirst"].ToString() + "</strong>" + sdr輪播["fSecond"].ToString() + "</span>";
                        strCarouselAD += "</h3><br />";
                        strCarouselAD += "<h4 class='animated8'>";
                        strCarouselAD += "<span>" + sdr輪播["fThird"].ToString() + "</span></h4></div></div></div>";
                    }
                }
            }

            ltlCarouselAD.Text = strCarouselAD;
        }
Exemplo n.º 46
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.º 47
0
    //-------------------------------------Get Advisors By Date -----------------------------------------------------------
    public string[] getAdvisorNames(DateTime date)
    {
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();

        SqlDataSource2.SelectCommand = "Select Dept_Name,(Last_Name+', ' + First_Name) As Advisors From AdvisorSchedule,Advisor_Master,Department_Master Where AdvisorSchedule.Advisor_Id=Advisor_Master.Advisor_Id AND Advisor_Master.Dept_Id=Department_Master.Dept_Id AND StartDate < '" + date.ToShortDateString() + "' AND FinishDate > '" + date.ToShortDateString() + "' AND DaysAvailable Like '%" + date.DayOfWeek.ToString() + "%'";
        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        string[] advisorNames = new string[table.Rows.Count];
        for (int i = 0; i < table.Rows.Count; i++)
        {
            advisorNames[i] = table.Rows[i][0].ToString();
        }

        return advisorNames;
        //Label1.Text = Session["date"].ToString();
    }
Exemplo n.º 48
0
    //    public string getMonday(int advisor_Id)
    //    public string getTuesday(int advisor_Id)
    //    public string getWednesday(int advisor_Id)
    //    public string getThursday(int advisor_Id)
    //    public string getFriday(int advisor_Id)
    public DateTime[] getSlots(int advisor_Id, string date)
    {
        DateTime advisorDateDateTime = DateTime.Parse(date);
        int week = GetWeekNumber(advisorDateDateTime); string day = advisorDateDateTime.DayOfWeek.ToString();
        SqlDataSource SqlDataSource = new SqlDataSource();
        SqlDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["AdvisorBookingConnectionString"].ToString();
        SqlDataSource.SelectCommand = "Select StartTime,EndTime,AdvisorScheduleID From AdvisorSchedules Where  Advisor_ID='" + advisor_Id + "' AND Day='" + day + "' And Week='" + week + "'";
        DataView view = (DataView)SqlDataSource.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        DateTime[][] Slots = new DateTime[table.Rows.Count + 1][];

        int[][] advisorSlotsAvailabilityID = new int[table.Rows.Count + 1][];

        if (table.Rows.Count > 0)
        {
            for (int ii = 0; ii < table.Rows.Count; ii++)
            {
                DateTime start = DateTime.ParseExact(table.Rows[ii][0].ToString(), "HH:mm:ss", null);
                DateTime end = DateTime.Parse(table.Rows[ii][1].ToString());

                double dbltime = ((end - start).TotalHours) * 2;
                int inttime = Convert.ToInt32(dbltime);

                DateTime[] advisorSlots = new DateTime[inttime];
                int[] SlotsScheduleID = new int[inttime];

                for (int i = 0; i < inttime; i++)
                {

                    advisorSlots[i] = start;
                    start = start.AddMinutes(30);
                    SlotsScheduleID[i] = Convert.ToInt32(table.Rows[ii][2].ToString());

                }
                Slots[ii] = advisorSlots;
                advisorSlotsAvailabilityID[ii] = SlotsScheduleID;

            }
        }
        Slots[table.Rows.Count] = new DateTime[0];
        Slots[table.Rows.Count] = Slots[0];
        advisorSlotsAvailabilityID[table.Rows.Count] = advisorSlotsAvailabilityID[0];

        for (int i = 1; i < table.Rows.Count; i++)
        {
            if (table.Rows.Count > i)
            {
                Slots[table.Rows.Count] = Slots[table.Rows.Count].Concat(Slots[i]).ToArray();
                advisorSlotsAvailabilityID[table.Rows.Count] = advisorSlotsAvailabilityID[table.Rows.Count].Concat(advisorSlotsAvailabilityID[i]).ToArray();
            }
        }

        AllSlotsID = advisorSlotsAvailabilityID[table.Rows.Count];
        AllSlots = Slots[table.Rows.Count];
        Array.Sort(Slots[table.Rows.Count]);

        return Slots[table.Rows.Count];
    }
Exemplo n.º 49
0
    public int[] getStudentIds()
    {
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["AdvisorBookingConnectionString"].ToString();
        SqlDataSource2.SelectCommand = "Select Student_ID From Student";

        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        //   string[] slotsTaken = new string[table.Rows.Count];

        int[] Student_ID = new int[table.Rows.Count];

        for (int ii = 0; ii < table.Rows.Count; ii++)
        { Student_ID[ii] = Convert.ToInt32(table.Rows[ii][0].ToString()); }
        return Student_ID;
    }
Exemplo n.º 50
0
    public DateTime[] getTaken(int advisor_Id, string date)
    {
        DateTime advisorDateDateTime = DateTime.Parse(date);
        int week = GetWeekNumber(advisorDateDateTime); string day = advisorDateDateTime.DayOfWeek.ToString();

        //---------------------------------------
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["AdvisorBookingConnectionString"].ToString();
        SqlDataSource2.SelectCommand = "Select Appointment.Time_Start From Appointment,AdvisorSchedules  Where Appointment.AdvisorScheduleID=AdvisorSchedules.AdvisorScheduleID AND Advisor_ID='" + advisor_Id + "'  AND Day='" + day + "' And Week='" + week + "'";

        DataView view2 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table2 = view2.ToTable();

        DateTime[] slotsTaken = new DateTime[table2.Rows.Count];

        for (int ii = 0; ii < table2.Rows.Count; ii++)
        { slotsTaken[ii] = DateTime.Parse(table2.Rows[ii][0].ToString()); }

        Array.Sort(slotsTaken);
        return slotsTaken;
    }
Exemplo n.º 51
0
    public DateTime[] getSlots(int advisor_Id, string date)
    {
        //inttime = total available time slots as int
        //doubletime = total available time slots as double
        SqlDataSource SqlDataSource = new SqlDataSource();
        SqlDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource.SelectCommand = "Select DayStart,DayFinish From AdvisorSchedule Where Advisor_Id='" + advisor_Id + "'";

        DataView view = (DataView)SqlDataSource.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        DateTime start = DateTime.Parse(table.Rows[0][0].ToString());
        DateTime end = DateTime.Parse(table.Rows[0][1].ToString());
        double dbltime = ((end - start).TotalHours) * 2;

        int inttime = Convert.ToInt32(dbltime);

        DateTime[] advisorSlots = new DateTime[inttime];

        for (int i = 0; i < inttime; i++)
        {

            advisorSlots[i] = start;
            start = start.AddMinutes(30);
        }

        return advisorSlots;
    }
Exemplo n.º 52
0
    /*
     *  This method provides the login functionality.
     *  Checks if the username and password combination is valid.
     *  Checks if the user is logging in for the first time.
     *  Checks if the user has been locked out by the admininstrator
     *  Checks if the user has been deleted by the administrator
     *  Keeps track of unsuccessful attempts and locks the user out in case it exceeds counter
     */

    protected void login_Click(object sender, EventArgs e)
    {
        SqlDataSource sds = new SqlDataSource();

        sds.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
        string pass = crypto.encryption_decryption.Encrypt(password.Text);

        sds.SelectParameters.Add("username", TypeCode.String, uname.Text);
        sds.SelectParameters.Add("password", TypeCode.String, pass);
        sds.SelectCommand = "SELECT * FROM [users] WHERE [username] = @username AND [password] = @password";
        DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);

        if (dv != null && dv.Count != 0)
        {
            user = dv[0].Row["username"].ToString();
            int uid = Int32.Parse(dv[0].Row["userid"].ToString());
            if ((dv[0].Row["IsDeleted"].ToString() == "0") && (dv[0].Row["IsLocked"].ToString() == "False") && (dv[0].Row["FirstTime"].ToString() == "False"))
            {
                Session["admin"] = dv[0].Row["admin"].ToString();
                if (dv[0].Row["admin"].ToString() == "True")
                {
                    lblmsg.Text = "Success";
                    this.Session["username"] = dv[0].Row["username"].ToString();
                    if (Session["username"] == null)
                    {
                        Console.WriteLine("??");
                    }
                    Session["userid"] = dv[0].Row["userid"].ToString();
                    CreateLogEntry(Session["userid"].ToString());
                    Response.Redirect("~/Views/Page.aspx");
                }
                else
                {
                    lblmsg.Text = "Success";
                    this.Session["username"] = dv[0].Row["username"].ToString();
                    if (Session["username"] == null)
                    {
                        Console.WriteLine("??");
                    }
                    Session["userid"] = dv[0].Row["userid"].ToString();
                    CreateLogEntry(Session["userid"].ToString());
                    Response.Redirect("~/Views/user.aspx");
                }
            }
            else if (dv[0].Row["FirstTime"].ToString() == "True")
            {
                utility.utils.CreateLeaveEntry(uid);
                multiview.SetActiveView(view0);
                quef.Text = dv[0].Row["SecurityQuestion"].ToString();
            }
            else if (dv[0].Row["IsLocked"].ToString() == "True")
            {
                lblmsg.ForeColor = System.Drawing.Color.Red;
                lblmsg.Text      = "You Have Been Locked Out";
            }
            else
            {
                lblmsg.ForeColor = System.Drawing.Color.Red;
                lblmsg.Text      = "User No Longer Exists";
            }
        }
        else
        {
            UpdateCounter(uname.Text);
            lblmsg.ForeColor = System.Drawing.Color.Red;
            lblmsg.Text      = "Invalid Username and Password Try again";
        }
    }
Exemplo n.º 53
0
 public DataTable loadAdvisorsToGrid()
 {
     DateTime date = new DateTime();
     date = DateTime.Now;
     SqlDataSource SqlDataSource2 = new SqlDataSource();
     SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
     SqlDataSource2.SelectCommand = "Select (Last_Name+', ' + First_Name) As Advisors,Dept_Name As Department,DaysAvailable As Avalability, (CONVERT(varchar, DayStart, 100)+ '-'+CONVERT(varchar, DayFinish, 100)) As Time, Advisor_Master.Advisor_Id As ID From AdvisorSchedule,Advisor_Master,Department_Master Where AdvisorSchedule.Advisor_Id=Advisor_Master.Advisor_Id AND Advisor_Master.Dept_Id=Department_Master.Dept_Id AND StartDate < '" + date.ToShortDateString() + "' AND FinishDate > '" + date.ToShortDateString() + "'";
     DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
     DataTable table = view.ToTable();
     return table;
 }
Exemplo n.º 54
0
        //Det der sker når siden indlæses
        protected void Page_Load(object sender, EventArgs e)
        {
            //Opretter en datasource som kan bruges under hele Page_Load
            SqlDataSource SqlDataSource1 = new SqlDataSource();                                         //Laver en SqlDataSource

            SqlDataSource1.ID = "SqlDataSource1";                                                       //Giver den et ID
            this.Page.Controls.Add(SqlDataSource1);                                                     //Tilføjer den til siden
            SqlDataSource1.CancelSelectOnNullParameter = true;
            try
            {
                //Kigger om brugeren er logget ind
                if (HttpContext.Current.Session["Username"].ToString() != "")
                {
                    //Forbinder til databasen for at kontrollere at brugernavnet eksisterer og kun findes en gang
                    SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["memorialtagConnectionString"].ConnectionString;                                                                                    //Vores connection string som er defineret i web.config
                    SqlDataSource1.SelectCommand    = "SELECT COUNT(1) FROM LoginTabel WHERE Brugernavn= '" + HttpContext.Current.Session["Username"].ToString() + "' AND Adgangskode= '" + HttpContext.Current.Session["Password"].ToString() + "'"; //Vores SELECT statement
                    DataView test  = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);                                                                                                                                                //Laver et test dataview til vores template
                    int      count = Convert.ToInt32(test.Table.Rows[0][0]);
                    if (count == 1)
                    {
                        //Hiver brugernavnet fra vores sessions variabel og viser det som en overskrift
                        string User = HttpContext.Current.Session["Username"].ToString();
                        HttpContext.Current.Session["Username"] = User;
                        labUserOverskrift.Text = "Hej, " + User;

                        //Vores forbindelse til SQL databasen
                        SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["memorialtagConnectionString"].ConnectionString;
                        SqlDataSource1.SelectCommand    = "SELECT [KundeTabel].[Fornavn], [KundeTabel].[Efternavn], [KundeTabel].[Telefon], [KundeTabel].[Mail], [LandNavn], [ByNavn], [KundeTabel].[Postnummer], [KundeTabel].[Vej], [KundeTabel].[KundeID], [TagTabel].[TagID], GravTabel.[GravID] FROM [KundeTabel] INNER JOIN  LandTabel ON KundeTabel.LandID = LandTabel.LandID INNER JOIN ByTabel ON KundeTabel.Postnummer = ByTabel.Postnummer INNER JOIN TagTabel ON KundeTabel.KundeID = TagTabel.KundeID INNER JOIN GravTabel ON TagTabel.TagID = GravTabel.TagID WHERE [KundeTabel].[Mail] = '" + User + "'";

                        //Error handling med en try cath
                        try
                        {
                            test = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
                            string TagID   = test.Table.Rows[0]["TagID"].ToString();
                            string GravID  = test.Table.Rows[0]["GravID"].ToString();
                            string KundeID = test.Table.Rows[0]["KundeID"].ToString();

                            if (test.Table.Rows[0]["Fornavn"].ToString() != null)
                            {
                                labFornavn.Text = test.Table.Rows[0]["Fornavn"].ToString();
                            }
                            if (test.Table.Rows[0]["Efternavn"].ToString() != null)
                            {
                                labEfternavn.Text = test.Table.Rows[0]["Efternavn"].ToString();
                            }
                            if (test.Table.Rows[0]["Telefon"].ToString() != null)
                            {
                                labTelefon.Text = test.Table.Rows[0]["Telefon"].ToString();
                            }
                            if (test.Table.Rows[0]["Mail"].ToString() != null)
                            {
                                labEmail.Text = test.Table.Rows[0]["Mail"].ToString();
                            }
                            if (test.Table.Rows[0]["LandNavn"].ToString() != null)
                            {
                                labLand.Text = test.Table.Rows[0]["LandNavn"].ToString();
                            }
                            if (test.Table.Rows[0]["ByNavn"].ToString() != null)
                            {
                                labBy.Text = test.Table.Rows[0]["ByNavn"].ToString();
                            }
                            if (test.Table.Rows[0]["Postnummer"].ToString() != null)
                            {
                                labPostnr.Text = test.Table.Rows[0]["Postnummer"].ToString();
                            }
                            if (test.Table.Rows[0]["Vej"].ToString() != null)
                            {
                                labVej.Text = test.Table.Rows[0]["Vej"].ToString();
                            }
                            if (test.Table.Rows[0]["KundeID"].ToString() != null)
                            {
                                kundeID.Text = "Kunde ID: " + test.Table.Rows[0]["KundeID"].ToString();
                            }

                            //Ny SQL Select kommando på grav tabellen istedet for kunde tabellen
                            SqlDataSource SqlDataSourceFrontPage = new SqlDataSource();                                                                                            //Laver en SqlDataSource
                            SqlDataSourceFrontPage.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["memorialtagConnectionString"].ConnectionString; //Vores connection string som er defineret i web.config
                            SqlDataSourceFrontPage.ID = "SqlDataSourceFrontPage";                                                                                                  //Giver den et ID
                            this.Page.Controls.Add(SqlDataSourceFrontPage);                                                                                                        //Tilføjer den til siden
                            SqlDataSourceFrontPage.SelectCommand = "SELECT [Fornavn], [Efternavn], [Fødselsdato], [Dødsdato], [GravTabel].[GravID] FROM[GravTabel] INNER JOIN TagTabel ON GravTabel.TagID = TagTabel.TagID WHERE KundeID = '" + KundeID + "'";
                            test = (DataView)SqlDataSourceFrontPage.Select(DataSourceSelectArguments.Empty);
                        }
                        catch
                        {
                            Response.Redirect("./Error.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("./Error.aspx");
                }
            }
            catch { Response.Redirect("./Error.aspx"); }
        }
Exemplo n.º 55
0
        void exportFile()
        {
            ExcelPackage pck      = new ExcelPackage();
            string       filename = string.Empty;

            filename = StoreName + " #" + StoreNumber + " - Week Ending " + Convert.ToDateTime(StartDate).AddDays(13).ToShortDateString().Replace("/", "-");

            using (pck)
            {
                ExcelWorksheet ws = pck.Workbook.Worksheets.Add(filename);

                SqlDataSource SQL1 = new SqlDataSource();
                SQL1.ID = "SqlDataSource1";
                SQL1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
                SQL1.SelectParameters.Add("webStartDate", StartDate);
                SQL1.SelectParameters.Add("webDuration", "14");
                SQL1.SelectParameters.Add("webProgram", Program);
                SQL1.SelectParameters.Add("webStoreNumber", StoreNumber);
                SQL1.SelectParameters.Add("webStoreName", StoreName);
                SQL1.SelectParameters.Add("webLocation", Location);
                SQL1.SelectParameters.Add("webOwner", Owner);
                SQL1.SelectParameters.Add("UserType", userType);
                SQL1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                SQL1.Selecting       += SQLSelecting;
                SQL1.SelectCommand    = "spx_PAYOUTQty";

                SqlDataSource SQL2 = new SqlDataSource();
                SQL2.ID = "SqlDataSource2";
                SQL2.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
                SQL2.SelectParameters.Add("webStartDate", StartDate);
                SQL2.SelectParameters.Add("webDuration", "14");
                SQL2.SelectParameters.Add("webProgram", Program);
                SQL2.SelectParameters.Add("webStoreNumber", StoreNumber);
                SQL2.SelectParameters.Add("webStoreName", StoreName);
                SQL2.SelectParameters.Add("webLocation", Location);
                SQL2.SelectParameters.Add("webOwner", Owner);
                SQL2.SelectParameters.Add("UserType", userType);
                if (Program == "Chipio - Chip Repair")
                {
                    SQL2.SelectParameters.Add("gross", "Chipio - Chip Repair");
                }
                else
                {
                    SQL2.SelectParameters.Add("gross", "All");
                }
                SQL2.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                SQL2.Selecting       += SQLSelecting;
                SQL2.SelectCommand    = "spx_PAYOUTRev";

                DataSourceSelectArguments args1 = new DataSourceSelectArguments();
                DataView  DV1 = (DataView)SQL1.Select(args1);
                DataTable DT1 = DV1.ToTable();
                DataSourceSelectArguments args2 = new DataSourceSelectArguments();
                DataView  DV2 = (DataView)SQL2.Select(args2);
                DataTable DT2 = DV2.ToTable();

                int j1 = DV1.Table.Rows.Count + 12;
                int j2 = j1 + 1;

                ws.Cells["A1"].Value           = "Store:";
                ws.Cells["A1"].Style.Font.Bold = true;
                ws.Cells["B1"].Value           = StoreName;

                ws.Cells["A2"].Value           = "Program:";
                ws.Cells["A2"].Style.Font.Bold = true;
                ws.Cells["B2"].Value           = Program;

                ws.Cells["A3"].Value           = "Owner:";
                ws.Cells["A3"].Style.Font.Bold = true;
                ws.Cells["B3"].Value           = Owner;

                ws.Cells["A4"].Value           = "Hub:";
                ws.Cells["A4"].Style.Font.Bold = true;
                ws.Cells["B4"].Value           = Hub;

                ws.Cells["A5"].Value           = "Whse #:";
                ws.Cells["A5"].Style.Font.Bold = true;
                ws.Cells["B5"].Value           = StoreNumber;

                ws.Cells["A6"].Value           = "Location:";
                ws.Cells["A6"].Style.Font.Bold = true;
                ws.Cells["B6"].Value           = Location;

                ws.Cells["A9"].Value           = "Quantity";
                ws.Cells["A9"].Style.Font.Bold = true;

                ws.Cells["A10"].LoadFromDataTable(DT1, true);

                ws.Cells["A" + j1.ToString()].Value           = "Revenue";
                ws.Cells["A" + j1.ToString()].Style.Font.Bold = true;

                ws.Cells["A" + j2.ToString()].LoadFromDataTable(DT2, true);

                ws.Cells["A1:Z2000"].AutoFitColumns();

                Page.Controls.Remove(SQL1);
                Page.Controls.Remove(SQL2);

                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.AddHeader("content-disposition", "attachment;  filename=" + filename + ".xlsx");
                Response.BinaryWrite(pck.GetAsByteArray());
                Response.Flush();
                Response.End();
            }
        }
Exemplo n.º 56
0
    public List <BankCardData> getBankCard(string startSubmitDate, string endSubmitDate)
    {
        List <BankCardData> bankcardData = new List <BankCardData>();

        ConnectDB     db         = new ConnectDB();
        SqlDataSource oracleObj  = db.ConnectionOracle();
        DataView      allStudent = new DataView();

        oracleObj.SelectCommand = "Select * From BANK_CARDSTUDENT,GRAD_STUDENT,GRAD_STUDENT_INFORMATION Where BANK_CARDSTUDENT.SUBMIT_DATE BETWEEN '" + startSubmitDate + "' And '" + endSubmitDate + "' And GRAD_STUDENT.student_id=bank_cardstudent.student_id AND GRAD_STUDENT_INFORMATION.student_id = GRAD_STUDENT.student_id  Order By BANK_CARDSTUDENT.SUBMIT_DATE DESC";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            BankCardData bankcard_data = new BankCardData();
            bankcard_data.StudentID = rowData["STUDENT_ID"].ToString();

            bankcard_data.Student_ID       = rowData["STUDENT_ID"].ToString();
            bankcard_data.Degree_Admission = rowData["DEGREE_ADMISSION_CODE"].ToString();
            bankcard_data.Faculty_Code     = rowData["FACULTY_CODE"].ToString();

            bankcard_data.DegreeAdmissionCode = rowData["DEGREE_ADMISSION_CODE"].ToString();
            bankcard_data.DegreeChar          = rowData["DEGREE_CHAR"].ToString();
            bankcard_data.FacultyCode         = rowData["FACULTY_CODE"].ToString();
            bankcard_data.SubmitDate          = rowData["SUBMIT_DATE"].ToString();
            bankcard_data.BankStaffCode       = rowData["BANK_STAFF_CODE"].ToString();

            bankcard_data.Curri_Code        = rowData["CURRI_CODE"].ToString();
            bankcard_data.Study_Year        = rowData["STUDY_YEAR"].ToString();
            bankcard_data.Plan_Code         = rowData["PLAN_CODE"].ToString();
            bankcard_data.Project_Code      = rowData["PROJECT_CODE"].ToString();
            bankcard_data.Campus_Code       = rowData["CAMPUS_CODE"].ToString();
            bankcard_data.Learning_Cen_Code = rowData["LEARNING_CEN_CODE"].ToString();
            //bankcard_data.Faculty_Code = rowData["FACULTY_CODE"].ToString();
            bankcard_data.Department_Code = rowData["DEPARTMENT_CODE"].ToString();
            bankcard_data.Major_Code      = rowData["MAJOR_CODE"].ToString();
            bankcard_data.Spec_Field_Code = rowData["SPEC_FIELD_CODE"].ToString();
            //bankcard_data.Segment_Code = rowData["SEGMENT_CODE"].ToString();
            //bankcard_data.Advisor_ID = rowData["ADVISOR_ID"].ToString();
            //bankcard_data.Section_Code = rowData["SECTION_CODE"].ToString();
            bankcard_data.Date_Admission     = rowData["DATE_ADMISSION"].ToString();
            bankcard_data.Semester_Admission = rowData["SEMESTER_ADMISSION"].ToString();
            bankcard_data.Year_Admission     = rowData["YEAR_ADMISSION"].ToString();
            //bankcard_data.Degree_Admission = rowData["DEGREE_ADMISSION_CODE"].ToString();
            bankcard_data.preDegree_Code        = rowData["PRE_DEGREE_CODE"].ToString();
            bankcard_data.preInstitution        = rowData["PRE_INSTITUTION"].ToString();
            bankcard_data.preAcademicYear       = rowData["PRE_ACADEMICYEAR"].ToString();
            bankcard_data.preGPA                = float.Parse(rowData["PRE_GPA"].ToString());
            bankcard_data.preQualification_Code = rowData["PRE_QUALIFICATION_CODE"].ToString();
            bankcard_data.preMojor_Code         = rowData["PRE_MOJOR_CODE"].ToString();
            bankcard_data.Std_Category_Code     = rowData["STD_CATEGORY_CODE"].ToString();
            bankcard_data.Std_Photo             = rowData["STD_PHOTO"].ToString();
            bankcard_data.Maintaining_Fee       = Convert.ToInt32(rowData["MAINTAINING_FEE"].ToString());
            bankcard_data.Cooperative           = rowData["COOPERATIVE_STATUS"].ToString();
            bankcard_data.Study_Status          = rowData["STUDY_STATUS"].ToString();
            bankcard_data.Student_Status        = rowData["STUDENT_STATUS"].ToString();
            bankcard_data.Term_Of_Status        = rowData["TERM_OF_STATUS"].ToString();
            bankcard_data.Scholarship_Status    = rowData["SCHOLARSHIP_STATUS"].ToString();

            bankcard_data.Nation_ID           = rowData["NATION_ID"].ToString();
            bankcard_data.NationCard_Expire   = rowData["NATIONCARD_EXPIRE"].ToString();
            bankcard_data.Passport_ID         = rowData["PASSPORT_ID"].ToString();
            bankcard_data.PassportCard_Expire = rowData["PASSPORTCARD_EXPIRE"].ToString();
            bankcard_data.Country_Code        = rowData["COUNTRY_CODE"].ToString();
            bankcard_data.Gender              = rowData["GENDER"].ToString();
            bankcard_data.Prefix_Code         = rowData["PREFIX_CODE"].ToString();
            bankcard_data.Title_ThaiName      = rowData["TITLE_THAINAME"].ToString();
            bankcard_data.First_ThaiName      = rowData["FIRST_THAINAME"].ToString();
            bankcard_data.Family_ThaiName     = rowData["FAMILY_THAINAME"].ToString();
            bankcard_data.Title_EngName       = rowData["TITLE_ENGNAME"].ToString();
            bankcard_data.First_EngName       = rowData["FIRST_ENGNAME"].ToString();
            bankcard_data.Family_EngName      = rowData["FAMILY_ENGNAME"].ToString();
            bankcard_data.DateOfBirth         = rowData["DATE_OF_BIRTH"].ToString();
            bankcard_data.Province_BirthTH    = rowData["PROVINCE_BIRTH_TH"].ToString();
            bankcard_data.Province_BirthOther = rowData["PROVINCE_BIRTH_OTHER"].ToString();
            bankcard_data.Nationality_Code    = rowData["NATIONALITY_CODE"].ToString();
            bankcard_data.Ethnicity_Code      = rowData["ETHNICITY_CODE"].ToString();
            bankcard_data.Religion_Code       = rowData["RELIGION_CODE"].ToString();
            bankcard_data.Blood_Code          = rowData["BLOOD_CODE"].ToString();
            bankcard_data.Height              = float.Parse(rowData["HEIGHT"].ToString());
            bankcard_data.Weight              = float.Parse(rowData["WEIGHT"].ToString());
            bankcard_data.Marital_Code        = rowData["MARITAL_CODE"].ToString();
            bankcard_data.Militaly_Code       = rowData["MILITARY_CODE"].ToString();
            bankcard_data.Disability          = rowData["DISABILITY"].ToString();
            bankcard_data.Home_Phone          = rowData["HOME_PHONE"].ToString();
            bankcard_data.Mobile_Number       = rowData["MOBILE_NUMBER"].ToString();
            bankcard_data.Email           = rowData["EMAIL"].ToString();
            bankcard_data.Talent          = rowData["TALENT"].ToString();
            bankcard_data.Home_Number     = rowData["HOME_NUMBER"].ToString();
            bankcard_data.Home_Village    = rowData["HOME_VILLAGE"].ToString();
            bankcard_data.Home_Moo        = Convert.ToInt32(rowData["HOME_MOO"].ToString());
            bankcard_data.Home_Soi        = rowData["HOME_SOI"].ToString();
            bankcard_data.Home_Road       = rowData["HOME_ROAD"].ToString();
            bankcard_data.Home_Tumbol     = rowData["HOME_TUMBOL"].ToString();
            bankcard_data.Home_Amphur     = rowData["HOME_AMPHUR"].ToString();
            bankcard_data.Home_Province   = rowData["HOME_PROVINCE"].ToString();
            bankcard_data.Home_PostCode   = rowData["HOME_POSTCODE"].ToString();
            bankcard_data.Home_Country    = rowData["HOME_COUNTRY"].ToString();
            bankcard_data.Home_AddressExt = rowData["HOME_ADDRESS_EXT"].ToString();

            bankcardData.Add(bankcard_data);
        }

        oracleObj.SelectCommand = "Select * From BANK_CARDSTUDENT,STUDENT,STUDENT_INFORMATION Where BANK_CARDSTUDENT.SUBMIT_DATE BETWEEN '" + startSubmitDate + "' And '" + endSubmitDate + "' And STUDENT.student_id=bank_cardstudent.student_id AND  STUDENT_INFORMATION.student_id = STUDENT.student_id  Order By BANK_CARDSTUDENT.SUBMIT_DATE DESC";
        DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData2)
        {
            BankCardData bankcard_data = new BankCardData();
            bankcard_data.StudentID = rowData["STUDENT_ID"].ToString();

            bankcard_data.Student_ID       = rowData["STUDENT_ID"].ToString();
            bankcard_data.Degree_Admission = rowData["DEGREE_ADMISSION_CODE"].ToString();
            bankcard_data.Faculty_Code     = rowData["FACULTY_CODE"].ToString();

            bankcard_data.DegreeAdmissionCode = rowData["DEGREE_ADMISSION_CODE"].ToString();
            bankcard_data.DegreeChar          = rowData["DEGREE_CHAR"].ToString();
            bankcard_data.FacultyCode         = rowData["FACULTY_CODE"].ToString();
            bankcard_data.SubmitDate          = rowData["SUBMIT_DATE"].ToString();
            bankcard_data.BankStaffCode       = rowData["BANK_STAFF_CODE"].ToString();

            bankcard_data.Curri_Code        = rowData["CURRI_CODE"].ToString();
            bankcard_data.Study_Year        = rowData["STUDY_YEAR"].ToString();
            bankcard_data.Plan_Code         = rowData["PLAN_CODE"].ToString();
            bankcard_data.Project_Code      = rowData["PROJECT_CODE"].ToString();
            bankcard_data.Campus_Code       = rowData["CAMPUS_CODE"].ToString();
            bankcard_data.Learning_Cen_Code = rowData["LEARNING_CEN_CODE"].ToString();
            //bankcard_data.Faculty_Code = rowData["FACULTY_CODE"].ToString();
            bankcard_data.Department_Code = rowData["DEPARTMENT_CODE"].ToString();
            bankcard_data.Major_Code      = rowData["MAJOR_CODE"].ToString();
            bankcard_data.Spec_Field_Code = rowData["SPEC_FIELD_CODE"].ToString();
            //bankcard_data.Segment_Code = rowData["SEGMENT_CODE"].ToString();
            //bankcard_data.Advisor_ID = rowData["ADVISOR_ID"].ToString();
            //bankcard_data.Section_Code = rowData["SECTION_CODE"].ToString();
            bankcard_data.Date_Admission     = rowData["DATE_ADMISSION"].ToString();
            bankcard_data.Semester_Admission = rowData["SEMESTER_ADMISSION"].ToString();
            bankcard_data.Year_Admission     = rowData["YEAR_ADMISSION"].ToString();
            //bankcard_data.Degree_Admission = rowData["DEGREE_ADMISSION_CODE"].ToString();
            bankcard_data.preDegree_Code        = rowData["PRE_DEGREE_CODE"].ToString();
            bankcard_data.preInstitution        = rowData["PRE_INSTITUTION"].ToString();
            bankcard_data.preAcademicYear       = rowData["PRE_ACADEMICYEAR"].ToString();
            bankcard_data.preGPA                = float.Parse(rowData["PRE_GPA"].ToString());
            bankcard_data.preQualification_Code = rowData["PRE_QUALIFICATION_CODE"].ToString();
            bankcard_data.preMojor_Code         = rowData["PRE_MOJOR_CODE"].ToString();
            bankcard_data.Std_Category_Code     = rowData["STD_CATEGORY_CODE"].ToString();
            bankcard_data.Std_Photo             = rowData["STD_PHOTO"].ToString();
            bankcard_data.Maintaining_Fee       = Convert.ToInt32(rowData["MAINTAINING_FEE"].ToString());
            bankcard_data.Cooperative           = rowData["COOPERATIVE_STATUS"].ToString();
            bankcard_data.Study_Status          = rowData["STUDY_STATUS"].ToString();
            bankcard_data.Student_Status        = rowData["STUDENT_STATUS"].ToString();
            bankcard_data.Term_Of_Status        = rowData["TERM_OF_STATUS"].ToString();
            bankcard_data.Scholarship_Status    = rowData["SCHOLARSHIP_STATUS"].ToString();

            bankcard_data.Nation_ID           = rowData["NATION_ID"].ToString();
            bankcard_data.NationCard_Expire   = rowData["NATIONCARD_EXPIRE"].ToString();
            bankcard_data.Passport_ID         = rowData["PASSPORT_ID"].ToString();
            bankcard_data.PassportCard_Expire = rowData["PASSPORTCARD_EXPIRE"].ToString();
            bankcard_data.Country_Code        = rowData["COUNTRY_CODE"].ToString();
            bankcard_data.Gender              = rowData["GENDER"].ToString();
            bankcard_data.Prefix_Code         = rowData["PREFIX_CODE"].ToString();
            bankcard_data.Title_ThaiName      = rowData["TITLE_THAINAME"].ToString();
            bankcard_data.First_ThaiName      = rowData["FIRST_THAINAME"].ToString();
            bankcard_data.Family_ThaiName     = rowData["FAMILY_THAINAME"].ToString();
            bankcard_data.Title_EngName       = rowData["TITLE_ENGNAME"].ToString();
            bankcard_data.First_EngName       = rowData["FIRST_ENGNAME"].ToString();
            bankcard_data.Family_EngName      = rowData["FAMILY_ENGNAME"].ToString();
            bankcard_data.DateOfBirth         = rowData["DATE_OF_BIRTH"].ToString();
            bankcard_data.Province_BirthTH    = rowData["PROVINCE_BIRTH_TH"].ToString();
            bankcard_data.Province_BirthOther = rowData["PROVINCE_BIRTH_OTHER"].ToString();
            bankcard_data.Nationality_Code    = rowData["NATIONALITY_CODE"].ToString();
            bankcard_data.Ethnicity_Code      = rowData["ETHNICITY_CODE"].ToString();
            bankcard_data.Religion_Code       = rowData["RELIGION_CODE"].ToString();
            bankcard_data.Blood_Code          = rowData["BLOOD_CODE"].ToString();
            bankcard_data.Height              = float.Parse(rowData["HEIGHT"].ToString());
            bankcard_data.Weight              = float.Parse(rowData["WEIGHT"].ToString());
            bankcard_data.Marital_Code        = rowData["MARITAL_CODE"].ToString();
            bankcard_data.Militaly_Code       = rowData["MILITARY_CODE"].ToString();
            bankcard_data.Disability          = rowData["DISABILITY"].ToString();
            bankcard_data.Home_Phone          = rowData["HOME_PHONE"].ToString();
            bankcard_data.Mobile_Number       = rowData["MOBILE_NUMBER"].ToString();
            bankcard_data.Email           = rowData["EMAIL"].ToString();
            bankcard_data.Talent          = rowData["TALENT"].ToString();
            bankcard_data.Home_Number     = rowData["HOME_NUMBER"].ToString();
            bankcard_data.Home_Village    = rowData["HOME_VILLAGE"].ToString();
            bankcard_data.Home_Moo        = Convert.ToInt32(rowData["HOME_MOO"].ToString());
            bankcard_data.Home_Soi        = rowData["HOME_SOI"].ToString();
            bankcard_data.Home_Road       = rowData["HOME_ROAD"].ToString();
            bankcard_data.Home_Tumbol     = rowData["HOME_TUMBOL"].ToString();
            bankcard_data.Home_Amphur     = rowData["HOME_AMPHUR"].ToString();
            bankcard_data.Home_Province   = rowData["HOME_PROVINCE"].ToString();
            bankcard_data.Home_PostCode   = rowData["HOME_POSTCODE"].ToString();
            bankcard_data.Home_Country    = rowData["HOME_COUNTRY"].ToString();
            bankcard_data.Home_AddressExt = rowData["HOME_ADDRESS_EXT"].ToString();

            bankcardData.Add(bankcard_data);
        }

        return(bankcardData);
    }
Exemplo n.º 57
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.º 58
0
    public string getDepartment(int advisor_Id)
    {
        string department = "-";
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
        SqlDataSource2.SelectCommand = "Select Dept_Name  From Advisor,Department Where Advisor.Dept_Id=Department.Dept_Id AND Employee_ID='" + advisor_Id + "'";

        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        if (table.Rows.Count > 0)
        { department = table.Rows[0][0].ToString(); }

        return department;
    }
Exemplo n.º 59
0
    protected void Register_Click(object sender, EventArgs e)
    {
        try
        {

            if (String.IsNullOrEmpty(email.Text) ||
               String.IsNullOrEmpty(username.Text) ||
               String.IsNullOrEmpty(password.Text) ||
               String.IsNullOrEmpty(passwordConfirm.Text)) { return; }
            else if (password.Text == passwordConfirm.Text)
            {
                if (!(Regex.IsMatch(email.Text, @"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$"))) //using Regex class to check if the input is an email
                {
                    Label1.Text = "Your email format is not right, Please check again!";
                }
                else if (!(Regex.IsMatch(Phone.Text, @"^[0-9]+")))
                {
                    Label1.Text = "Please enter a correct phone number!";
                }
                else
                {
                    String userName = Session["Username"].ToString();
                    SqlDataSource1.Update();
                    Server.Transfer("Default.aspx");
                }
            }
            else
                Label1.Text = "Error, the password is not same!";

        }
        catch (Exception ex)
        {

            if (String.IsNullOrEmpty(email.Text) ||
               String.IsNullOrEmpty(username.Text) ||
               String.IsNullOrEmpty(password.Text) ||
               String.IsNullOrEmpty(passwordConfirm.Text)) { return; }
            else if (password.Text == passwordConfirm.Text)
            {
                string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
                string selectString = "SELECT * FROM tb_Userinfo WHERE Username='******'";//select string for search currency name correspond with the input
                SqlDataSource dsrc = new SqlDataSource(conString, selectString);
                DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
                if (DV.Table.Rows.Count > 0)
                {
                    Label1.Text = "This username has already existed! Please try a new one";
                }

                else if (!(Regex.IsMatch(email.Text, @"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$"))) //using Regex class to check if the input is an email
                {
                    Label1.Text = "Your email format is not right, Please check again!";
                }
                else if (!(Regex.IsMatch(Phone.Text, @"^[0-9]+")))
                {
                    Label1.Text = "Please enter a correct phone number!";
                }
                else
                {
                    String a = DropDownListSQ.SelectedValue;
                    SqlDataSource1.Insert();

                    //int ID = (int) DV.Table.Rows[0][0];
                    //Console.Write(ID);
                    Session["RegisterName"] = username.Text.Trim();
                    username.Text = String.Empty;
                    email.Text = String.Empty;
                    password.Text = String.Empty;
                    passwordConfirm.Text = String.Empty;
                    Label1.Text = "Hi, " + Call.Text.Trim() + "! Register Succeed! Please login";
                    Response.Redirect("~/WebSite2/Login.aspx");
                }
            }
            else
                Label1.Text = "Error, the password is not same!";
        }
    }
Exemplo n.º 60
0
    public string getName(int advisor_Id)
    {
        string advisorNames = "-";
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();

        SqlDataSource2.SelectCommand = "Select (Last_Name+', ' + First_Name) As Name From Advisor Where Employee_ID='" + advisor_Id + "'";
        DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataTable table = view.ToTable();

        if (table.Rows.Count > 0)
        { advisorNames = table.Rows[0][0].ToString(); }
        return advisorNames;
    }