Пример #1
0
 public static List<Control> GetControlsInPlaceHolder(string placeHolderName,MasterPage master)
 {
     List<Control> controls = new List<Control>();
     ContentPlaceHolder contentPlaceHolder = new ContentPlaceHolder();
     contentPlaceHolder = (ContentPlaceHolder)master.FindControl(placeHolderName);
     if (contentPlaceHolder != null)
     {
         foreach (Control control in contentPlaceHolder.Controls)
         {
             controls.Add(control);
         }
         return controls;
     }
         return null;
 }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        mpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("projectPlaceHolder");

        if(Request.QueryString["id"] != null)
        {
            if(Request.QueryString["id"] == "addUser")
            {
                addUserForm();
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "Func(true)", true);
            }
            else if (Request.QueryString["id"] == "AddUserToProject")
            {
                addUserToProjectForm();
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "Func(true)", true);
            }

        }
    }
Пример #3
0
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        for (int i = 1; i <= Request.Files.Count; i++)
        {
            FileUpload         myFL = new FileUpload();
            ContentPlaceHolder c    = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
            myFL = (FileUpload)c.FindControl("FileUpload" + i);
            //myFL = (FileUpload)Page.FindControl("FileUpload" + i);
            if (myFL.PostedFile.ContentLength < 15360000)
            //if (myFL.PostedFile.ContentLength < 30720000)
            {
                if ((myFL.PostedFile != null) && (myFL.PostedFile.ContentLength > 0))
                {
                    string fn = System.IO.Path.GetFileName(myFL.PostedFile.FileName);
                    // string SaveLocation = Server.MapPath("../") + "\\upload_file\\" + fn;
                    string SaveLocation = Server.MapPath("FileList/") + fn;

                    Session["file_path"] = "FileList/" + fn;
                    int    file_size = myFL.PostedFile.ContentLength;
                    string file_type = myFL.PostedFile.ContentType;
                    try
                    {
                        myFL.PostedFile.SaveAs(SaveLocation);

                        //OleDbConnection myConnection = new OleDbConnection(ConfigurationSettings.AppSettings["dsnn"]);

                        //string strClientIP;

                        string strClientIP = Request.ServerVariables["remote_host"].ToString();

                        string sql_insert = " insert into board                                                                                                    " +
                                            "   (fab, publisher, subject, begin_time, end_time, content, update_time, file_name, org_file_name)                    " +
                                            " values                                                                                                               " +
                                            "   ('" + DropDownList1.SelectedValue + "', '" + TextBox_publish.Text + "', '" + TextBox_subject.Text + "',  to_date('" + txtEstimateStartDate.SelectedDate.Value.ToString("yyyy/MM/dd") + "','YYYY/MM/DD')" + ",to_date('" + txtEstimateEndDate.SelectedDate.Value.ToString("yyyy/MM/dd") + "','YYYY/MM/DD')" + ",'" + TextBox_content.Text + "', sysdate, '" + Session["file_path"].ToString() + "', '" + fn.ToString() + "')  ";
                        func.get_sql_execute(sql_insert, conn);


                        //myLabel.Append("<hr>檔名---- " + fn);

                        Label2.Text = "上傳成功";

                        if (CheckBox1.Checked && CheckBox2.Checked)
                        {
                            call_mail("T1+T2");
                        }
                        else
                        {
                            if (CheckBox1.Checked)
                            {
                                call_mail("T1");
                            }

                            if (CheckBox2.Checked)
                            {
                                call_mail("T2");
                            }
                        }

                        Response.Write("<script language='javascript' type='text/JavaScript'>\n");
                        Response.Write("alert('新增成功!!');\n");
                        Response.Write("location = 'top.aspx';\n");
                        //Response.Write("window.opener.location = window.opener.location;\n");
                        //Response.Write("opener.document.location.reload();\n");
                        Response.Write("window.opener=null; window.close();\n");
                        Response.Write("</script>");
                    }
                    catch (Exception Ex)
                    {
                        Response.Write("上傳檔案失敗");
                    }
                }
                else
                {
                    string sql_insert1 = " insert into board                                                                                                    " +
                                         "   (fab, publisher, subject, begin_time, end_time, content, update_time, file_name, org_file_name)                    " +
                                         " values                                                                                                               " +
                                         "   ('" + DropDownList1.SelectedValue + "', '" + TextBox_publish.Text + "', '" + TextBox_subject.Text + "',  to_date('" + txtEstimateStartDate.SelectedDate.Value.ToString("yyyy/MM/dd") + "','YYYY/MM/DD')" + ",to_date('" + txtEstimateEndDate.SelectedDate.Value.ToString("yyyy/MM/dd") + "','YYYY/MM/DD')" + ",'" + TextBox_content.Text + "', sysdate, '', '')  ";
                    func.get_sql_execute(sql_insert1, conn);


                    //myLabel.Append("<hr>瑼?--- " + fn);

                    //Label2.Text = "銝撜緪";

                    if (CheckBox1.Checked && CheckBox2.Checked)
                    {
                        call_mail("T1+T2");
                    }
                    else
                    {
                        if (CheckBox1.Checked)
                        {
                            call_mail("T1");
                        }

                        if (CheckBox2.Checked)
                        {
                            call_mail("T2");
                        }
                    }

                    Response.Write("<script language='javascript' type='text/JavaScript'>\n");
                    Response.Write("alert('新增成功!!');\n");
                    Response.Write("location = 'top.aspx';\n");
                    //Response.Write("window.opener.location = window.opener.location;\n");
                    //Response.Write("opener.document.location.reload();\n");
                    Response.Write("window.opener=null; window.close();\n");
                    Response.Write("</script>");
                }
            }

            else
            {
                Label3.Visible = true;
                Label3.Text    = "上傳檔案超過15MB...";
            }
        }
    }
    protected override void LoadControls()
    {
        // Outer master Page
        Outer_CP = (ContentPlaceHolder)_page.Form.FindControl("ContentPlaceHolder1");

        // Inner Master Page
        Inner_CP = (ContentPlaceHolder)Outer_CP.FindControl("ContentPlaceHolder1_Menu");
    }
Пример #5
0
        protected void btnReservation_Click(object sender, EventArgs e)
        {
            int index = 2;

            int indexone = 5;

            int indextwo = 8;

            string txtroomone = string.Format("ctl00$ContentPlaceHolder1$Guest{0}", index);

            string txtroomtwo = string.Format("ctl00$ContentPlaceHolder1$Guest{0}", indexone);

            string txtroomthree = string.Format("ctl00$ContentPlaceHolder1$Guest{0}", indextwo);

            string roomOne = Request.Form[txtroomone];

            string roomTwo = Request.Form[txtroomtwo];

            string roomThree = Request.Form[txtroomthree];

            int persons = Convert.ToInt32(ddltotalperson.SelectedValue);


            if (persons >= 4 && persons < 7)
            {
                if (ddlGuestNumber.SelectedValue == roomOne)
                {
                    Response.Write("<script>alert('The selected room quota is full. Please select an empty room!');</script>");


                    return;
                }
            }
            else if (persons >= 7 && persons < 10)
            {
                if (ddlGuestNumber.SelectedValue == roomOne || ddlGuestNumber.SelectedValue == roomTwo || roomOne == roomTwo)
                {
                    Response.Write("<script>alert('The selected room quota is full. Please select an empty room!');</script>");

                    return;
                }
            }

            else if (persons == 10)
            {
                if (ddlGuestNumber.SelectedValue == roomOne || ddlGuestNumber.SelectedValue == roomTwo || ddlGuestNumber.SelectedValue == roomThree || roomOne == roomThree || roomOne == roomTwo || roomTwo == roomThree)
                {
                    Response.Write("<script>alert('The selected room quota is full. Please select an empty room!');</script>");

                    return;
                }
            }

            Rooms ddlroom = _roommanagement.GetById(Convert.ToInt32(ddlGuestNumber.SelectedValue));

            ICollection <ReservationCustomerRoom> resCusRoom = null;

            resCusRoom = ddlroom.ReservationCustomerRoom.ToList();

            #region Reservations

            Reservations res;

            #endregion


            DateTime customerentrydate;

            DateTime customeroutdate;

            DateTime todaydate = DateTime.Now.Date;

            List <int> roomSelectList = new List <int>();


            ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");

            foreach (Control ctrl in contentPlaceHolder.Controls)
            {
                if (ctrl is DropDownList)
                {
                    if (((DropDownList)ctrl).ID.ToString().Contains("Guest"))
                    {
                        roomSelectList.Add(Convert.ToInt32(((DropDownList)ctrl).SelectedItem.Value));
                    }
                }
            }

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

            foreach (var item in roomSelectList)
            {
                foreach (var rescusroom in _reservationroomcustomermanagement.GetReservationCustomerRoom(item).Select(x => new { x.Reservation, x.ReservationID }).Distinct())
                {
                    entryoutlist.Add("The room you want to make a reservation is closed " + rescusroom.Reservation.DateOfEntry.ToString() + "between " + rescusroom.Reservation.DateOfOut.ToString());
                }
            }

            if (resCusRoom.Count == 0)
            {
                customerentrydate = DateTime.Parse(chkindate.Text);

                customeroutdate = DateTime.Parse(chkoutdate.Text);

                int result5 = DateTime.Compare(customerentrydate, todaydate);

                int result6 = DateTime.Compare(customeroutdate, todaydate);


                if (result5 >= 0 && result6 >= 0)
                {
                    MakeReservation();

                    return;
                }

                //metod başı


                else
                {
                    Response.Write("<script>alert('Selected dates are not eligible for reservation. Please try again');</script>");

                    return;
                }

                //metod sonu
            }


            bool     control     = false;
            DateTime dbentrydate = DateTime.Now;
            DateTime dboutdate   = DateTime.Now;


            foreach (var item in resCusRoom)
            {
                res = item.Reservation;

                dbentrydate = res.DateOfEntry;

                dboutdate = res.DateOfOut;

                customerentrydate = DateTime.Parse(chkindate.Text);

                customeroutdate = DateTime.Parse(chkoutdate.Text);



                int result = DateTime.Compare(customerentrydate, dbentrydate);

                int result2 = DateTime.Compare(customeroutdate, dbentrydate);

                int result3 = DateTime.Compare(customerentrydate, dboutdate);

                int result4 = DateTime.Compare(customeroutdate, customerentrydate);

                int result5 = DateTime.Compare(customerentrydate, todaydate);

                int result6 = DateTime.Compare(customeroutdate, todaydate);

                if (result5 < 0 && result6 < 0)
                {
                    Response.Write("<script>alert('Selected dates are not eligible for reservation. Please try again');</script>");

                    return;
                }


                if (!((result < 0 && result2 < 0 && result != 0 && result2 != 0) || (result3 > 0 && result4 > 0 && result3 != 0 && result4 != 0)))
                {
                    control = true;
                }
            }
            if (control)
            {
                entryoutlist.Add("The Selected Rooms are listed on this list. Please select the appropriate date range!");

                grdEntryOutList.DataSource = entryoutlist;

                grdEntryOutList.DataBind();

                btnReservation.Focus();
            }
            else
            {
                //metod başı
                MakeReservation();
                // metod sonu
            }
        }
Пример #6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (DropDownList_ENGINEER.Text.Equals("請選擇"))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請選擇 值班工程師!!!');");
            Response.Write("</script>");
            return;
        }



        if (DropDownList1_FAB.Text.Equals("請選擇"))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請選擇 FAB!!!');");
            Response.Write("</script>");
            return;
        }

        if (DropDownList_SYSTEM.SelectedValue.Equals("請選擇"))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請選擇 SYSTEM!!!');");
            Response.Write("</script>");
            return;
        }

        if (DropDownList_TYPE.SelectedValue.Equals("請選擇"))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請選擇 TYPE!!! ');");
            Response.Write("</script>");
            return;
        }
        if (DropDownList_PRODUCT_IMPACT.SelectedValue.Equals("請選擇"))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請輸入 生產影響!!! ');");
            Response.Write("</script>");
            return;
        }

        if (TextBox_PRODUCT_IMPACT_INFO.Text.Equals(""))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請輸入 生產影響敘述!!!');");
            Response.Write("</script>");
            return;
        }

        if (TextBox_QUESTION.Text.Equals(""))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請輸入 來電問題!!!');");
            Response.Write("</script>");
            return;
        }

        if (DropDownList_BY_WHOM.SelectedValue.Equals("請選擇"))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請選擇 處理者!!!');");
            Response.Write("</script>");
            return;
        }
        if (TextBox_DESCRIPTION.Text.Equals(""))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請輸入 異常描述!!!');");
            Response.Write("</script>");
            return;
        }

        if (TextBox_REASON.Text.Equals(""))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請輸入 異常原因!!!');");
            Response.Write("</script>");
            return;
        }

        if (TextBox_METHOD.Text.Equals(""))
        {
            Response.Write("<script language='javascript'>" + "\n");
            Response.Write("alert('請輸入 排除方法!!!');");
            Response.Write("</script>");
            return;
        }



        string sql_max_sn = " select max(t.seq)as seq  from onduty t ";

        dsTemp1 = func.get_dataSet_access(sql_max_sn, conn);

        Int32 max_sn = Convert.ToInt32(dsTemp1.Tables[0].Rows[0]["seq"]);

        max_sn++;

        sql = " insert into onduty        " +
              "   (seq,                   " +
              "    calltime,              " +
              "    endtime,               " +
              "    caller,                " +
              "    extension,             " +
              "    engineer,              " +
              "    fab,                   " +
              "    system,                " +
              "    offday,                " +
              "    type,                  " +
              "    cassette,              " +
              "    lot_id,                " +
              "    eq_id,                 " +
              "    question,              " +
              "    bywhom,                " +
              "    description,           " +
              "    insert_time,           " +
              "    close_flag,            " +
              "    mobile,                " +
              "    area,                  " +
              "    starttime,             " +
              "    reason,                " +
              "    method,                " +
              "    assign_owner,          " +
              "    additional_info,       " +
              "    ars_flag,              " +
              "    ars_link,              " +
              "    due_time,              " +
              "    alarm_flag,            " +
              "    product_impact,        " +
              "    org_flag,              " +
              "    product_impact_info,   " +
              "    finaltime,             " +
              "    recharge_flag,         " +
              "    modify_count)          " +
              " values                    " +
              "   (onduty_seq.nextval,                 " +
              "to_date('" + txtEstimateCALLTIME.SelectedDate.Value.ToString("yyyy/MM/dd") + " " + DropDownList1.SelectedValue + ":" + DropDownList2.SelectedValue + "','YYYY/MM/DD HH24:MI'),     " +
              "        to_date('" + txtEstimateEndTime.SelectedDate.Value.ToString("yyyy/MM/dd") + " " + DropDownList5.SelectedValue + ":" + DropDownList6.SelectedValue + "','YYYY/MM/DD HH24:MI'),     " +
              "       '" + TextBox_CALLER.Text.Trim().Replace("'", "''") + "',                           " +
              "        '" + TextBox_EXTENTION.Text.Trim().Replace("'", "''") + "',                     " +
              "        '" + DropDownList_ENGINEER.SelectedValue + "',                       " +
              "      '" + DropDownList1_FAB.SelectedValue + "',                                 " +
              "        '" + DropDownList_SYSTEM.SelectedValue + "',                           " +
              "        '" + RadioButtonList_OFFDAY.SelectedValue + "',                           " +
              "       '" + DropDownList_TYPE.SelectedValue + "',                               " +
              "        '" + TextBox_CASSETTE.Text.Trim().Replace("'", "''") + "',                       " +
              "        '" + TextBox_LOT_ID.Text.Trim().Replace("'", "''") + "',                           " +
              "         '" + TextBox_EQ_ID.Text.Trim().Replace("'", "''") + "',                             " +
              "         '" + TextBox_QUESTION.Text.Trim().Replace("'", "''") + "',                       " +
              "         '" + DropDownList_BY_WHOM.SelectedValue + "',                           " +
              "       '" + TextBox_DESCRIPTION.Text.Trim().Replace("'", "''") + "',                 " +
              "    sysdate,         " +
              "   '" + RadioButtonList_CLOSE_FLAG.SelectedValue + "',                   " +
              "       '" + TextBox_MOBILE.Text.Trim().Replace("'", "''") + "',                           " +
              "      '" + DropDownList_AREA.Text + "',                               " +
              "        to_date('" + txtEstimateSTARTTIME.SelectedDate.Value.ToString("yyyy/MM/dd") + " " + DropDownList3.SelectedValue + ":" + DropDownList4.SelectedValue + "','YYYY/MM/DD HH24:MI'),     " +
              "      '" + TextBox_REASON.Text.Trim().Replace("'", "''") + "',                           " +
              "      '" + TextBox_METHOD.Text.Trim().Replace("'", "''") + "',                           " +
              "      '" + DropDownList_ASSIGN_OWNER.SelectedValue + "',               " +
              "    '" + TextBox_ADDITION_INFO.Text.Trim().Replace("'", "''") + "',         " +
              "     '" + RadioButtonList_ARS_FLAG.SelectedValue + "',                       " +
              "       '" + TextBox_ARS_LINK.Text.Trim().Replace("'", "''") + "',                       " +
              "       round((to_date('" + txtEstimateEndTime.SelectedDate.Value.ToString("yyyy/MM/dd") + " " + DropDownList5.SelectedValue + ":" + DropDownList6.SelectedValue + "','YYYY/MM/DD HH24:MI')-" + "to_date('" + txtEstimateSTARTTIME.SelectedDate.Value.ToString("yyyy/MM/dd") + " " + DropDownList3.SelectedValue + ":" + DropDownList4.SelectedValue + "','YYYY/MM/DD HH24:MI') )*24*60,0) ," +
              "      '" + RadioButtonList_ALARM_FLAG.SelectedValue + "',                   " +
              "     '" + DropDownList_PRODUCT_IMPACT.SelectedValue + "',           " +
              "    '" + RadioButtonList_CLOSE_FLAG.SelectedValue + "',            " +
              "       '" + TextBox_PRODUCT_IMPACT_INFO.Text.Trim().Replace("'", "''") + "', " +
              "    sysdate,           " +
              " '" + RadioButtonList1.SelectedValue + "',             " +
              "    0)        ";

        func.get_sql_execute(sql, conn);

        if (!DropDownList_ASSIGN_OWNER.SelectedValue.Equals("請選擇"))
        {
            call_mail(max_sn.ToString(), DropDownList_ASSIGN_OWNER.SelectedValue);
        }


        #region Add UploadFile


        NetworkDrive oNetDrive1 = new NetworkDrive();
        oNetDrive1.LocalDrive      = "M:";
        oNetDrive1.Persistent      = true;
        oNetDrive1.SaveCredentials = true;
        oNetDrive1.ShareName       = @"\\172.16.12.62\ams";

        try
        {
            oNetDrive1.MapDrive(@"T1FAB\t1eda", "CIMabc123");



            for (int i = 1; i <= Request.Files.Count; i++)
            {
                FileUpload         myFL = new FileUpload();
                ContentPlaceHolder c    = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
                myFL = (FileUpload)c.FindControl("FileUpload" + i);
                //myFL = (FileUpload)Page.FindControl("FileUpload" + i);
                if (myFL.PostedFile.ContentLength < 15360000)
                {
                    if ((myFL.PostedFile != null) && (myFL.PostedFile.ContentLength > 0))
                    {
                        string fn = System.IO.Path.GetFileName(myFL.PostedFile.FileName);
                        // string saveLocation = Server.MapPath("../") + "\\upload_file\\" + fn;
                        //string saveLocation = Server.MapPath("FileList/") + fn;
                        string saveLocation = oNetDrive1.LocalDrive + @"\" + fn;


                        //Session["file_path"] = "FileList/" + fn;
                        int    file_size = myFL.PostedFile.ContentLength;
                        string file_type = myFL.PostedFile.ContentType;
                        try
                        {
                            myFL.PostedFile.SaveAs(saveLocation);

                            //OleDbConnection myConnection = new OleDbConnection(ConfigurationSettings.AppSettings["dsnn"]);

                            //string strClientIP;

                            string strClientIP = Request.ServerVariables["remote_host"].ToString();

                            string sql_insert = @"insert into onduty_file
                                             (seq, file_name, dttm)
                                             values
                                            ('{0}', '{1}', sysdate)";

                            FileHandle cfilehandle = new FileHandle();
                            cfilehandle.GetMaxSeq();
                            //cfilehandle.Seq = Session["seq"].ToString();
                            sql_insert = string.Format(sql_insert, cfilehandle.Seq, fn);

                            func.get_sql_execute(sql_insert, conn);
                        }
                        catch (Exception ex)
                        {
                            Response.Write("上傳檔案失敗");
                        }
                    }
                }

                else
                {
                    //Label3.Visible = true;
                    //Label3.Text = "上傳檔案超過15MB...";
                }
            }
            // Parser_tmp_directory_file(oNetDrive.LocalDrive + "\\T1\\" + DropDownList1.SelectedValue.ToString() + "\\EDANG\\", "*.TXT", -360);
            // Delete_tmp_directory_file(HttpContext.Current.Server.MapPath(".") + "\\File\\", "*", -3);


            oNetDrive1.UnMapDrive(oNetDrive1.LocalDrive, true);
        }
        catch (Exception)
        {
            oNetDrive1.UnMapDrive(oNetDrive1.LocalDrive, true);
        }
        finally
        {
            //oNetDrive.UnMapDrive();
        }


        //oNetDrive.MapDrive(@"T1FAB\t1eda", "CIMabc123");

        #endregion
        Response.Write("<script language='javascript' type='text/JavaScript'>\n");
        Response.Write("alert('新增成功!!');\n");
        Response.Write("location = 'onduty_query.aspx';\n");
        //Response.Write("setTimeout(\"window.opener=null; window.close();\",null)");
        Response.Write("</script>");
        //Response.Write("<script language=\"javascript\">setTimeout(\"window.opener=null; window.close();\",null)</script>");

        //Response.Redirect("onduty_add.aspx");

        //Page_Load(null, null);
    }
Пример #7
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            int gleader;

            if (!Global.currentUserIsTeamLeader(out gleader))
            {
                Server.Transfer("/Default.aspx");
            }

            // We create the table in the LoadComplete event so that the file upload event has been processed before
            ContentPlaceHolder cnt = this.Master.FindControl("FeaturedContent") as ContentPlaceHolder;

            // Get group name
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "SELECT groupName FROM clubGroup WHERE idClubGroup = " + gleader.ToString() + "; ";
            SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCXCLConnection"].ConnectionString);

            cmd.Connection = cnx;
            cnx.Open();
            SqlDataReader rdr = cmd.ExecuteReader();

            if (!rdr.Read())
            {
                lblTitre.Text = "Erreur!";
            }
            else
            {
                lblTitre.Text = "Réservations pour: " + rdr.GetString(0);
            }
            rdr.Close();
            // Check if there are bookings
            cmd.CommandText = "SELECT idBooking, moment, courtName FROM ((Users INNER JOIN booking ON fkMadeBy = UserId) INNER JOIN court ON fkCourt = idCourt)  " +
                              "WHERE Username = '******'; ";
            rdr = cmd.ExecuteReader();
            if (!rdr.Read())
            {
                Label lbl = new Label();
                lbl.Text      = "Aucune";
                lbl.Font.Size = FontUnit.XLarge;
                cnt.Controls.Add(lbl);
            }
            else // There are bookings to display in a table
            {
                Table tbl = new Table();
                // Build header
                TableHeaderRow tbhr  = new TableHeaderRow();
                string[]       htext = { "Jour", "Date", "Court", "Heure" };
                foreach (string hdr in htext)
                {
                    TableHeaderCell tbhc = new TableHeaderCell();
                    tbhc.Text        = hdr;
                    tbhc.BorderWidth = 3;
                    tbhc.BorderStyle = BorderStyle.Solid;
                    tbhc.Style.Add("padding-left", "3px");
                    tbhc.Style.Add("padding-right", "3px");
                    tbhr.Cells.Add(tbhc);
                }
                tbl.Rows.Add(tbhr);

                // Build content
                do
                {
                    TableRow tbr    = new TableRow();
                    DateTime moment = rdr.GetDateTime(1);
                    string[] vals   = new string[4];
                    vals[0] = DateTimeFormatInfo.CurrentInfo.GetDayName(moment.DayOfWeek);
                    vals[1] = moment.ToString("dd MMMM yyyy");
                    vals[2] = rdr.GetString(2);
                    vals[3] = moment.Hour.ToString() + "h";
                    foreach (string cv in vals)
                    {
                        TableCell tbc = new TableCell();
                        tbc.Text        = cv;
                        tbc.BorderWidth = 1;
                        tbc.BorderStyle = BorderStyle.Solid;
                        tbc.Style.Add("padding-left", "3px");
                        tbc.Style.Add("padding-right", "3px");
                        tbr.Cells.Add(tbc);
                    }
                    tbl.Rows.Add(tbr);
                } while (rdr.Read());
                cnt.Controls.Add(tbl); // Insert the table between the title and de file upload
            }
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserSession"] != null)
            {
                try
                {
                    SqlConnection conn_users = new SqlConnection(
                        ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
                    conn_users.Open();

                    string     checkUser = "******" + Session["UserSession"].ToString() + "'";
                    SqlCommand command   = new SqlCommand(checkUser, conn_users);
                    int        tmp       = Convert.ToInt16(command.ExecuteScalar().ToString());
                    conn_users.Close();

                    if (tmp == 1)
                    {
                        conn_users.Open();
                        string getUserName = "******" + Session["UserSession"].ToString() + "'";
                        string getRole     = "select UserRoles.Name from UserRoles join Users on UserRoles.Id=Users.ID where Users.UserName='******'";

                        SqlCommand uname_comm = new SqlCommand(getUserName, conn_users);
                        SqlCommand role_comm  = new SqlCommand(getRole, conn_users);

                        //wprowadź nazwę użytkownika z bazy
                        LabelUsername.Text = uname_comm.ExecuteScalar().ToString();
                        login = LabelUsername.Text;

                        //decyzje po badaniach
                        datasource = new SqlDataSource();
                        datasource.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                        datasource.SelectCommand    = "select KP.IdPacjenta, D.IdBadania, D.DopuszczenieDoPracy, D.Komentarz from DecyzjePoBadaniu AS D JOIN KolejkaPacjentow AS KP ON D.IdBadania=KP.Id";
                        dopuszczenia              = new GridView();
                        dopuszczenia.DataSource   = null;
                        dopuszczenia.DataSource   = datasource;
                        dopuszczenia.AllowPaging  = true;
                        dopuszczenia.AllowSorting = true;

                        //elementy menu użytkownika
                        liBeg  = new LiteralControl("<li>");
                        liEnd  = new LiteralControl("</li>");
                        ctMenu = new ContentPlaceHolder();
                        ctMenu = (ContentPlaceHolder)Master.FindControl("TrescMenu");

                        //wprowadź nazwę użytkownika z bazy
                        if (role_comm.ExecuteScalar() != null)
                        {
                            rola = role_comm.ExecuteScalar().ToString();

                            //strony dla bhp-owców i lekarzy
                            //badania okresowe
                            BadaniaOkresowe             = new HyperLink();
                            BadaniaOkresowe.Text        = "Lista badań okresowych";
                            BadaniaOkresowe.NavigateUrl = "PeriodicTests.aspx";
                            //pracownicy
                            ListaPracownikow             = new HyperLink();
                            ListaPracownikow.Text        = "Lista pracowników";
                            ListaPracownikow.NavigateUrl = "WorkersList.aspx";
                            //przebadani pracownicy
                            BadaniaPracownikow             = new HyperLink();
                            BadaniaPracownikow.Text        = "Pracownicy do badania";
                            BadaniaPracownikow.NavigateUrl = "PatientsInQueue.aspx";

                            UstawStroneUzytkownika(rola);
                        }
                        else
                        {
                            rola = "Nie przydzielona";
                            UstawStroneUzytkownika(rola);
                        }

                        conn_users.Close();
                    }
                }
                catch (Exception ex)
                {
                    Response.Write(ex.ToString());
                }

                LabelUsername.Text = String.Format("Jesteś zalogowany jako {0}.", Session["UserSession"].ToString());
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
Пример #9
0
        private static void ApplyValidations(ref Control oControl, ref ContentPlaceHolder oParentControl, UIControl oUIControl)
        {
            if (oControl != null)
            {
                System.Type oControlType = oControl.GetType();

                switch (oControlType.Name.ToUpper())
                {
                case "TEXTBOX":
                    TextBox tb = (TextBox)oControl;
                    tb.ToolTip = oUIControl.ToolTipText;

                    //Required field validator
                    if (oUIControl.ValidationRequired == 1)
                    {
                        if (oParentControl.FindControl("rfv" + oUIControl.ControlName) == null)
                        {
                            RequiredFieldValidator oRFV = new RequiredFieldValidator();
                            oRFV.ID = "rfv" + oUIControl.ControlName;
                            oRFV.ControlToValidate = oUIControl.ControlName;
                            oRFV.Display           = ValidatorDisplay.None;

                            if (oUIControl.ValidationMsg != "")
                            {
                                oRFV.ErrorMessage = oUIControl.ValidationMsg;
                            }
                            else
                            {
                                oRFV.ErrorMessage = oUIControl.ShortName + " : " + "Please enter " + oUIControl.LabelText;
                            }

                            oParentControl.Controls.Add(oRFV);
                            oRFV.SetFocusOnError = true;
                        }
                    }
                    //Regular Expression Validation (if not exists add  OR if exists not required remove)
                    if (oUIControl.ValidationRegularExp != null && oUIControl.ValidationRegularExp.RegularExpId > 0)
                    {
                        if (oParentControl.FindControl("rev" + oUIControl.ControlName) == null)
                        {
                            RegularExpressionValidator oREV = new RegularExpressionValidator();
                            oREV.ID = "rev" + oUIControl.ControlName;
                            oREV.ControlToValidate    = oUIControl.ControlName;
                            oREV.ValidationExpression = oUIControl.ValidationRegularExp.RegularExp;
                            oREV.Display = ValidatorDisplay.None;

                            oREV.ErrorMessage = oUIControl.ShortName + " : " + oUIControl.ValidationRegularExp.DefaultMsg;

                            oParentControl.Controls.Add(oREV);
                            oREV.SetFocusOnError = true;
                        }
                    }
                    //Range Validation
                    if (oUIControl.ValidationRangeFrom != "" && oUIControl.ValidationRangeTo != "")
                    {
                        if (oParentControl.FindControl("rv" + oUIControl.ControlName) == null)
                        {
                            RangeValidator oRV = new RangeValidator();
                            oRV.ID = "rv" + oUIControl.ControlName;
                            oRV.ControlToValidate = oUIControl.ControlName;
                            oRV.MinimumValue      = oUIControl.ValidationRangeFrom.ToString();
                            oRV.MaximumValue      = oUIControl.ValidationRangeTo.ToString();
                            if (oUIControl.ControlDataType.DataTypeId == 1)     //String
                            {
                                oRV.Type = ValidationDataType.String;
                            }
                            else if (oUIControl.ControlDataType.DataTypeId == 2)     //Integer
                            {
                                oRV.Type = ValidationDataType.Integer;
                            }
                            else if (oUIControl.ControlDataType.DataTypeId == 3)    //Double
                            {
                                oRV.Type = ValidationDataType.Double;
                            }
                            else if (oUIControl.ControlDataType.DataTypeId == 4)    //Currency
                            {
                                oRV.Type = ValidationDataType.Currency;
                            }
                            else if (oUIControl.ControlDataType.DataTypeId == 5)    //Date
                            {
                                oRV.Type = ValidationDataType.Date;
                            }

                            oRV.Display = ValidatorDisplay.None;

                            oRV.ErrorMessage = oUIControl.ShortName + " : " + "Please enter " + oUIControl.ShortName + " value from " + oUIControl.ValidationRangeFrom.ToString() + " to " + oUIControl.ValidationRangeTo.ToString();

                            oParentControl.Controls.Add(oRV);
                            oRV.SetFocusOnError = true;
                        }
                    }
                    //Length Validation
                    if (oUIControl.ValidationMinLen > 0 && oUIControl.ValidationMinLen > 0)
                    {
                        if (oParentControl.FindControl("revlen" + oUIControl.ControlName) == null)
                        {
                            RegularExpressionValidator oREV = new RegularExpressionValidator();
                            oREV.ID = "revlen" + oUIControl.ControlName;
                            oREV.ControlToValidate    = oUIControl.ControlName;
                            oREV.ValidationExpression = "^.{" + oUIControl.ValidationMinLen + "," + oUIControl.ValidationMaxLen + "}$";
                            oREV.Display      = ValidatorDisplay.None;
                            oREV.ErrorMessage = oUIControl.ShortName + " : " + "It must be between " + oUIControl.ValidationMinLen.ToString() + " and " + oUIControl.ValidationMaxLen.ToString() + " characters";
                            oParentControl.Controls.Add(oREV);
                            oREV.SetFocusOnError = true;
                        }
                    }

                    //Client Valdiation Using Client Side Validation
                    if (oUIControl.ValidationCustomClientSideFunction != "")
                    {
                        if (oParentControl.FindControl("customValClientSide" + oUIControl.ControlName) == null)
                        {
                            CustomValidator ocustomValClientSide = new CustomValidator();
                            ocustomValClientSide.ID = "customValClientSide" + oUIControl.ControlName;
                            ocustomValClientSide.ControlToValidate        = oUIControl.ControlName;
                            ocustomValClientSide.ClientValidationFunction = oUIControl.ValidationCustomClientSideFunction;
                            ocustomValClientSide.Display      = ValidatorDisplay.None;
                            ocustomValClientSide.ErrorMessage = oUIControl.ShortName + " : " + oUIControl.ValidationMsg;
                            oParentControl.Controls.Add(ocustomValClientSide);
                            ocustomValClientSide.SetFocusOnError = true;
                        }
                    }

                    ////Custom Valdiation Using Server Side Validation -Not working for onServerValidate
                    //if (oUIControl.ValidationCustomServerSideFunction != "")
                    //{
                    //    if (oParentControl.FindControl("customValServerSide" + oUIControl.ControlName) == null)
                    //    {
                    //        CustomValidator ocustomValServerSide = new CustomValidator();
                    //        ocustomValServerSide.ID = "customValServerSide" + oUIControl.ControlName;
                    //        ocustomValServerSide.ControlToValidate = oUIControl.ControlName;
                    //        ocustomValServerSide.onServerValidate = oUIControl.ValidationCustomServerSideFunction;
                    //        ocustomValServerSide.Display = ValidatorDisplay.None;
                    //        ocustomValServerSide.ErrorMessage = oUIControl.ShortName + " : " + oUIControl.ValidationMsg;
                    //        oParentControl.Controls.Add(ocustomValServerSide);
                    //        ocustomValServerSide.SetFocusOnError = true;
                    //    }
                    //}

                    //Compare Validation
                    if (oUIControl.ValidationCompareControl != "")
                    {
                        if (oParentControl.FindControl("compVal" + oUIControl.ControlName) == null)
                        {
                            CompareValidator oCompareValidator = new CompareValidator();
                            oCompareValidator.ID = "compVal" + oUIControl.ControlName;
                            oCompareValidator.ControlToValidate = oUIControl.ControlName;
                            oCompareValidator.ControlToCompare  = oUIControl.ValidationCompareControl;
                            oCompareValidator.Display           = ValidatorDisplay.None;
                            oCompareValidator.ErrorMessage      = oUIControl.ShortName + " : " + oUIControl.ValidationMsg;
                            oParentControl.Controls.Add(oCompareValidator);
                            oCompareValidator.SetFocusOnError = true;
                        }
                    }

                    break;

                case "DROPDOWNLIST":
                    DropDownList ddl = (DropDownList)oControl;
                    ddl.ToolTip = oUIControl.ToolTipText;
                    if (oUIControl.ValidationRequired == 1)
                    {
                        if (oParentControl.FindControl("rfv" + oUIControl.ControlName) == null)
                        {
                            RequiredFieldValidator oRFV = new RequiredFieldValidator();
                            oRFV.ID = "rfv" + oUIControl.ControlName;
                            oRFV.ControlToValidate = oUIControl.ControlName;
                            oRFV.Display           = ValidatorDisplay.None;
                            oRFV.InitialValue      = "-1";
                            //oRFV.ErrorMessage = oUIControl.ValidationMsg;
                            oRFV.ErrorMessage = oUIControl.ShortName + " : " + "Please select " + oUIControl.LabelText;
                            oParentControl.Controls.Add(oRFV);
                            oRFV.SetFocusOnError = true;
                        }
                    }
                    break;

                case "RADIOBUTTONLIST":
                    RadioButtonList oOptButtonList = (RadioButtonList)oControl;
                    oOptButtonList.ToolTip = oUIControl.ToolTipText;
                    if (oUIControl.ValidationRequired == 1)
                    {
                        if (oParentControl.FindControl("rfv" + oUIControl.ControlName) == null)
                        {
                            RequiredFieldValidator oRFV = new RequiredFieldValidator();
                            oRFV.ID = "rfv" + oUIControl.ControlName;
                            oRFV.ControlToValidate = oUIControl.ControlName;
                            oRFV.Display           = ValidatorDisplay.None;
                            oRFV.InitialValue      = "";
                            if (oUIControl.ValidationMsg == "")
                            {
                                oRFV.ErrorMessage = oUIControl.ShortName + " : " + "Please select " + oUIControl.LabelText;
                            }
                            else
                            {
                                oRFV.ErrorMessage = oUIControl.ValidationMsg;
                            }

                            oParentControl.Controls.Add(oRFV);
                            oRFV.SetFocusOnError = true;
                        }
                    }
                    break;

                case "LISTBOX":
                    ListBox oListBox = (ListBox)oControl;
                    oListBox.ToolTip = oUIControl.ToolTipText;
                    if (oUIControl.ValidationRequired == 1)
                    {
                        if (oParentControl.FindControl("rfv" + oUIControl.ControlName) == null)
                        {
                            RequiredFieldValidator oRFV = new RequiredFieldValidator();
                            oRFV.ID = "rfv" + oUIControl.ControlName;
                            oRFV.ControlToValidate = oUIControl.ControlName;
                            oRFV.Display           = ValidatorDisplay.None;
                            oRFV.InitialValue      = "-1";
                            if (oUIControl.ValidationMsg == "")
                            {
                                oRFV.ErrorMessage = oUIControl.ShortName + " : " + "Please select " + oUIControl.LabelText;
                            }
                            else
                            {
                                oRFV.ErrorMessage = oUIControl.ValidationMsg;
                            }

                            oParentControl.Controls.Add(oRFV);
                            oRFV.SetFocusOnError = true;
                        }
                    }

                    break;

                case "BUTTON":
                    Button btn = (Button)oControl;
                    btn.ToolTip = oUIControl.ToolTipText;
                    //btn.Text = oUIControl.LabelText;
                    break;

                case "LINKBUTTON":
                    LinkButton lbtn = (LinkButton)oControl;
                    lbtn.ToolTip = oUIControl.ToolTipText;
                    //lbtn.Text = oUIControl.LabelText;
                    break;

                case "CHECKBOX":
                    CheckBox chk = (CheckBox)oControl;
                    chk.ToolTip = oUIControl.ToolTipText;
                    //chk.Text = oUIControl.LabelText;
                    break;

                case "RADIOBUTTON":
                    RadioButton optBtn = (RadioButton)oControl;
                    optBtn.ToolTip = oUIControl.ToolTipText;
                    //optBtn.Text = oUIControl.LabelText;
                    break;
                }
                ;
            }
        }
Пример #10
0
        public void afficherProduits()
        {
            string  image     = "";
            string  nom       = "";
            decimal prix      = 0;
            string  idProduit = "";
            int     cptr      = 0;
            int     stock     = 0;

            try
            {
                ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("CPHContenu");

                if (panier.Count == 0)
                {
                    Session["message"] = "Il n'y a aucun produit dans votre!";
                    Server.Transfer("/couchePresentation/pagemessage.aspx", true);
                }

                string motifHTML = File.ReadAllText(Server.MapPath("..") +
                                                    "/couchePresentation/motifsHTML/motifPanier.html");

                //while (panier.Count > 0)
                foreach (OrderDetails od in panier)
                {
                    if (od.IdProduit.Substring(0, 2) == "01")
                    {
                        Alcool prod = ((Metier)Session["metier"]).lireAlcoolSpecifique(od.IdProduit);
                        nom       = prod.NomAlcool + " " + prod.DegréAlcool;
                        image     = "imgAlcool/" + prod.ImageAlcool;
                        prix      = System.Math.Round(prod.PrixUnitaire, 2);
                        idProduit = prod.IdAlcool;
                        stock     = prod.StockAlcool;
                    }
                    else if (od.IdProduit.Substring(0, 2) == "00")
                    {
                        Vin prod = ((Metier)Session["metier"]).lireVinSpecifique(od.IdProduit);
                        nom       = prod.NomVin + " " + prod.Millesime + " " + prod.TypeVin;
                        image     = "imgVin/" + prod.ImageVin;
                        prix      = System.Math.Round(prod.PrixUnitaire, 2);
                        idProduit = prod.IdVin;
                        stock     = prod.StockVin;
                    }

                    else if (od.IdProduit.Substring(0, 2) == "02")
                    {
                        Chemise prod = ((Metier)Session["metier"]).lireChemiseSpecifique(od.IdProduit);
                        nom       = prod.NomChemise + " (" + prod.CouleurChemise + " en " + prod.Matiere + ")";
                        image     = "imgChemise/" + prod.ImageChemise;
                        prix      = System.Math.Round(prod.PrixUnitaire, 2);
                        idProduit = prod.IdProduit;
                        stock     = prod.StockChemise;
                    }
                    cph.Controls.Add((new LiteralControl(
                                          string.Format(motifHTML,
                                                        image,                  //0
                                                        nom,                    //1
                                                        prix,                   //2
                                                        od.Quantity.ToString(), //3
                                                        od.Quantity * prix,     //4
                                                        idProduit,              //5
                                                        cptr,                   //6
                                                        stock))));              //7
                    cptr = cptr + 1;
                }
            }
            catch (Exception)
            {
                //  Response.End();
                throw;
            }
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // XỬ LÝ TIÊU ĐỀ CHO PAGE //

            string vmk_title_page = "TRANG CHỦ";

            string ten_cua_hang = ClassMain.Xu_Ly_Session("GET", "ten_cua_hang");

            if (ten_cua_hang != null)
            {
                if (ten_cua_hang.Trim() != "")
                {
                    vmk_title_page += " - " + ten_cua_hang;
                }
            }
            ContentPlaceHolder vmk_ContentPlaceHolder_for_title_page = (ContentPlaceHolder)this.Master.FindControl("vmk_ContentPlaceHolder_for_title_page");

            vmk_ContentPlaceHolder_for_title_page.Controls.Add(new LiteralControl(vmk_title_page));

            ////

            if (!IsPostBack)
            {
                // LẤY DANH SÁCH SẢN PHẨM MỚI NHẤT TỪ CSDL VÀ ĐƯA LÊN GIAO DIỆN //

                ClassCSDL vmk_csdl = new ClassCSDL();
                vmk_csdl.sql_query = "select id_sp, san_pham.id_dm, ten_dm, ten_sp, gioi_thieu, ngay_sp, thang_sp, nam_sp, don_gia, luot_xem, (select ten_dvt from don_vi_tinh where id_dvt = san_pham.id_dvt) as ten_dvt" +
                                     " from san_pham, danh_muc" +
                                     " where (san_pham.id_dm = danh_muc.id_dm)" +
                                     " order by nam_sp desc, thang_sp desc, ngay_sp desc, id_sp desc"
                ;

                DataTable BANG_KQ = vmk_csdl.VMK_SQL_SELECT();

                if (BANG_KQ.Rows.Count != 0)
                {
                    repeater_list_data.DataSource = BANG_KQ;
                    repeater_list_data.DataBind();
                }
                else
                {
                    label_thongbao.Text = "KHÔNG CÓ DỮ LIỆU <br /><br />";
                    return;
                }

                // LẤY DANH SÁCH SẢN PHẨM XEM NHIỀU TỪ CSDL VÀ ĐƯA LÊN SLIDER //

                ClassCSDL vmk_csdl2 = new ClassCSDL();
                vmk_csdl2.sql_query = "select top(5) id_sp, ten_sp, gioi_thieu" +
                                      " from san_pham" +
                                      " order by luot_xem desc, nam_sp desc, thang_sp desc, ngay_sp desc, id_sp desc"
                ;

                DataTable BANG_KQ2 = vmk_csdl2.VMK_SQL_SELECT();
                if (BANG_KQ2.Rows.Count != 0)
                {
                    BANG_KQ2.Columns.Add("stt", typeof(Int16));
                    for (int i = 0; i < BANG_KQ2.Rows.Count; i++)
                    {
                        BANG_KQ2.Rows[i][3] = i + 1;
                    }
                    repeater_list_data_slider1.DataSource = BANG_KQ2;
                    repeater_list_data_slider1.DataBind();
                    repeater_list_data_slider2.DataSource = BANG_KQ2;
                    repeater_list_data_slider2.DataBind();
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsCallback)
        {
            Master.sbotonesOpcionOn  = "4";
            Master.sbotonesOpcionOff = "4";

            Master.TituloPagina      = "Mantenimiento de la fecha límite de tramitación de órdenes de facturación";
            Master.bFuncionesLocales = true;
            Master.FicherosCSS.Add("PopCalendar/CSS/Classic.css");
            Master.FuncionesJavaScript.Add("PopCalendar/PopCalendar.js");
            Master.FuncionesJavaScript.Add("Javascript/boxover.js");


            Utilidades.SetEventosFecha(this.txtFechaMes01);
            Utilidades.SetEventosFecha(this.txtFechaMes02);
            Utilidades.SetEventosFecha(this.txtFechaMes03);
            Utilidades.SetEventosFecha(this.txtFechaMes04);
            Utilidades.SetEventosFecha(this.txtFechaMes05);
            Utilidades.SetEventosFecha(this.txtFechaMes06);
            Utilidades.SetEventosFecha(this.txtFechaMes07);
            Utilidades.SetEventosFecha(this.txtFechaMes08);
            Utilidades.SetEventosFecha(this.txtFechaMes09);
            Utilidades.SetEventosFecha(this.txtFechaMes10);
            Utilidades.SetEventosFecha(this.txtFechaMes11);
            Utilidades.SetEventosFecha(this.txtFechaMes12);

            txtAnno.Text = DateTime.Now.Year.ToString();
            ContentPlaceHolder oCPHC = (ContentPlaceHolder)Master.FindControl("CPHC");

            string       sMes = "";
            DropDownList cboAux;
            for (int j = 1; j < 13; j++)
            {
                sMes = j.ToString();
                if (j < 10)
                {
                    sMes = "0" + sMes;
                }

                cboAux = (DropDownList)oCPHC.FindControl("cboHora" + sMes);
                cboAux.Items.Add(new ListItem("0:00", "24cache"));
                cboAux.Items.Add(new ListItem("0:30", "0:30"));
                for (int i = 1; i < 24; i++)
                {
                    cboAux.Items.Add(new ListItem(i.ToString() + ":00", i.ToString() + ":00"));
                    cboAux.Items.Add(new ListItem(i.ToString() + ":30", i.ToString() + ":30"));
                    if (i == 18)
                    {
                        cboAux.SelectedValue = "18:00";
                    }
                }
            }


            try
            {
                //string strTabla0 = cargarLimitesFacturacion(int.Parse(txtAnno.Text));
                //string[] aTabla0 = Regex.Split(strTabla0, "@#@");
                //if (aTabla0[0] == "Error") Master.sErrores = aTabla0[1];
            }
            catch (Exception ex)
            {
                Master.sErrores = Errores.mostrarError("Error al cargar los datos", ex);
            }
            //1º Se indican (por este orden) la función a la que se va a devolver el resultado
            //   y la función que va a acceder al servidor
            string cbRespuesta = Page.ClientScript.GetCallbackEventReference(this, "arg", "RespuestaCallBack", "context", false);
            string cbLlamada   = "function RealizarCallBack(arg, context)" + "{" + cbRespuesta + ";" + "}";
            //2º Se "registra" la función que va a acceder al servidor.
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RealizarCallBack", cbLlamada, true);
        }
    }
Пример #13
0
    private void QueryList()
    {
        string strAppType   = ""; //發佈對像
        string strNewsKind  = ""; //種類
        string strStartDate = ""; //上架起始時間
        string strEndDate   = ""; //上架結束時間

        if (!string.IsNullOrEmpty(MDS.Utility.NUtility.trimBad(Request.QueryString["_selAppType"])))
        {
            strAppType = MDS.Utility.NUtility.trimBad(Request.QueryString["_selAppType"]);
        }
        if (!string.IsNullOrEmpty(MDS.Utility.NUtility.trimBad(Request.QueryString["_selNewsKind"])))
        {
            strNewsKind = MDS.Utility.NUtility.trimBad(Request.QueryString["_selNewsKind"]);
        }
        if (!string.IsNullOrEmpty(MDS.Utility.NUtility.trimBad(Request.QueryString["_txtStartDate"])))
        {
            strStartDate = MDS.Utility.NUtility.trimBad(Request.QueryString["_txtStartDate"]);
        }
        if (!string.IsNullOrEmpty(MDS.Utility.NUtility.trimBad(Request.QueryString["_txtEndDate"])))
        {
            strEndDate = MDS.Utility.NUtility.trimBad(Request.QueryString["_txtEndDate"]);
        }


        if (NewsListView == null)
        {
            ContentPlaceHolder MySecondContent = (ContentPlaceHolder)this.Master.FindControl("ContentPlaceHolder1");
            NewsListView = MySecondContent.FindControl("NewsListView") as ASP.dmscontrol_olistview_ascx;
            //StrSearch = MySecondContent.FindControl("StrSearch") as System.Web.UI.HtmlControls.HtmlInputText;
        }
        if (NewsListView != null)
        {
            //加入欄位Start
            NewsListView.AddCol("資料種類", "CSTATUSS", "CENTER", "10%");

            NewsListView.AddCol("代碼", "CKEY", "LEFT", "10%");
            NewsListView.AddCol("資料內容", "CVALUE", "LEFT", "50%");

            NewsListView.AddCol("說明", "CNOTE", "LEFT", "30%");

            //NewsListView.AddCol("提供 APP 使用", "APPLY44", "CENTER", "10%");
            //NewsListView.AddCol("備註", "MEMO", "LEFT", "15%");
            //NewsListView.AddCol("下架日期", "E_DATE", "LEFT", "10%");
            ////BosomServiceList.AddCol("資料狀態", "status", "LEFT");
            //NewsListView.AddCol("最後更新日期", "LDATA", "LEFT", "20%");

            //加入欄位End

            //設定Key值欄位
            NewsListView.DataKeyNames = "CKEY"; //Key以,隔開

            //設定是否顯示CheckBox(預設是true);
            //BosomServiceList.IsUseCheckBox = false;

            StringBuilder sbSQL = new StringBuilder();
            //設定SQL
            sbSQL.Append(" select CKEY, CVALUE, CNOTE, CSTATUS, APPLY4, " +
                         " (case when CKEY = \'MIP_AD_02\' then \'系統值不可修改\' " +
                         " when CKEY = \'CUSTOMER_MAIL_TIME\'  then \'系統值不可修改\' " +
                         " when CKEY = \'MIP_TOLO_CNT_02\'  then \'系統值不可修改\' " +
                         " when CKEY = \'MIP_TOLO_CNT_01\'  then \'系統值不可修改\' " +
                         " when CKEY = \'YL0132A\'  then \'系統值不可修改\' " +
                         " when CKEY = \'MIP_AD_01\'  then \'系統值不可修改\' " +
                         " else \'非系統值可修改\' end) as MEMO, " +
                         " ( case when CSTATUS =\'0\' then \'MIP Key\'  when CSTATUS =\'1\' then \'測試資料\' else \'未定義\' end) CSTATUSS, " +
                         " ( case when APPLY4 = \'1\' then \'否\' else \'是\' end) APPLY44 " +
                         " from MIP_KV order by CSTATUS,CKEY; "
                         );

            //發布對象
            //if (!string.IsNullOrEmpty(strAppType) && !strAppType.Equals("0"))
            //{
            //    sbSQL.Append("AND n.CKEY = '" + strAppType + "'");
            //}

            ////商品類別
            //if (!string.IsNullOrEmpty(strNewsKind))
            //{
            //    sbSQL.Append("AND n.CVALUE = '" + strNewsKind + "'");
            //}

            ////上架時間
            //if (!string.IsNullOrEmpty(strStartDate))
            //{
            //    sbSQL.Append("AND n.S_DATE >= CONVERT(datetime, '" + strStartDate.Replace("/", "") + " 00:00:00') ");
            //    _CreateStartDate = strStartDate;
            //}

            ////下架時間
            //if (!string.IsNullOrEmpty(strEndDate))
            //{
            //    sbSQL.Append("AND n.S_DATE <= CONVERT(datetime, '" + strEndDate.Replace("/", "") + " 23:59:59') ");
            //    _CreateEndDate = strEndDate;
            //}

            //sbSQL.Append(" ORDER BY n.APP_TYPE,n.BULL_ID,SORT ");

            //取得SQL;
            NewsListView.SelectString = sbSQL.ToString();
            string showSql = sbSQL.ToString();
            Debug.Write(showSql);

            //設定每筆資料按下去的Javascript function
            NewsListView.OnClickExecFunc = "DoEdt()";

            //設定每頁筆數
            NewsListView.PageSize = 26;

            //接來自Request的排序欄位、排序方向、目前頁數
            ListViewSortKey       = Request.Params["ListViewSortKey"];
            ListViewSortDirection = Request.Params["ListViewSortDirection"];
            PageNo = Request.Params["PageNo"];

            //設定排序欄位及方向
            if (!string.IsNullOrEmpty(ListViewSortKey) && !string.IsNullOrEmpty(ListViewSortDirection))
            {
                NewsListView.ListViewSortKey       = ListViewSortKey;
                NewsListView.ListViewSortDirection = (SortDirection)Enum.Parse(typeof(SortDirection), ListViewSortDirection);
            }

            //設定目前頁數
            if (!string.IsNullOrEmpty(PageNo))
            {
                NewsListView.PageNo = int.Parse(PageNo);
            }
        }
    }
Пример #14
0
 public ControlFinder(ContentPlaceHolder holder)
 {
     this.holder = holder;
 }
Пример #15
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);
        string masterPageCss = ((HtmlLink)Page.Master.FindControl("uxCSSFiles")).Href;
        string cmsCss        = "~/css/contentManager.css";

        if (!masterPageCss.Contains(cmsCss))
        {
            ((HtmlLink)Page.Master.FindControl("uxCSSFiles")).Href = masterPageCss + (String.IsNullOrEmpty(masterPageCss) ? "" : ",") + cmsCss;
        }
        if (!Page.ClientScript.IsStartupScriptRegistered("Validate"))
        {
            Page.ClientScript.RegisterStartupScript(typeof(string), "Validate", @"<script language=""javascript"" type=""text/javascript"" src=""//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js""></script>");
        }

        CMPage      cmsPage         = CMSHelpers.GetCurrentRequestCMSPage();
        CMMicrosite micrositeEntity = CMSHelpers.GetCurrentRequestCMSMicrosite();
        string      fileName        = string.Empty;

        if (cmsPage == null)
        {
            fileName = Helpers.GetFileName();
            cmsPage  = CMPage.CMPageGetByFileName(fileName).FirstOrDefault();
            if (cmsPage != null)
            {
                CMSHelpers.SetCurrentRequestCMSPage(cmsPage);
            }
        }
        if (cmsPage != null && Settings.EnableCMPageRoles && !IsDeveloper && !CMSHelpers.CanUserManagePage() && !CMSHelpers.CanUserAccessPage(cmsPage.CMPageID))
        {
            Response.Redirect(FormsAuthentication.LoginUrl + "?ReturnUrl=" + (micrositeEntity == null ? "" : micrositeEntity.Name.Replace(" ", "-") + "/") + cmsPage.FileName.Replace(" ", "-"));
        }
        if (cmsPage == null || (micrositeEntity != null && (!micrositeEntity.Active && !(CMSHelpers.CanUserManagePage() || micrositeEntity.Published || User.IsInRole("Admin") || User.IsInRole("CMS Admin")))))
        {
            Response.Redirect("~/404.aspx?page=" + (micrositeEntity == null ? "" : micrositeEntity.Name.Replace(" ", "-") + "/") + fileName);
        }

        if (cmsPage != null)
        {
            if (micrositeEntity != null)
            {
                m_MicrositeName = micrositeEntity.Name;
            }
            ComponentAdditionalLink = "~/admin/content-manager/content-manager-page.aspx?id=" + cmsPage.CMPageID + "&frontendView=true";
            //Uncomment the following lines if you have the Dynamic Header installed
            ContentPlaceHolder contentDynamicHeader = Helpers.FindContentPlaceHolder(Master, "ContentDynamicHeader");
            if (contentDynamicHeader != null)
            {
                contentDynamicHeader.Visible = false;
                if (cmsPage.DynamicCollectionID.HasValue)
                {
                    Classes.DynamicHeader.DynamicCollection collection = Classes.DynamicHeader.DynamicCollection.GetByID(cmsPage.DynamicCollectionID.Value);
                    if (collection.Active)
                    {
                        BaseDynamicHeader dynamicHeader = (BaseDynamicHeader)contentDynamicHeader.FindControl("uxDynamicHeaderQV");
                        if (dynamicHeader != null)
                        {
                            dynamicHeader.CollectionName = collection.Name;
                            dynamicHeader.Visible        = contentDynamicHeader.Visible = true;
                        }
                    }
                }
            }
        }
    }
Пример #16
0
 public IncidentEditView(IIncidentEditPanel editPanel)
 {
     InitializeComponent();
     ContentPlaceHolder.AddControl((Control) editPanel);
 }
Пример #17
0
        private void HandleOpenTag(Stack <Control> container, HtmlChunk chunk, StringBuilder currentLiteralText)
        {
            if (chunk.TagName.Equals("title", StringComparison.OrdinalIgnoreCase) && isCurrentlyInHeadTag)
            {
                // if we are not currently parsing the <head> tag, then this title must be in the body and we should skip it
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                var title = new HtmlTitle();
                container.Peek().Controls.Add(title);
                container.Push(title);
            }
            else if (chunk.TagName.Equals("head", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();
                var head = new HtmlHead();
                container.Peek().Controls.Add(head);
                container.Push(head);
                isCurrentlyInHeadTag = true;
            }
            else if (chunk.TagName.Equals("asp:ContentPlaceHolder", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                if (chunk.HasAttribute("ID"))
                {
                    var id          = chunk.AttributesMap["ID"] as string;
                    var placeHolder = new ContentPlaceHolder()
                    {
                        ID = id
                    };
                    container.Peek().Controls.Add(placeHolder);
                    this.AddContentPlaceHolder(id);
                    this.InstantiateControls(placeHolder);
                }
            }
            else if (chunk.TagName.Equals("form", StringComparison.OrdinalIgnoreCase) && chunk.HasAttribute("runat"))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                var form = new HtmlForm();
                if (chunk.HasAttribute("id"))
                {
                    form.ID = chunk.AttributesMap["id"] as string;
                }
                else
                {
                    form.ID = "aspnetForm";
                }

                container.Peek().Controls.Add(form);
                container.Push(form);
            }
            else if (chunk.TagName.Equals(LayoutsHelpers.SectionTag, StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                var sectionRenderer = new SectionRenderer();
                if (chunk.HasAttribute("name"))
                {
                    sectionRenderer.Name = chunk.AttributesMap["name"].ToString();
                }

                container.Peek().Controls.Add(sectionRenderer);
            }
            else if (chunk.TagName.Equals("meta", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                this.AddIfNotEmpty(chunk.Html, container.Peek());
            }
            else if (chunk.TagName == "%@")
            {
                //// Ignore
            }
            else
            {
                currentLiteralText.Append(chunk.Html);
            }
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // XỬ LÝ TIÊU ĐỀ CHO PAGE //

            string vmk_title_page = "THÔNG TIN";

            string ten_cua_hang = ClassMain.Xu_Ly_Session("GET", "ten_cua_hang");

            if (ten_cua_hang != null)
            {
                if (ten_cua_hang.Trim() != "")
                {
                    vmk_title_page += " - " + ten_cua_hang;
                }
            }
            ContentPlaceHolder vmk_ContentPlaceHolder_for_title_page = (ContentPlaceHolder)this.Master.FindControl("vmk_ContentPlaceHolder_for_title_page");

            vmk_ContentPlaceHolder_for_title_page.Controls.Add(new LiteralControl(vmk_title_page));

            ////

            if (!IsPostBack)
            {
                // LẤY LOẠI TIN TỨC TỪ BIẾN TRUYỀN TRONG URL //

                string loai_tt = "";

                if (Request.QueryString["loai"] != null && Request.QueryString["loai"].ToString() != "")
                {
                    loai_tt = Request.QueryString["loai"].ToString().ToLower();
                }

                // LẤY ID TIN TỨC TỪ BIẾN TRUYỀN TRONG URL //

                int id_tt = 0;

                if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
                {
                    bool check_id_tt = int.TryParse(Request.QueryString["id"].ToString(), out id_tt);
                    if (!check_id_tt)
                    {
                        id_tt = 0;
                    }
                }

                // XỬ LÝ LOẠI TIN TỨC & ID TIN TỨC //

                string cau_lenh_sql = "select * from tin_tuc";

                if (id_tt > 0)
                {
                    cau_lenh_sql = "select top(1) id_tt, tieu_de, noi_dung, luot_xem, ngay_tt, thang_tt, nam_tt, ho_ten" +
                                   " from tin_tuc, thanh_vien" +
                                   " where tin_tuc.id_tv = thanh_vien.id_tv and id_tt = @id_tt and luu_nhap = 0" +
                                   " order by nam_tt desc, thang_tt desc, ngay_tt desc, id_tt desc"
                    ;
                }
                else
                {
                    if (loai_tt == "tintuc")
                    {
                        cau_lenh_sql = "select id_tt, tieu_de, noi_dung, luot_xem, ngay_tt, thang_tt, nam_tt, ho_ten" +
                                       " from tin_tuc, thanh_vien" +
                                       " where tin_tuc.id_tv = thanh_vien.id_tv and ky_thuat = 0 and luu_nhap = 0" +
                                       " order by nam_tt desc, thang_tt desc, ngay_tt desc, id_tt desc"
                        ;

                        this.Page.Title    = "Tin Tức - " + this.Page.Title;
                        label_tenloai.Text = "<a href='TinTuc.aspx?loai=TinTuc' style='color: #4285F4'>TIN TỨC</a>";
                    }
                    else if (loai_tt == "kythuat")
                    {
                        cau_lenh_sql = "select id_tt, tieu_de, noi_dung, luot_xem, ngay_tt, thang_tt, nam_tt, ho_ten" +
                                       " from tin_tuc, thanh_vien" +
                                       " where tin_tuc.id_tv = thanh_vien.id_tv and ky_thuat = 1 and luu_nhap = 0" +
                                       " order by nam_tt desc, thang_tt desc, ngay_tt desc, id_tt desc"
                        ;

                        this.Page.Title    = "Tin Kỹ Thuật - " + this.Page.Title;
                        label_tenloai.Text = "<a href='TinTuc.aspx?loai=KyThuat' style='color: #4285F4'>TIN KỸ THUẬT</a>";
                    }
                    else
                    {
                        Response.Redirect("Default.aspx");
                        return;
                    }
                }

                // TIẾN HÀNH LẤY DỮ LIỆU TỪ CSDL //

                ClassCSDL vmk_csdl = new ClassCSDL();

                vmk_csdl.sql_query = cau_lenh_sql;

                DataTable sql_param = vmk_csdl.sql_param;
                sql_param.Rows.Add("@id_tt", id_tt, SqlDbType.Int);
                vmk_csdl.sql_param = sql_param;

                DataTable BANG_KQ = vmk_csdl.VMK_SQL_SELECT();

                if (BANG_KQ.Rows.Count == 0)
                {
                    return;
                }

                // ĐƯA DỮ LIỆU LÊN GIAO DIỆN //

                if (id_tt > 0)
                {
                    txt_id_tt.Value           = HTML_Encode(BANG_KQ.Rows[0][0].ToString());
                    label_tieudebaiviet.Text  = HTML_Encode(BANG_KQ.Rows[0][1].ToString());
                    label_noidungbaiviet.Text = ClassMain.Decode_BBCode(HTML_Encode(BANG_KQ.Rows[0][2], true));
                    Int64 luot_xem = Convert.ToInt64(BANG_KQ.Rows[0][3]);

                    string ngay  = BANG_KQ.Rows[0][4].ToString();
                    string thang = BANG_KQ.Rows[0][5].ToString();
                    string nam   = BANG_KQ.Rows[0][6].ToString();

                    string ho_ten = BANG_KQ.Rows[0][7].ToString();

                    label_ngaythangnam.Text = Xu_Ly_Ngay_Thang_Nam(ngay, thang, nam);
                    label_nguoidangtin.Text = ho_ten;
                    label_solanxem.Text     = luot_xem.ToString();

                    // CẬP NHẬT LƯỢT XEM //

                    luot_xem += 1;

                    ClassCSDL vmk_csdl1 = new ClassCSDL();
                    vmk_csdl1.sql_query = "update tin_tuc set luot_xem=@luot_xem where id_tt=@id_tt";

                    DataTable sql_param1 = vmk_csdl1.sql_param;
                    sql_param1.Rows.Add("@luot_xem", luot_xem, SqlDbType.BigInt);
                    sql_param1.Rows.Add("@id_tt", id_tt, SqlDbType.Int);
                    vmk_csdl1.sql_param = sql_param1;

                    int sql_status1 = vmk_csdl1.VMK_SQL_INSERT_DELETE_UPDATE();
                }
                else
                {
                    panel_nhieu_tintuc.Visible = true;
                    panel_mot_tintuc.Visible   = false;

                    repeater_list_data.DataSource = BANG_KQ;
                    repeater_list_data.DataBind();
                }
            }
        }
Пример #19
0
        /// <summary>
        /// Overrides the OnPreRender method
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            SetupMenu();

            if (AppLogic.AppConfigBool("Layouts.Enabled"))
            {
                bool HasMappedLayout = false;

                bool IsTopic   = (Page as SkinBase).IsTopicPage;
                bool IsEntity  = (Page as SkinBase).IsEntityPage;
                bool IsProduct = (Page as SkinBase).IsProductPage;

                int PageID = (Page as SkinBase).PageID;

                LayoutMap lm = new LayoutMap();

                if (IsEntity)
                {
                    String EntityType = (Page as SkinBase).EntityType;

                    lm = new LayoutMap(EntityType, PageID);

                    if (lm.LayoutID > 0)
                    {
                        HasMappedLayout = true;
                        (Page as SkinBase).ThisLayout = new LayoutData(lm.LayoutID);
                    }
                }
                else if (IsTopic)
                {
                    lm = new LayoutMap("topic", PageID);
                }
                else if (IsProduct)
                {
                    lm = new LayoutMap("product", PageID);
                }
                else
                {
                    String pName = CommonLogic.GetThisPageName(false);

                    lm = new LayoutMap(pName, PageID);
                }

                if (lm.LayoutID > 0)
                {
                    HasMappedLayout = true;
                    (Page as SkinBase).ThisLayout = new LayoutData(lm.LayoutID);
                }

                if (HasMappedLayout)
                {
                    LayoutData ThisLayout = (Page as SkinBase).ThisLayout;

                    if ((Page as SkinBase).ThisLayout != null)
                    {
                        bool exists = CommonLogic.FileExists(ThisLayout.LayoutFile);

                        if (!exists)
                        {
                            exists = ThisLayout.CreateLayoutControl();
                        }

                        if (exists)
                        {
                            Control ctrl = LoadControl("~/layouts/" + ThisLayout.LayoutID.ToString() + "/" + ThisLayout.Name + "_" + ThisLayout.Version.ToString() + ".ascx");

                            ContentPlaceHolder phContent = (ContentPlaceHolder)this.FindControl("PageContent");
                            phContent.Controls.Clear();

                            phContent.Controls.Add(ctrl);
                        }
                    }
                }
            }

            base.OnPreRender(e);
        }
Пример #20
0
        protected void cmdImport_Click(object sender, EventArgs e)
        {
            ContentPlaceHolder cnt = this.Master.FindControl("FeaturedContent") as ContentPlaceHolder;
            int nbres = 0;

            if (fup.HasFile)
            {
                try
                {
                    string filename  = Path.GetFileName(fup.FileName);
                    string localname = Server.MapPath("~/Upload/") + filename;
                    string errorlist = "";
                    fup.SaveAs(localname);
                    StreamReader res = new StreamReader(localname, System.Text.Encoding.UTF8);
                    while (!res.EndOfStream)
                    {
                        string   line      = res.ReadLine();
                        string[] values    = line.Split('\t');
                        string[] dateparts = values[0].Split('.');
                        // Get courtid
                        int courtid;
                        // Get group name
                        SqlCommand cmd = new SqlCommand();
                        cmd.CommandText = "SELECT idcourt FROM court WHERE courtName = '" + values[2] + "'; ";
                        SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCXCLConnection"].ConnectionString);
                        cmd.Connection = cnx;
                        cnx.Open();
                        SqlDataReader rdr = cmd.ExecuteReader();
                        if (!rdr.Read())
                        {
                            courtid = -1;
                        }
                        else
                        {
                            courtid = rdr.GetInt32(0);
                        }
                        rdr.Close();

                        // Insert
                        cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCXCLConnection"].ConnectionString);
                        cnx.Open();
                        cmd             = new SqlCommand();
                        cmd.CommandText = string.Format("INSERT INTO booking (moment, fkMadeBy, fkPartner, guest, fkCourt) VALUES ('{0}-{1}-{2} {3}:00','{4}','{5}',null,{6});", dateparts[2], dateparts[1], dateparts[0], values[1], Global.getCurrentUserId(), Global.getCurrentUserId(), courtid);
                        cmd.Connection  = cnx;
                        try
                        {
                            cmd.ExecuteNonQuery();
                            nbres++;
                        }
                        catch (Exception ex)
                        {
                            System.Diagnostics.Debug.Write("Error inserting booking (" + cmd.CommandText + "): " + ex.Message);
                            errorlist += ("<br>" + line);
                        }
                    }
                    res.Close();
                    File.Delete(localname);
                    Label errors = new Label();
                    errors.Text = nbres.ToString() + " réservation(s) importé(s).";
                    if (errorlist != "")
                    {
                        errors.Text += "<br>Les réservations suivantes n'ont pas pu être importées:<br>" + errorlist;
                    }
                    cnt.Controls.Add(errors);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Upload status: The file could not be uploaded. The following error occured: " + ex.Message);
                }
            }
        }
Пример #21
0
 protected void btnAutoInsert_Click(object sender, EventArgs e)
 {
     ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("MainContent");
     crudAuto myCrudAuto = new crudAuto();
     myCrudAuto.insertAuto(cph);
 }
Пример #22
0
        private void UstawStroneUzytkownika(string rola)
        {
            //dodawanie tekstu o roli
            Label lblRola = new Label();

            lblRola.Text = String.Format("Twoja rola to {0}.", rola);

            ContentPlaceHolder ctTresc = new ContentPlaceHolder();

            ctTresc = (ContentPlaceHolder)Master.FindControl("TrescStrony");
            ctTresc.Controls.Add(lblRola);

            //uzupełnienie menu dla użytkowników
            ctMenu.Controls.Add(new LiteralControl("<ul>"));

            ctMenu.Controls.Add(new LiteralControl("<li>"));
            HyperLink userSettings = new HyperLink();

            userSettings.Text        = "Ustawienia użytkownika";
            userSettings.NavigateUrl = "~/UserSettings.aspx";

            ctMenu.Controls.Add(userSettings);
            ctMenu.Controls.Add(new LiteralControl("</li>"));

            if (rola == "Admin")
            {
                HyperLink RoleRequests = new HyperLink();
                RoleRequests.Text        = "Wnioski o przydział roli";
                RoleRequests.NavigateUrl = "~/RoleRequests.aspx";

                HyperLink DataBasesReview = new HyperLink();
                DataBasesReview.Text        = "Przegląd baz danych";
                DataBasesReview.NavigateUrl = "~/Databases.aspx";

                ctMenu.Controls.Add(new LiteralControl("<li>"));
                ctMenu.Controls.Add(RoleRequests);
                ctMenu.Controls.Add(new LiteralControl("</li>"));
                ctMenu.Controls.Add(liBeg);
                ctMenu.Controls.Add(DataBasesReview);
                ctMenu.Controls.Add(liEnd);
            }

            if (rola == "Pracownik BHP")
            {
                ctMenu.Controls.Add(new LiteralControl("<li>"));
                ctMenu.Controls.Add(ListaPracownikow);
                ctMenu.Controls.Add(new LiteralControl("</li>"));
                ctMenu.Controls.Add(liBeg);
                ctMenu.Controls.Add(BadaniaOkresowe);
                ctMenu.Controls.Add(liEnd);

                //dopuszczenia pracowników
                dopuszczenia.DataBind();
                ctTresc.Controls.Add(new LiteralControl("<h2>Odpowiedzi po badaniach</h2><div>"));
                ctTresc.Controls.Add(dopuszczenia);
                ctTresc.Controls.Add(datasource);
                ctTresc.Controls.Add(new LiteralControl("</div>"));
            }

            if (rola == "Lekarz medycyny pracy")
            {
                ctMenu.Controls.Add(new LiteralControl("<li>"));
                ctMenu.Controls.Add(BadaniaPracownikow);
                ctMenu.Controls.Add(new LiteralControl("</li>"));
                ctMenu.Controls.Add(liBeg);
                ctMenu.Controls.Add(BadaniaOkresowe);
                ctMenu.Controls.Add(liEnd);
            }

            ctMenu.Controls.Add(new LiteralControl("</ul>"));
        }
Пример #23
0
    protected void SaveChangesButton_Click(object sender, EventArgs e)
    {
        if (connection.State.ToString() != "Open")
        {
            connection.Open();
        }
        bool flag = false;

        if (ViewState["pincode"].ToString() == null)
        {
            PincodeLabel.Text     = "Not a valid pincode";
            PincodeLabel.CssClass = "invalid-input";
            flag = true;
        }
        if (flag)
        {
            return;
        }
        string fileName       = "";
        string profilePicture = "profilePic.png";

        if (ResumeUpload.PostedFile.ContentLength > 0 && ResumeUpload.PostedFile.ContentLength <= 5000000)
        {
            if (ResumeUpload.PostedFile.ContentType == "application/pdf")
            {
                string extension;
                extension = ".pdf";
                fileName  = Request.Cookies["email"].Value.Replace('.', '_') + "_Resume" + DateTime.Now.ToString("hh") + DateTime.Now.ToString("mm") + DateTime.Now.ToString("ss");
                string file = Server.MapPath("~/Uploads/simpleuser/" + fileName);
                if (File.Exists(file + ".pdf"))
                {
                    File.Delete(file + ".pdf");
                }
                fileName += extension;
                file     += extension;
                ResumeUpload.PostedFile.SaveAs(file);
            }
        }
        if (imageUpload.PostedFile.ContentLength > 0)
        {
            string extension;
            if (imageUpload.PostedFile.ContentType == "image/jpeg")
            {
                extension = ".jpeg";
            }
            else if (imageUpload.PostedFile.ContentType == "image/png")
            {
                extension = ".png";
            }
            else
            {
                imageLabel.Text    = "*Image should be of type jpg, jpeg or png only.";
                imageLabel.Visible = true;
                return;
            }

            profilePicture = Util.GetEmail(Request).Replace('.', '_') + "_Profile" + DateTime.Now.ToString("hh") + DateTime.Now.ToString("mm") + DateTime.Now.ToString("ss");
            string file = Server.MapPath("~/Uploads/ProfilePictures/" + profilePicture);
            if (File.Exists(file + ".png"))
            {
                File.Delete(file + ".png");
            }
            if (File.Exists(file + ".jpeg"))
            {
                File.Delete(file + ".jpeg");
            }
            profilePicture += extension;
            file           += extension;
            imageUpload.SaveAs(file);
        }
        if (fileName == null)
        {
            SqlCommand updateValues = new SqlCommand("Begin Transaction; Update [SimpleUser] set address=@address, mobileNumber=@mobileNumber, pincode=@pincode, city=@city, state=@state where [SimpleUser].email=@email; Update [User] set profilepicture=@profile where [User].email=@email; COMMIT;", connection);
            updateValues.Parameters.AddWithValue("profile", profilePicture);
            updateValues.Parameters.AddWithValue("address", Address.Text.Trim());
            updateValues.Parameters.AddWithValue("mobileNumber", MobileNumberInput.Text.Trim());
            updateValues.Parameters.AddWithValue("pincode", PincodeInput.Text.Trim());
            updateValues.Parameters.AddWithValue("city", CityInput.Text.Trim());
            updateValues.Parameters.AddWithValue("state", StateInput.Text.Trim());
            updateValues.Parameters.AddWithValue("email", Util.GetEmail(Request));
            updateValues.ExecuteNonQuery();
        }
        else
        {
            SqlCommand updateValues = new SqlCommand("Begin Transaction; Update [SimpleUser] set resume=@fileName, address=@address, mobileNumber=@mobileNumber, pincode=@pincode, city=@city, state=@state where [SimpleUser].email=@email; Update [User] set profilepicture=@profile where [User].email=@email; COMMIT;", connection);
            updateValues.Parameters.AddWithValue("email", Util.GetEmail(Request));
            updateValues.Parameters.AddWithValue("fileName", fileName);
            updateValues.Parameters.AddWithValue("profile", profilePicture);
            updateValues.Parameters.AddWithValue("address", Address.Text.Trim());
            updateValues.Parameters.AddWithValue("mobileNumber", MobileNumberInput.Text.Trim());
            updateValues.Parameters.AddWithValue("pincode", PincodeInput.Text.Trim());
            updateValues.Parameters.AddWithValue("city", CityInput.Text.Trim());
            updateValues.Parameters.AddWithValue("state", StateInput.Text.Trim());
            updateValues.ExecuteNonQuery();
        }

        string profileURL = "~/Uploads/ProfilePictures/" + profilePicture;

        Response.Cookies["profileURL"].Value = profileURL;
        refresh = true;
        this.Page_Load(sender, e);
        refresh = false;
        ContentPlaceHolder ct = (ContentPlaceHolder)Page.Master.Master.FindControl("MainContent");

        ((System.Web.UI.HtmlControls.HtmlImage)ct.FindControl("profilePic")).Src = profileURL;

        Util.CallJavascriptFunction(this, "popout", new string[] { "Saved Changes", "3" });
    }
Пример #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = (clsUser)Session["User"];

            if (!IsPostBack)
            {
                ContentPlaceHolder Cntph = (ContentPlaceHolder)Page.PreviousPage.Master.FindControl("ContentPlaceHolder1");
            }
            if (Page.PreviousPage != null)
            {
                ContentPlaceHolder Cntph = (ContentPlaceHolder)Page.PreviousPage.Master.FindControl("ContentPlaceHolder1");
                hid_fk_AcademicYr_ID.Value = ((HtmlInputHidden)Cntph.FindControl("hid_fk_AcademicYr_ID")).Value;
                hidSelPaper.Value          = ((HtmlInputHidden)Cntph.FindControl("hidSelPaper")).Value;
                hidSelTLMAmAt.Value        = ((HtmlInputHidden)Cntph.FindControl("hidSelTLMAmAt")).Value;
                hidInstID.Value            = ((HtmlInputHidden)Cntph.FindControl("hidInstID")).Value;
                hidFacID.Value             = ((HtmlInputHidden)Cntph.FindControl("hidFacID")).Value;
                hidCrID.Value             = ((HtmlInputHidden)Cntph.FindControl("hidCrID")).Value;
                hidMoLrnID.Value          = ((HtmlInputHidden)Cntph.FindControl("hidMoLrnID")).Value;
                hidBrnID.Value            = ((HtmlInputHidden)Cntph.FindControl("hidBrnID")).Value;
                hidPtrnID.Value           = ((HtmlInputHidden)Cntph.FindControl("hidPtrnID")).Value;
                hidCrPrDetailsID.Value    = ((HtmlInputHidden)Cntph.FindControl("hidCrPrDetailsID")).Value;
                hidCrPrChID.Value         = ((HtmlInputHidden)Cntph.FindControl("hidCrPrChID")).Value;
                hidHead.Value             = ((HtmlInputHidden)Cntph.FindControl("hidHead")).Value;
                hidTLMIDs.Value           = ((HtmlInputHidden)Cntph.FindControl("hidTLMIDs")).Value;
                hidAMIDs.Value            = ((HtmlInputHidden)Cntph.FindControl("hidAMIDs")).Value;
                hidATIDs.Value            = ((HtmlInputHidden)Cntph.FindControl("hidATIDs")).Value;
                hidCollName.Value         = ((HtmlInputHidden)Cntph.FindControl("hidCollName")).Value;
                hidAcYrForCollLogin.Value = ((HtmlInputHidden)Cntph.FindControl("hidAcYrForCollLogin")).Value;
                divEndButtons.Style.Add("display", "block");
                lblGVPapersHeading.Text += " " + hidHead.Value;

                //show only selected tlm am at here

                DataTable DChk = new DataTable();
                DChk.Columns.Add("TLM-AM-AT-ID");
                DChk.Columns.Add("TLM-AM-AT");
                ArrayList tlmamat = new ArrayList();
                for (int i = 0; i < hidSelTLMAmAt.Value.Split(',').Length; i++)
                {
                    tlmamat.Add(hidSelTLMAmAt.Value.Split(',')[i]);
                    DataRow dr = DChk.NewRow();
                    dr["TLM-AM-AT-ID"] = tlmamat[i].ToString().Split('|')[0];
                    dr["TLM-AM-AT"]    = tlmamat[i].ToString().Split('|')[1];
                    DChk.Rows.Add(dr);
                }

                chkTLMAMAT.DataSource = DChk;
                chkTLMAMAT.DataBind();
                divTLMAMATChoice.Style.Add("display", "block");

                //DT = clsCollegeAdmissionReports.PaperExemptionFetchStudentDetails(hidSelPaper.Value, hidInstID.Value, hid_fk_AcademicYr_ID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
                //           hidCrPrDetailsID.Value, hidCrPrChID.Value, hidTLMIDs.Value, hidAMIDs.Value, hidATIDs.Value);
                DT = clsCollegeAdmissionReports.PaperExemptionFetchStudentDetails(hidSelPaper.Value, hidInstID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
                                                                                  hidCrPrDetailsID.Value, hidCrPrChID.Value, hidTLMIDs.Value, hidAMIDs.Value, hidATIDs.Value);
                if (DT.Rows.Count > 0)
                {
                    divPaperTLMAMAT.Style.Add("display", "block");
                    divResultPageDetails.Style.Add("display", "block");
                    FillGridView(DT);

                    btnApprove.Enabled = true;
                    btnDeny.Enabled    = true;
                }
                else
                {
                    divEndButtons.Style.Add("display", "none");
                    divTLMAMATChoice.Style.Add("display", "none");
                    divPaperTLMAMAT.Style.Add("display", "none");
                    tblExportedDataMsg.Style.Add("display", "block");
                    lblExportedData.Text = "No Record(s) found.";
                    divResultPageDetails.Style.Add("display", "none");

                    btnApprove.Enabled = false;
                    btnDeny.Enabled    = false;
                }
            }
        }
Пример #25
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            clsCache.NoCache();

            ContentPlaceHolder CntphM = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");

            RegStudentAdvancedSearchCtrl = (Eligibility.WebCtrl.StudentsStatusSearch)CntphM.FindControl("StudentsStatusSearch1");


            if (!IsPostBack)
            {
                ContentPlaceHolder Cntph1 = (ContentPlaceHolder)Page.PreviousPage.Master.FindControl("ContentPlaceHolder1");
                searchInstNew      temp   = (searchInstNew)Cntph1.FindControl("SchInst1");
                hidInstID.Value = ((HtmlInputHidden)Cntph1.FindControl("hidInstID")).Value;
                hidUniID.Value  = Classes.clsGetSettings.UniversityID.ToString();

                HtmlInputHidden[] hid = new HtmlInputHidden[13];
                hid[0]  = hidInstID;
                hid[1]  = hidUniID;
                hid[2]  = hidElgFormNo;
                hid[3]  = hidpkStudentID;
                hid[4]  = hidpkYear;
                hid[5]  = hidpkFacID;
                hid[6]  = hidpkCrID;
                hid[7]  = hidpkMoLrnID;
                hid[8]  = hidpkPtrnID;
                hid[9]  = hidpkBrnID;
                hid[10] = hidpkCrPrDetailsID;
                hid[11] = hidPRN;
                hid[12] = hidIsBlank;

                Common.setHiddenVariables(ref hid);
            }

            ContentPlaceHolder Cntph = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");

            RegStudentAdvancedSearchCtrl = (Eligibility.WebCtrl.StudentsStatusSearch)Cntph.FindControl("StudentsStatusSearch1");

            if (hidInstID.Value != "" && hidInstID.Value != null)
            {
                lblPageHead.Text  = "View Eligibility Status";
                lblSubHeader.Text = "  for " + InstRep.InstituteName(hidUniID.Value, hidInstID.Value);
            }
            RegStudentAdvancedSearchCtrl.QstrNavigate = null;
            RegStudentAdvancedSearchCtrl.StrUrl       = "ELGV2_ViewStatus__2.aspx?Search=Adv";

            if (Request.QueryString["Search"] == "Adv")
            {
                if (Request.QueryString["Navigate"] == "back")
                {
                    RegStudentAdvancedSearchCtrl.QstrNavigate = "back";
                }
                else
                {
                    RegStudentAdvancedSearchCtrl.QstrNavigate = null;
                }

                RegStudentAdvancedSearchCtrl.StrUrl = "ELGV2_ViewStatus__2.aspx?Search=Adv";
            }

            else if (Request.QueryString["Search"] == "Simple")
            {
                if (Request.QueryString["Navigate"] == "back")
                {
                    RegStudentAdvancedSearchCtrl.QstrNavigate = "back";
                    RegStudentAdvancedSearchCtrl.StrUrl       = "ELGV2_ViewStatus__2.aspx?Search=Simple";
                }
            }

            //added by Deboshree 16/7/10

            if (RegStudentAdvancedSearchCtrl.HidSearchType.Equals("Simple"))// || Request.QueryString["Search"] == "Simple")
            {
                RegStudentAdvancedSearchCtrl.StrUrl = "ELGV2_ViewStatus__2.aspx?Search=Simple";
            }
            else if (RegStudentAdvancedSearchCtrl.HidSearchType.Equals("Adv"))// || Request.QueryString["Search"] == "Adv")
            {
                RegStudentAdvancedSearchCtrl.StrUrl = "ELGV2_ViewStatus__2.aspx?Search=Adv";
            }

            try
            {
                hidIsPRNValidationRequired.Value = Classes.clsGetSettings.IsPRNValidationRequired;
            }
            catch
            {
                hidIsPRNValidationRequired.Value = "N";
            }
        }
Пример #26
0
        protected void ddltotalperson_SelectedIndexChanged(object sender, EventArgs e)
        {
            ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");

            int totalPeople = Convert.ToInt32(ddltotalperson.SelectedValue);

            string[] ptext = new string[] { "First Name", "Last Name", "Civilization Number", "Gender" };

            int countroom = 2;



            for (int i = 1; i < totalPeople; i++)
            {
                HtmlGenericControl div = new HtmlGenericControl("div");
                div.ID = string.Format("div{0}", i);
                div.Style.Add(HtmlTextWriterStyle.Display, "inline-block");



                for (int j = 0; j < 4; j++)
                {
                    if (j != 3)
                    {
                        HtmlGenericControl innerdiv = new HtmlGenericControl("div");
                        innerdiv.ID = string.Format("innerdiv{0}", i * 4 + j);
                        innerdiv.Attributes.Add("class", "name-agile");
                        innerdiv.Style.Add(HtmlTextWriterStyle.Width, "266.82px");

                        innerdiv.InnerHtml = string.Format("<p>{0}</p>", ptext[j]);

                        TextBox txt = new TextBox();
                        txt.ID           = string.Format("Guest{0}{1}", i, ptext[j].Replace("  ", string.Empty));
                        txt.ClientIDMode = ClientIDMode.Static;
                        txt.Attributes.Add("name", txt.ClientID);
                        txt.Attributes.Add("placeholder", string.Format("{1}.Guest {0}", ptext[j], (i + 1)));

                        innerdiv.Controls.Add(txt);
                        div.Controls.Add(innerdiv);
                        guest.Controls.Add(div);
                    }
                    else
                    {
                        HtmlGenericControl innerdiv = new HtmlGenericControl("div");
                        innerdiv.ID = string.Format("innerdiv{0}", i * 4 + j);
                        innerdiv.Attributes.Add("class", "room-agile");
                        innerdiv.InnerHtml = string.Format("<p>{0}</p>", ptext[j]);

                        DropDownList ddl = new DropDownList();
                        ddl.ID           = string.Format("Guest{0}{1}", i, ptext[j].Replace("  ", string.Empty));
                        ddl.ClientIDMode = ClientIDMode.Static;
                        ddl.Attributes.Add("name", ddl.ClientID);


                        var ddlmale = new ListItem();
                        ddlmale.Text  = "Male";
                        ddlmale.Value = "Male";

                        var ddlfamale = new ListItem();
                        ddlfamale.Text  = "Female";
                        ddlfamale.Value = "Female";

                        ddl.Items.Add(ddlfamale);
                        ddl.Items.Add(ddlmale);


                        innerdiv.Controls.Add(ddl);
                        div.Controls.Add(innerdiv);

                        guest.Controls.Add(div);
                    }
                }


                if ((i == 2 && totalPeople > 3) || (i == 5 && totalPeople > 6) || (i == 8 && totalPeople == 10))
                {
                    HtmlGenericControl roomdiv = new HtmlGenericControl("div");
                    roomdiv.ID = string.Format("roomdiv{0}", i);
                    roomdiv.Attributes.Add("class", "room-agile");
                    roomdiv.InnerHtml = string.Format("<p>{0}Room Numbers</p>", countroom);
                    roomdiv.Style.Add(HtmlTextWriterStyle.MarginLeft, "-150px");
                    roomdiv.Style.Add(HtmlTextWriterStyle.MarginTop, "30px");


                    DropDownList ddl1 = new DropDownList();

                    ddl1.ID             = string.Format("Guest{0}", i);
                    ddl1.ClientIDMode   = ClientIDMode.Static;
                    ddl1.DataSource     = _roommanagement.GetAll();
                    ddl1.DataTextField  = "RoomNumber";
                    ddl1.DataValueField = "RoomNumber";
                    ddl1.DataBind();
                    ddl1.Attributes.Add("name", ddl1.ClientID);


                    countroom += 1;


                    roomdiv.Controls.Add(ddl1);

                    div.Controls.Add(roomdiv);

                    guest.Controls.Add(div);
                }
            }
        }
Пример #27
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            IsNonLoginPostBack = IsPostBack;

            bool isiPhone = IsiPhoneOrAndroid();

            if (isiPhone && Request.QueryString["rss"] != "1")             //it's an iPhone
            {
                string currentPage = GetCurrentPageName();
                if (!currentPage.ToLower().Contains("-iphone"))                 //it's not an iPhone version of the page
                {
                    string iphonePage = currentPage.Substring(0, currentPage.IndexOf(".")) + "-iphone.aspx";
                    if (File.Exists(Request.MapPath(iphonePage)))                     //iPhone verison exists - for example "topics-iphone.aspx"
                    {
                        Server.Execute(iphonePage, Response.Output, true);
                        Response.End();
                        return;
                    }
                }
            }


            //if we're Hebrew or Arabic - let's make it right-to-left
            if (!isiPhone)
            {
                string culture = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
                if (culture == "ar" || culture == "he")
                {
                    Page.Form.Attributes.Add("dir", "rtl");
                }
            }


            //adding application-wide error handler
            //we do it here because we have no Global.asax
            //this method has known issues in ASP.NET 2.0
            //if (!_isAppErrorHandlerSet)
            {
                //_isAppErrorHandlerSet = true;
                HttpApplication app = Context.ApplicationInstance;
                app.Error += new EventHandler(ApplicationInstance_Error);
            }

            //prevent client caching
            HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false);
            HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            HttpContext.Current.Response.Cache.SetNoStore();
            Response.Cache.SetExpires(DateTime.Now);
            Response.Cache.SetValidUntilExpires(true);


            //check if IP is banned
            if (Utils.Settings.BannedIPs != null)
            {
                string clientIp = Utils.Various.GetUserIpAddress(Request);
                foreach (string ip in Utils.Settings.BannedIPs)
                {
                    if (StringUtils.IpAddressMatchesPattern(clientIp, ip))
                    {
                        Response.Write("Looks like your IP-address " + clientIp + " has been banned by the forum administrator.");
                        Response.End();
                    }
                }
            }

            //show-hide RSS links
            if (Utils.Settings.DisableRSS)
            {
                if (Master is AspNetForumMaster)
                {
                    ContentPlaceHolder cnt = ((AspNetForumMaster)Master).MainPlaceHolder;
                    if (cnt != null)
                    {
                        HtmlAnchor rssLink = cnt.FindControl("rssLink") as HtmlAnchor;
                        if (rssLink != null)
                        {
                            rssLink.Visible = false;
                        }
                    }
                }
            }

            bool integratedAuthEnabled = Utils.Settings.IntegratedAuthentication;

            //if the current forum user is UNDETERMINED
            if (CurrentUserID == 0)
            {
                //if login btn was pressed
                if (IsPostBack &&
                    Request.Form["LoginName"] != null &&
                    Request.Form["LoginName"] != "" &&
                    Request.Form["Password"] != null &&
                    Request.Form["Password"] != "" &&
                    Request.Form["loginbutton"] != null)
                {
                    IsNonLoginPostBack = false;

                    bool passwordOk, awaitsEmailActivation;
                    int  userId;
                    Utils.User.ProcessLogin(Request.Form["LoginName"], Request.Form["Password"], out passwordOk, out awaitsEmailActivation, out userId);

                    if (!passwordOk)
                    {
                        if (Master is AspNetForumMaster && ((AspNetForumMaster)Master).LoginErrorLabel != null)
                        {
                            ((AspNetForumMaster)Master).LoginErrorLabel.Visible = true;
                        }
                    }
                    else if (awaitsEmailActivation)
                    {
                        Session["InvalidLoginUserId"] = userId;
                        Response.Redirect("notactivated.aspx");
                    }
                    else                     //login successful - let's redirect to "default.aspx" but only for certain pages, like "activate.aspx" to not confuse the user
                    {
                        if (this is activate)
                        {
                            Response.Redirect("default.aspx");
                        }
                    }
                }
                else                 //user is not logged-in and it's not a postback to log him in
                {
                    //if asp.net detects an authenticated user
                    //and the appropriate setting in the web.config is enabled ("IntegratedAuthentication")
                    if (integratedAuthEnabled)
                    {
                        if (Page.User.Identity.IsAuthenticated)
                        {
                            Utils.User.ProcessMembershipLogin(User.Identity.Name);
                        }
                    }
                    //if nothing of the above is true, BUT
                    //if "remember me" cookie was found
                    else
                    {
                        if (Request.Cookies["aspnetforumUID"] != null && Request.Cookies["aspnetforumUID"].Value != "")
                        {
                            Utils.User.ProcessCookieLogin();
                        }
                    }
                }
            }
            else             //if the user IS logged in
            {
                if (integratedAuthEnabled)
                {
                    //if integrated auth in enabled, but the user in not authed - let's log him out
                    if (!User.Identity.IsAuthenticated)
                    {
                        Utils.User.Logout();
                        return;
                    }
                    //if integrated auth in enabled, but the usernames are different - let's re-login him
                    if (Session["aspnetforumUserName"].ToString() != User.Identity.Name)
                    {
                        Utils.User.ProcessMembershipLogin(User.Identity.Name);
                    }
                }

                //lets update the user's LastLogonDate
                Utils.User.UpdateCurrentUserLastLogonDate();
            }
        }
Пример #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // XỬ LÝ TIÊU ĐỀ CHO PAGE //

            string vmk_title_page = "TÌM KIẾM";

            string ten_cua_hang = ClassMain.Xu_Ly_Session("GET", "ten_cua_hang");

            if (ten_cua_hang != null)
            {
                if (ten_cua_hang.Trim() != "")
                {
                    vmk_title_page += " - " + ten_cua_hang;
                }
            }
            ContentPlaceHolder vmk_ContentPlaceHolder_for_title_page = (ContentPlaceHolder)this.Master.FindControl("vmk_ContentPlaceHolder_for_title_page");

            vmk_ContentPlaceHolder_for_title_page.Controls.Add(new LiteralControl(vmk_title_page));

            ////

            label_thongbao.Text = "";

            if (!IsPostBack)
            {
                // LẤY KIỂU TÌM KIẾM & TỪ KHÓA TỪ BIẾN TRUYỀN TRONG URL //

                string kieu    = "";
                string tu_khoa = "";

                if (Request.QueryString["kieu"] != null && Request.QueryString["kieu"].ToString() != "" && Request.QueryString["tu_khoa"] != null && Request.QueryString["tu_khoa"].ToString() != "")
                {
                    kieu    = Request.QueryString["kieu"].ToString().Trim();
                    tu_khoa = Request.QueryString["tu_khoa"].ToString().Trim();
                }

                repeater_list_data.DataSource = null;
                repeater_list_data.DataBind();

                // KIỂM TRA DỮ LIỆU NHẬP //

                if (kieu == "" || tu_khoa == "")
                {
                    label_thongbao.Text = "*** BẠN CHƯA NHẬP ĐẦY ĐỦ DỮ LIỆU TÌM KIẾM";
                    return;
                }

                keyword.Text = tu_khoa.Replace("'", "\\'");

                // TRUY XUẤT DỮ LIỆU TỪ CSDL //

                ClassCSDL vmk_csdl = new ClassCSDL();

                string id_dm_dich_vu       = "1";
                string sql_query_show_link = "";

                switch (kieu)
                {
                case "dich_vu":
                    sql_query_show_link = "(select ('SanPham.aspx?idsp=' + convert(varchar(100),san_pham.id_sp))) as link";
                    vmk_csdl.sql_query  = "select *," + sql_query_show_link + ", san_pham.ten_sp as tieu_de, san_pham.gioi_thieu as noi_dung," +
                                          " san_pham.ngay_sp as ngay_dang, san_pham.thang_sp as thang_dang, san_pham.nam_sp as nam_dang" +
                                          " from san_pham" +
                                          " where" +
                                          " id_dm = @id_dm_dich_vu" +
                                          " and (charindex(@key_word, ten_sp) > 0 or charindex(@key_word, gioi_thieu) > 0)" +
                                          " order by nam_sp desc, thang_sp desc, ngay_sp desc, id_sp desc"
                    ;
                    break;

                case "san_pham":
                    sql_query_show_link = "(select ('SanPham.aspx?idsp=' + convert(varchar(100),san_pham.id_sp))) as link";
                    vmk_csdl.sql_query  = "select *," + sql_query_show_link + ", san_pham.ten_sp as tieu_de, san_pham.gioi_thieu as noi_dung," +
                                          " san_pham.ngay_sp as ngay_dang, san_pham.thang_sp as thang_dang, san_pham.nam_sp as nam_dang" +
                                          " from san_pham" +
                                          " where" +
                                          " id_dm != @id_dm_dich_vu" +
                                          " and (charindex(@key_word, ten_sp) > 0 or charindex(@key_word, gioi_thieu) > 0)" +
                                          " order by nam_sp desc, thang_sp desc, ngay_sp desc, id_sp desc"
                    ;
                    break;

                case "tin_tuc":
                    sql_query_show_link = "(select ('TinTuc.aspx?id=' + convert(varchar(100),tin_tuc.id_tt))) as link,";
                    vmk_csdl.sql_query  = "select *," + sql_query_show_link +
                                          " ngay_tt as ngay_dang, thang_tt as thang_dang, nam_tt as nam_dang" +
                                          " from tin_tuc" +
                                          " where" +
                                          " ky_thuat = 0" +
                                          " and (charindex(@key_word, tieu_de) > 0 or charindex(@key_word, noi_dung) > 0)" +
                                          " order by nam_tt desc, thang_tt desc, ngay_tt desc, id_tt desc"
                    ;
                    break;

                case "ky_thuat":
                    sql_query_show_link = "(select ('TinTuc.aspx?id=' + convert(varchar(100),tin_tuc.id_tt))) as link,";
                    vmk_csdl.sql_query  = "select *," + sql_query_show_link +
                                          " ngay_tt as ngay_dang, thang_tt as thang_dang, nam_tt as nam_dang" +
                                          " from tin_tuc" +
                                          " where" +
                                          " ky_thuat = 1" +
                                          " and (charindex(@key_word, tieu_de) > 0 or charindex(@key_word, noi_dung) > 0)" +
                                          " order by nam_tt desc, thang_tt desc, ngay_tt desc, id_tt desc"
                    ;
                    break;

                case "hoi_dap":
                    sql_query_show_link = "(select ('HoiDap.aspx?id=' + convert(varchar(100),hoi_dap.id_hd))) as link,";
                    vmk_csdl.sql_query  = "select *," + sql_query_show_link +
                                          " ngay_hd as ngay_dang, thang_hd as thang_dang, nam_hd as nam_dang" +
                                          " from hoi_dap" +
                                          " where" +
                                          " chia_se = 1" +
                                          " and (charindex(@key_word, tieu_de) > 0 or charindex(@key_word, noi_dung) > 0)" +
                                          " order by nam_hd desc, thang_hd desc, ngay_hd desc, id_hd desc"
                    ;
                    break;
                }

                DataTable sql_param = vmk_csdl.sql_param;
                sql_param.Rows.Add("@key_word", tu_khoa, SqlDbType.NVarChar);
                sql_param.Rows.Add("@id_dm_dich_vu", id_dm_dich_vu, SqlDbType.Int);
                vmk_csdl.sql_param = sql_param;

                DataTable BANG_KQ = vmk_csdl.VMK_SQL_SELECT();

                if (BANG_KQ.Rows.Count == 0)
                {
                    label_thongbao.Text = "*** KHÔNG TÌM THẤY KẾT QUẢ NÀO";
                    return;
                }

                repeater_list_data.DataSource = BANG_KQ;
                repeater_list_data.DataBind();
            }
        }
Пример #29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ContentPlaceHolder cphMain
         = (ContentPlaceHolder)Master.FindControl("cphMain");
 }
Пример #30
0
    public static bool cstm_ClientValidate(object source, ServerValidateEventArgs args, Page sourcePage)
    {
        //Page p = new Page();
        //p = sourcePage;
        //string clientId = p.ClientID;
        ContentPlaceHolder cnt1 = new ContentPlaceHolder();

        cnt1 = (System.Web.UI.WebControls.ContentPlaceHolder)sourcePage.Form.FindControl("ContentPlaceHolder1");

        string          ControlName   = ((System.Web.UI.WebControls.BaseValidator)source).ControlToValidate;
        string          ValidatorName = ((System.Web.UI.Control)source).ID;
        TextBox         txtControl    = ((System.Web.UI.WebControls.TextBox)cnt1.FindControl(ControlName));
        CustomValidator cstmValidator = ((System.Web.UI.WebControls.CustomValidator)cnt1.FindControl(ValidatorName));

        if (args.Value.Trim().Trim('_').Trim('.').Length == 0)
        {
            // Page p = new Page();
            txtControl.BackColor = Color.Wheat;
            sourcePage.SetFocus(txtControl);
            cstmValidator.ErrorMessage = "Required";
            args.IsValid = false;
        }
        else if (args.Value.Trim().Trim('_') == "0")
        {
            args.IsValid         = false;
            txtControl.BackColor = Color.Wheat;
            sourcePage.SetFocus(txtControl);
            cstmValidator.ErrorMessage = "Invalid";
        }
        else if (Convert.ToDecimal(args.Value.Trim().Trim('_')) == 0)
        {
            if (ControlName == "txtOpnAmt" || ControlName == "txtUpdOpnAmt")      // opening Amount (txtOpnAmt) can be zero
            {
                txtControl.BackColor = Color.White;
                args.IsValid         = true;
            }
            else                                                         // closing balance (txtClsAmt) can not be zero
            {
                args.IsValid = false;
                //   txtControl.BackColor = Color.Wheat;
                sourcePage.SetFocus(txtControl);
                cstmValidator.ErrorMessage = "Invalid";
            }
        }
        else
        {
            if (ControlName == "txtEntYr")   //harvinder - Security Deposit Entry
            {
                if (args.Value.Trim().Trim('_').Length < 4)
                {
                    args.IsValid         = false;
                    txtControl.BackColor = Color.Wheat;
                    sourcePage.SetFocus(txtControl);
                    cstmValidator.ErrorMessage = "Invalid";
                }
                else
                {
                    txtControl.BackColor = Color.White;
                    args.IsValid         = true;
                }
            }
            else if (ControlName == "txtVouchNo" || ControlName == "txtRefVouchNo")   // harvinder -  Security Deposit Updation
            {
                if (args.Value.Trim().Trim('_').Length < 7)
                {
                    args.IsValid         = false;
                    txtControl.BackColor = Color.Wheat;
                    sourcePage.SetFocus(txtControl);
                    cstmValidator.ErrorMessage = "Invalid";
                }
                else
                {
                    txtControl.BackColor = Color.White;
                    args.IsValid         = true;
                }
            }
            else if (ControlName == "txtToDt")
            {
                if (args.Value.Trim().Trim('_').Length < 6)
                {
                    args.IsValid         = false;
                    txtControl.BackColor = Color.Wheat;
                    sourcePage.SetFocus(txtControl);
                    cstmValidator.ErrorMessage = "Cheque No should be of 6 to 8 chars";
                }
                else
                {
                    TextBox txtFrom = new TextBox();
                    txtFrom = (System.Web.UI.WebControls.TextBox)cnt1.FindControl("txtFromDt");
                    TextBox txtTo = new TextBox();
                    txtTo = (System.Web.UI.WebControls.TextBox)cnt1.FindControl("txtToDt");

                    int valFrom, valTo;

                    if (txtFrom.Text.Trim().Trim('_') != "")
                    {
                        valFrom = Convert.ToInt32(((System.Web.UI.WebControls.TextBox)cnt1.FindControl("txtFromDt")).Text.Trim().Trim('_'));// Convert.ToInt32(txtFromDt.Text.Trim('_'));
                    }
                    else
                    {
                        valFrom = 0;
                    }
                    if (txtTo.Text.Trim().Trim('_') != "")
                    {
                        valTo = Convert.ToInt32(((System.Web.UI.WebControls.TextBox)cnt1.FindControl("txtToDt")).Text.Trim().Trim('_'));// Convert.ToInt32(txtToDt.Text.Trim('_'));
                    }
                    else
                    {
                        valTo = 0;
                    }

                    if (valFrom == valTo)
                    {
                        args.IsValid               = false;
                        txtControl.BackColor       = Color.Wheat;
                        cstmValidator.ErrorMessage = "Chq No From can not equal Chq No To";
                        sourcePage.SetFocus(txtControl);
                    }
                    else if (valFrom >= valTo)
                    {
                        args.IsValid               = false;
                        txtControl.BackColor       = Color.Wheat;
                        cstmValidator.ErrorMessage = "Chq No From shoud be less then Chq No To";
                        sourcePage.SetFocus(txtControl);
                    }
                    else if (valFrom < valTo)
                    {
                        int diff = valTo - valFrom;
                        if (diff == 9 || diff == 19 || diff == 24 || diff == 49 || diff == 99 || diff == 399)
                        {
                            args.IsValid         = true;
                            txtControl.BackColor = Color.White;
                        }
                        else
                        {
                            args.IsValid               = false;
                            txtControl.BackColor       = Color.Wheat;
                            cstmValidator.ErrorMessage = "Difference b/w From and To Chq No should be 10,20,25,50,100 or 400";
                            sourcePage.SetFocus(txtControl);
                        }
                    }
                }
            }
            else if (ControlName == "txtFromDt")
            {
                if (args.Value.Trim().Trim('_').Length < 6)
                {
                    args.IsValid         = false;
                    txtControl.BackColor = Color.Wheat;
                    sourcePage.SetFocus(txtControl);
                    cstmValidator.ErrorMessage = "Cheque No should be of 6 to 8 chars";
                }
                else
                {
                    txtControl.BackColor = Color.White;
                    args.IsValid         = true;
                }
            }
            else if (ControlName == "txtChqNo")
            {
                if (args.Value.Trim().Trim('_').Length < 6)
                {
                    args.IsValid = false;
                    sourcePage.SetFocus(txtControl);
                    cstmValidator.ErrorMessage = "Cheque No should be of 6 to 8 chars";
                }
                else
                {
                    txtControl.BackColor = Color.White;
                    args.IsValid         = true;
                }
            }
            else
            {
                txtControl.BackColor = Color.White;
                args.IsValid         = true;
            }
        }
        return(args.IsValid);
    }
Пример #31
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // 01/08/2006 Paul.  The viewstate is no longer disabled, so we can go back to using ctlSearch.NAME.
                string sNAME = ctlSearch.NAME;                  //Sql.ToString(Request[ctlSearch.ListUniqueID]);
                ctlSearch.Visible        = Sql.IsEmptyString(sNAME);
                ctlLayoutButtons.Visible = !ctlSearch.Visible;
                // 09/08/2007 Paul.  Add a list header so we will know what list we are working on.
                if (ctlListHeader != null)
                {
                    ctlListHeader.Visible = !ctlSearch.Visible;
                    ctlListHeader.Title   = sNAME;
                }

                if (!Sql.IsEmptyString(sNAME) && sNAME != Sql.ToString(ViewState["LAYOUT_VIEW_NAME"]))
                {
                    // 01/08/2006 Paul.  We are having a problem with the ViewState not loading properly.
                    // This problem only seems to occur when the NewRecord is visible and we try and load a different view.
                    // The solution seems to be to hide the Search dialog so that the user must Cancel out of editing the current view.
                    // This works very well to clear the ViewState because we GET the next page instead of POST to it.

                    SetPageTitle(sNAME);
                    Page.DataBind();
                    tblMain.EnableViewState = false;

                    string sMODULE_NAME = String.Empty;
                    string sVIEW_NAME   = String.Empty;
                    GetModuleName(sNAME, ref sMODULE_NAME, ref sVIEW_NAME);
                    GetLayoutFields(sNAME);
                    LayoutView_Bind();

                    ViewState["MODULE_NAME"]      = sMODULE_NAME;
                    ViewState["VIEW_NAME"]        = sVIEW_NAME;
                    ViewState["LAYOUT_VIEW_NAME"] = sNAME;
                    SaveFieldState();
                    if (dtFields.Rows.Count > 0)
                    {
                        ViewState["ROW_MINIMUM"] = dtFields.Rows[0][LayoutIndexName()];
                    }
                    else
                    {
                        ViewState["ROW_MINIMUM"] = 0;
                    }
                }
                // 02/08/2007 Paul.  The NewRecord control is now in the MasterPage.
                ContentPlaceHolder plcSidebar = Page.Master.FindControl("cntSidebar") as ContentPlaceHolder;
                if (plcSidebar != null)
                {
                    ctlNewRecord = plcSidebar.FindControl("ctlNewRecord") as NewRecord;
                    if (ctlNewRecord != null)
                    {
                        if (Sql.IsEmptyString(sNAME))
                        {
                            ctlNewRecord.Clear();
                        }
                        else
                        {
                            ctlNewRecord.MODULE_NAME = Sql.ToString(ViewState["MODULE_NAME"]);
                            ctlNewRecord.VIEW_NAME   = Sql.ToString(ViewState["VIEW_NAME"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                ctlLayoutButtons.ErrorText = ex.Message;
            }
        }
Пример #32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["OrgID"] == null)
            {
                db_Accounts.SetOrgSessionID(User.Identity.Name, HttpContext.Current.Request.Url.LocalPath);
            }

            if (!IsPostBack)
            {
                //display left menu as selected
                ContentPlaceHolder cp = this.Master.Master.FindControl("MainContent") as ContentPlaceHolder;
                HyperLink          hl = (HyperLink)cp.FindControl("lnkMonLocList");
                if (hl != null)
                {
                    hl.CssClass = "leftMnuBody sel";
                }

                grdMonLoc.Columns[5].Visible  = (Session["MLOC_HUC_EIGHT"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[6].Visible  = (Session["MLOC_HUC_TWELVE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[7].Visible  = (Session["MLOC_TRIBAL_LAND"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[10].Visible = (Session["MLOC_SOURCE_MAP_SCALE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[11].Visible = (Session["MLOC_HORIZ_COLL_METHOD"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[12].Visible = (Session["MLOC_HORIZ_REF_DATUM"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[13].Visible = (Session["MLOC_VERT_MEASURE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[14].Visible = (Session["MLOC_VERT_MEASURE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[15].Visible = (Session["MLOC_VERT_MEASURE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[16].Visible = (Session["MLOC_VERT_MEASURE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[17].Visible = (Session["MLOC_COUNTY_CODE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[18].Visible = (Session["MLOC_STATE_CODE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[19].Visible = (Session["MLOC_COUNTRY_CODE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[20].Visible = (Session["MLOC_WELL_TYPE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[21].Visible = (Session["MLOC_AQUIFER_NAME"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[22].Visible = (Session["MLOC_FORMATION_TYPE"].ConvertOrDefault <Boolean>());
                grdMonLoc.Columns[23].Visible = (Session["MLOC_WELLHOLE_DEPTH"].ConvertOrDefault <Boolean>());

                chkFields.Items[0].Selected  = (Session["MLOC_HUC_EIGHT"].ConvertOrDefault <Boolean>());
                chkFields.Items[1].Selected  = (Session["MLOC_HUC_TWELVE"].ConvertOrDefault <Boolean>());
                chkFields.Items[2].Selected  = (Session["MLOC_TRIBAL_LAND"].ConvertOrDefault <Boolean>());
                chkFields.Items[3].Selected  = (Session["MLOC_SOURCE_MAP_SCALE"].ConvertOrDefault <Boolean>());
                chkFields.Items[4].Selected  = (Session["MLOC_HORIZ_COLL_METHOD"].ConvertOrDefault <Boolean>());
                chkFields.Items[5].Selected  = (Session["MLOC_HORIZ_REF_DATUM"].ConvertOrDefault <Boolean>());
                chkFields.Items[6].Selected  = (Session["MLOC_VERT_MEASURE"].ConvertOrDefault <Boolean>());
                chkFields.Items[7].Selected  = (Session["MLOC_COUNTRY_CODE"].ConvertOrDefault <Boolean>());
                chkFields.Items[8].Selected  = (Session["MLOC_STATE_CODE"].ConvertOrDefault <Boolean>());
                chkFields.Items[9].Selected  = (Session["MLOC_COUNTY_CODE"].ConvertOrDefault <Boolean>());
                chkFields.Items[10].Selected = (Session["MLOC_WELL_TYPE"].ConvertOrDefault <Boolean>());
                chkFields.Items[11].Selected = (Session["MLOC_AQUIFER_NAME"].ConvertOrDefault <Boolean>());
                chkFields.Items[12].Selected = (Session["MLOC_FORMATION_TYPE"].ConvertOrDefault <Boolean>());
                chkFields.Items[13].Selected = (Session["MLOC_WELLHOLE_DEPTH"].ConvertOrDefault <Boolean>());


                //ONLY ALLOW EDIT FOR AUTHORIZED USERS OF ORG
                btnAdd.Enabled = false;
                grdMonLoc.Columns[0].Visible = false;
                T_WQX_USER_ORGS uo = db_WQX.GetWQX_USER_ORGS_ByUserIDX_OrgID(Utils.GetUserIDX(User), Session["OrgID"].ToString());
                if (uo != null)
                {
                    if (uo.ROLE_CD == "A" || uo.ROLE_CD == "U")
                    {
                        btnAdd.Enabled = true;
                        grdMonLoc.Columns[0].Visible = true;
                    }
                }
            }
        }
Пример #33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // XỬ LÝ TIÊU ĐỀ CHO PAGE //

            string vmk_title_page = "QUẢN LÝ ĐƠN HÀNG";

            string ten_cua_hang = ClassMain.Xu_Ly_Session("GET", "ten_cua_hang");

            if (ten_cua_hang != null)
            {
                if (ten_cua_hang.Trim() != "")
                {
                    vmk_title_page += " - " + ten_cua_hang;
                }
            }
            ContentPlaceHolder vmk_ContentPlaceHolder_for_title_page = (ContentPlaceHolder)this.Master.FindControl("vmk_ContentPlaceHolder_for_title_page");

            vmk_ContentPlaceHolder_for_title_page.Controls.Add(new LiteralControl(vmk_title_page));

            ////

            btn_khongluu.NavigateUrl = PageName;

            label_thongbao.Text = "";

            // LẤY ID THÀNH VIÊN TỪ SESSION //

            id_thanh_vien = ClassMain.Xu_Ly_Session("GET", "id_thanh_vien");
            if (id_thanh_vien == null)
            {
                id_thanh_vien = "";
            }

            if (id_thanh_vien == "")
            {
                Response.Redirect("Default.aspx"); return;
            }

            // KIỂM TRA QUYỀN HẠN //

            if (Kiem_Tra_Quyen_Han() == false)
            {
                Response.Redirect("Default.aspx"); return;
            }

            // BEGIN //

            if (!IsPostBack)
            {
                // LẤY DỮ LIỆU TỪ CSDL //

                System.Data.DataView vmk_dataview;

                sql_datasource.SelectCommand = "select don_hang.*, ho_ten," +
                                               " (select count(*) from don_hang_chi_tiet where don_hang_chi_tiet.id_dh = don_hang.id_dh) as so_luong_hang_hoa" +
                                               " from don_hang, thanh_vien" +
                                               " where don_hang.id_tv = thanh_vien.id_tv" +
                                               " order by khoa asc, nam_dh desc, thang_dh desc, ngay_dh desc, id_dh desc"
                ;

                sql_datasource.SelectParameters.Clear();
                vmk_dataview = (DataView)sql_datasource.Select(DataSourceSelectArguments.Empty);
                if (vmk_dataview.Count != 0)
                {
                    repeater_list_data.DataSource = sql_datasource;
                    repeater_list_data.DataBind();
                }
                else
                {
                    label_thongbao.Text = ClassMain.TAO_THONG_BAO("CHƯA CÓ DỮ LIỆU", "", false);
                    return;
                }
            }
        }