Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     pref = new prefs();
     pref.Owner = this;
     if (File.Exists("prefs"))
     {
         BinaryFormatter formatter = new BinaryFormatter();
         FileStream inputStream = File.OpenRead("prefs");
         try
         {
             Con = (Connect)formatter.Deserialize(inputStream);
         }
         catch (Exception ex)
         {
             System.Windows.Forms.MessageBox.Show("Ошибка:\n" + ex.Message, "",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
         inputStream.Close();
     }
     else
     {
         BinaryFormatter formatter = new BinaryFormatter();
         FileStream outputStream = File.OpenWrite("prefs");
         formatter.Serialize(outputStream, Con);
         outputStream.Close();
     }
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Awake()
 {
     score = 0;
     scoreEditor = 0;
     scorePanel = GetComponent<Text>();
     server = GameObject.FindGameObjectWithTag("Server").GetComponent<Connect>();
 }
Ejemplo n.º 3
0
    public override void erlReceive(Connect connect, ErlKVMessage message)
    {
        if (!MiniConnectManager.IsRobot )
        {
            try
            {

               // Log.debug("===============this is socketReceive! cmd=" + message.Cmd + " jsonString " + message.toJsonString(),true);
            }
            catch (Exception exception)
            {
                //Log.debug(" =================== : " + exception.ToString(),true);
            }
        }
        string cmd = message.Cmd;
        switch (cmd)
        {
            case "r_ok":
            case "r_err":
            {
                int port = message.getPort();
                ErlEntry entry = this.removeReciveFun(port);
                if ((entry == null) || (entry.receiveFun == null))
                {
                    return;
                }
                entry.receiveFun(connect, message);
                break;
            }
            default:
                message.addValue("cmd", new ErlString(cmd));
                this.defaultHandle(connect, message);
                break;
        }
    }
 /// <summary>
 /// This method returns all the societies from the database.
 /// </summary>
 /// <returns>It returns a datatable containing all the societies.</returns>
 public static DataTable GetAllSocieties()
 {
     sql = "SELECT * FROM Societies";
     Connect.ConnectEMS();
     c = new Connect(sql);
     return c.ds.Tables[0];
 }
 /// <summary>
 /// This method fetches the list of branches from the database.
 /// </summary>
 /// <returns>It returns a data set containing the list of branches.</returns>
 public static DataSet GetAllBranches()
 {
     sql = "SELECT * FROM Branches";
     Connect.ConnectTT();
     c = new Connect(sql);
     return c.ds;
 }
 /// <summary>
 /// This method fetches all the events from the database.
 /// </summary>
 /// <returns>It returns a datatable containing all the events.</returns>
 public static DataTable GetAllEvents()
 {
     sql = "SELECT * FROM Events";
     Connect.ConnectEMS();
     c = new Connect(sql);
     return c.ds.Tables[0];
 }
Ejemplo n.º 7
0
 public User()
 {
     _Updater = new Regulus.Utility.Updater<Regulus.Utility.IUpdatable>();
     _ConnectProvider = new Regulus.Remoting.Ghost.TProvider<TestNativeGameCore.IConnect>();
     _Connecter = new Connect();
     _Complex = new Regulus.Remoting.Ghost.Native.Agent();
 }
 public ExpressionHighlighterPlugin(Connect con, DTE2 appObject, AddIn addinInstance)
     : base(con, appObject, addinInstance)
 {
     workerToDos.WorkerReportsProgress = false;
     workerToDos.WorkerSupportsCancellation = true;
     workerToDos.DoWork += new System.ComponentModel.DoWorkEventHandler(workerToDos_DoWork);
 }
 protected void BtnStart_Click(object sender, EventArgs e)
 {
     sql = "SELECT SubjectType FROM Subject WHERE SubjectID=" + int.Parse(DDLSubjects.SelectedValue.ToString()) + "";
     c = new Connect(sql);
     if (c.ds.Tables[0].Rows[0]["SubjectType"].ToString().Equals("Theory"))
     {
         sql = "SELECT StudentNo,RollNo,Name FROM Student WHERE SectionID=" + int.Parse(DDLSectionGroup.SelectedValue.ToString()) + " AND Semester=(SELECT Semester FROM Subject WHERE SubjectID=" + int.Parse(DDLSubjects.SelectedValue.ToString()) + ")";
         c = new Connect(sql);
         GridView1.DataSource = c.ds;
         GridView1.DataBind();
     }
     else
     {
         sql = "SELECT StudentNo,RollNo,Name FROM Student WHERE GroupID=" + int.Parse(DDLSectionGroup.SelectedValue.ToString()) + " AND Semester=(SELECT Semester FROM Subject WHERE SubjectID=" + int.Parse(DDLSubjects.SelectedValue.ToString()) + ")";
         c = new Connect(sql);
         GridView1.DataSource = c.ds;
         GridView1.DataBind();
     }
     BtnSubmit.Visible = true;
     sql = "SELECT * FROM AttendanceType";
     c = new Connect(sql);
     foreach (GridViewRow row in GridView1.Rows)
     {
         DropDownList d = (DropDownList)row.FindControl("DDLAttendanceType");
         d.DataSource = c.ds;
         d.DataTextField = "AttendanceTypeName";
         d.DataValueField = "AttendanceTypeID";
         d.Width = 40;
         d.DataBind();
         d.Items[2].Attributes.CssStyle["Color"] = "red";
     }
 }
Ejemplo n.º 10
0
 void Test01()
 {
     var gd = new Connect();
     var sample = new Sample
                      {
                          Method = "GET",
                          Uri = "/test",
                          Timestamp = DateTime.Now.TimeOfDay.TotalMilliseconds,
                          ResponseTime = 100,
                          CpuTime = 20,
                          Context =
                              new[]
                                  {
                                      new Context {Name = "/", ResponseTime = 11},
                                      new Context {Name = "/one", ResponseTime = 12},
                                      new Context {Name = "/two", ResponseTime = 13}
                                  }
                      };
     gd.Init("26873", "testing", logger, null);
     for (int i = 0; i < 1000; i++)
     {
         gd.Store(sample, logger, null);
         Thread.Sleep(300);
     }
     gd.Term(logger, null);
     Console.Read();
 }
Ejemplo n.º 11
0
    //init
    void Start() { 
        //get game objects from scene
        globalObj = GameObject.FindWithTag(TAG_GLOBAL); //global game object
        globalScript = globalObj.GetComponent<Global>(); //global script
        setupObj = GameObject.FindWithTag(TAG_SETUP); //setup game object
        connectScript = setupObj.GetComponent<Connect>(); //connect script
        activateScript = setupObj.GetComponent<Activate>(); //activate script

        //disable scripts to start
        //note: disable/uncheck scripts in the Unity interface
        connectScript.enabled = false;
        activateScript.enabled = false;

        //state manager
        //transition into scene
        //initialize since this is the first scene
        if (StateManager.Instance != null) {
            //set the transition effects for the state manager
            StateManager.Instance.gameObject.GetComponent<TransitionFade>().isFadingIn = true;
            StateManager.Instance.gameObject.GetComponent<TransitionFade>().isHoldFade = false;
        }

        //audio manager
        //initialize since this is the first scene
        if (AudioManager.Instance != null) {
            //set the transition effects for the audio manager
            //bgm
            AudioManager.Instance.switchBgmAfterDelay(AudioManager.Instance.bgmMenu, 0.0f);
            AudioManager.Instance.bgmIsFadingIn = true;
            AudioManager.Instance.bgmIsHoldFade = false;
        }

    } //end function
Ejemplo n.º 12
0
        public BIDSHelperPluginReference(Type t, DTE2 applicationObject, AddIn addInInstance, Connect addinCore)
        {
            pluginType = t;
            _applicationObject = applicationObject;
            _addInInstance = addInInstance;
            _core = addinCore;

        }
 /// <summary>
 /// This method fetches the details of a particular event.
 /// </summary>
 /// <param name="eventID">An integer parameter containing the ID of the event.</param>
 /// <returns>It returns a data table containing the details of the event.</returns>
 public static DataTable GetEventDetails(int eventID)
 {
     sql = "SELECT * FROM Events WHERE EventID=@eventID";
     string[] s = { "@eventID" };
     Connect.ConnectEMS();
     c = new Connect(sql, s, eventID);
     return c.ds.Tables[0];
 }
 /// <summary>
 /// This method fetches the details of the organiser based on the username and password.
 /// </summary>
 /// <param name="username">A string containing the username of the organiser.</param>
 /// <param name="password">A string containing the password of the organiser.</param>
 /// <returns>It returns a data table containing the details of the organiser.</returns>
 public static DataTable GetOrganiserDetails(string username,string password)
 {
     sql = "SELECT * FROM Login WHERE Username=@username AND Password=@password";
     Connect.ConnectEMS();
     string[] s = { "@username", "@password" };
     c = new Connect(sql, s, username, password);
     return c.ds.Tables[0];
 }
 /// <summary>
 /// This method fetches the details of the student from the EMS database based on the student number.
 /// </summary>
 /// <param name="studentNumber">A string containing the student number of the student.</param>
 /// <returns>It returns a data table containing the details of the student.</returns>
 public static DataTable GetStudentDetails(string studentNumber)
 {
     sql = "SELECT * FROM Students WHERE StudentNo=@StudentNo";
     Connect.ConnectEMS();
     string[] s = { "@StudentNo" };
     c = new Connect(sql, s, studentNumber);
     return c.ds.Tables[0];
 }
Ejemplo n.º 16
0
 // Use this for initialization
 void Awake()
 {
     gameOverScreen.SetActive(false);
     instance = this;
     GameObject serverObj = GameObject.FindGameObjectWithTag("Server");
     server = serverObj.GetComponent<Connect>();
     dead = 0;
 }
 /// <summary>
 /// This method fetches the events of a particular society.
 /// </summary>
 /// <param name="societyID">An integer parameter containing the societyID</param>
 /// <returns>It returns a data table containing the events.</returns>
 public static DataTable GetEvents(int societyID)
 {
     sql = "SELECT * FROM EVENTS WHERE SocietyID=@societyID";
     Connect.ConnectEMS();
     string[] s = { "@societyID" };
     c = new Connect(sql, s, societyID);
     return c.ds.Tables[0];
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["StudentNo"] == null)
            Response.Redirect("~/Default.aspx");
        else
        {
            //-----------Get the details of the student-----------------//
            sql = "SELECT * FROM Student WHERE StudentNo='" + Session["StudentNo"].ToString() + "'";
            student = new Connect(sql);
            LblName.Text = " " + student.ds.Tables[0].Rows[0]["Name"].ToString();
            LblStudentNo.Text = student.ds.Tables[0].Rows[0]["StudentNo"].ToString();
            LblRollNo.Text = student.ds.Tables[0].Rows[0]["RollNo"].ToString();
            LblSemester.Text = student.ds.Tables[0].Rows[0]["Semester"].ToString();

            sql = "SELECT * FROM Department WHERE DepartmentID=" + int.Parse(student.ds.Tables[0].Rows[0]["DepartmentID"].ToString()) + "";
            c = new Connect(sql);
            LblDepartment.Text = c.ds.Tables[0].Rows[0]["DepartmentName"].ToString();
            sql = "SELECT * FROM Section WHERE SectionID=" + int.Parse(student.ds.Tables[0].Rows[0]["SectionID"].ToString()) + "";
            c = new Connect(sql);
            LblSection.Text = c.ds.Tables[0].Rows[0]["SectionName"].ToString();
            sql = "SELECT * FROM Groups WHERE GroupID=" + int.Parse(student.ds.Tables[0].Rows[0]["GroupID"].ToString()) + "";
            c = new Connect(sql);
            LblGroup.Text = c.ds.Tables[0].Rows[0]["GroupName"].ToString();

            //Get the subjects which the student is studying-------------//
            sql = "SELECT * FROM Subject WHERE Semester=" + int.Parse(student.ds.Tables[0].Rows[0]["Semester"].ToString()) + " AND DepartmentID=" + int.Parse(student.ds.Tables[0].Rows[0]["DepartmentID"].ToString()) + "";
            c = new Connect(sql);
            GridView1.DataSource = c.ds;
            GridView1.DataBind();

            //Get the attendance for each subject
            foreach (GridViewRow row in GridView1.Rows)
            {
                sql = "SELECT * FROM Attendance WHERE SubjectID=(SELECT SubjectID FROM Subject WHERE SubjectName='" + row.Cells[1].Text + "' AND Semester=" + int.Parse(student.ds.Tables[0].Rows[0]["Semester"].ToString()) + " AND DepartmentID=" + int.Parse(student.ds.Tables[0].Rows[0]["DepartmentID"].ToString()) + ") AND (SectionID=(SELECT SectionID FROM Section WHERE SectionName='" + LblSection.Text + "') OR GroupID=(SELECT GroupID FROM Groups WHERE GroupName='" + LblGroup.Text + "'))";
                subjectAttendance = new Connect(sql);
                DataTable subjectAttendanceTable = subjectAttendance.ds.Tables[0];
                var totalClasses = (from i in subjectAttendanceTable.AsEnumerable() select new { Date = i.Field<DateTime>("Date"), LectureID = i.Field<int>("LectureID") }).Distinct().Count();
                row.Cells[3].Text = totalClasses.ToString();

                int numberOfAbsent = 0;
                for (int k = 0; k < subjectAttendance.ds.Tables[0].Rows.Count; k++)
                {
                    if (subjectAttendance.ds.Tables[0].Rows[k]["StudentNo"].ToString().Equals(LblStudentNo.Text + "   "))
                    {
                        numberOfAbsent = numberOfAbsent + 1;
                    }
                }
                Label totalPresent = (Label)row.FindControl("LblPresent");
                totalPresent.Text = (totalClasses - numberOfAbsent).ToString();
                Label percentageAttendance = (Label)row.FindControl("LblPercentageAttendance");
                percentageAttendance.Text = (float.Parse(totalPresent.Text) * 100 / totalClasses).ToString();
                if (float.Parse(percentageAttendance.Text) < 75)
                {
                    row.BackColor = System.Drawing.ColorTranslator.FromHtml("#FF8D7C");
                }
            }
        }
    }
 /// <summary>
 /// This method inserts the college into the database.
 /// </summary>
 /// <param name="collegeName">A string containing the name of the college</param>
 /// <returns>It returns the generated id of the college.</returns>
 public static int AddNewCollege(string collegeName)
 {
     sql = "INSERT INTO Colleges(CollegeName) VALUES(@collegeName)";
     Connect.ConnectTT();
     string[] s = { "@collegeName" };
     c = new Connect(sql, s, collegeName);
     int collegeID = -1;
     collegeID = c.lastId;
     return collegeID;
 }
 /// <summary>
 /// This method returns the event id the team is regisreted in.
 /// </summary>
 /// <param name="teamID">An integer parameter containing the id of the team.</param>
 /// <returns>It returns an integer parameter containing the event id.</returns>
 public static int GetEventID(int teamID)
 {
     sql = "SELECT * FROM EventRegistrations WHERE TeamID=@teamID";
     Connect.ConnectEMS();
     string[] s = { "@teamID" };
     c = new Connect(sql, s, teamID);
     if (c.ds.Tables[0].Rows.Count != 0)
         return int.Parse(c.ds.Tables[0].Rows[0]["EventID"].ToString());
     else
         return -1;
 }
Ejemplo n.º 21
0
 public DataSet GetLocation()
 {
     Connect con_obj = new Connect();
       con = con_obj.Getconn();
       DataSet dsL = new DataSet();
       SqlCommand cmd = new SqlCommand("GetLocation_SP", con);
       cmd.CommandType = CommandType.StoredProcedure;
       SqlDataAdapter da = new SqlDataAdapter(cmd);
       da.Fill(dsL);
      return dsL;
 }
Ejemplo n.º 22
0
        public void when_serializing_connect_then_can_roundtrip()
        {
            var message = new Connect("foo", "bar");
            var bytes = MessageChannel.Convert(message);

            var deserialized = MessageChannel.Convert(bytes) as Connect;

            Assert.NotNull(deserialized);
            Assert.Equal("foo", deserialized.DeviceId);
            Assert.Equal("bar", deserialized.DeviceType);
        }
Ejemplo n.º 23
0
 public Host()
 {
     InitializeComponent();
     m_Log = log4net.LogManager.GetLogger("Kaitrade");
     m_SubscribeMD = new RegisterSubject(this.doSubscribeMD);
     m_RegisterTS = new RequestTS(this.doRequestTS);
     m_ProcessMessage = new ProcessMessage(this.doProcessMessage);
     m_Connect = new Connect(this.doConnect);
     //timer1.Interval = 0;
     //timer1.Start();
 }
Ejemplo n.º 24
0
    public DataSet GetAllLocation()
    {
        Connect objcon = new Connect();
        SqlConnection con = objcon.Getconn();

        DataSet DSGetLoc = new DataSet();
        SqlCommand cmd = new SqlCommand("GetAllLocation_SP", con);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(DSGetLoc);
        return DSGetLoc;
    }
 /// <summary>
 /// This method creates a new team in the eventregistration table. If the event is a single player, then it stores the ttid in the 
 /// table otherwise it is set to 0;
 /// </summary>
 /// <param name="e">An object of Event Class.</param>
 /// <param name="t">An object of Team Class.</param>
 /// <returns></returns>
 public static int CreateNewTeam(Event e, Team t)
 {
     sql = "INSERT INTO EventRegistrations(EventID,TTID,CurrentLevel) VALUES(@eventID,@ttID,@currentLevel)";
     Connect.ConnectEMS();
     string[] s = { "@eventID", "@ttID", "@currentLevel" };
     if (e.IsSinglePlayer)
         c = new Connect(sql, s, e.ID, t.Participants[0].TTID, 1);
     else
         c = new Connect(sql, s, e.ID, 0, 1);
     int teamID = -1;
     teamID = c.lastId;
     return teamID;
 }
Ejemplo n.º 26
0
    public override void erlReceive(Connect connect, ErlKVMessage message)
    {
        //this.readMessage (message);
        //Log.Info ("+++++111111111---222222222" + this.isSend + "+++++++++++");
        /*if (messagePort!=0&& messagePort == message.getPort()) {
            String strValue = ConfigHelper.GetAppConfig ("/yxzh/role/get_user");
            ErlKVMessage msg = new ErlKVMessage ("r_ok");
            msg.addValue (null, new ErlInt (messagePort));
            ErlType[] et = StringKit.strToErlTypeArray (strValue);
            ErlArray ea = new ErlArray (et);
            msg.addValue ("msg", ea);
            base.send (this.erlConnect, msg);
            if (this.erlConnect.dataBuffer.bytesAvailable > 0) {
                byte[] bts = new byte[this.erlConnect.dataBuffer.bytesAvailable];
                this.dataBuffer.readBytes (bts, 0, (int)this.erlConnect.dataBuffer.bytesAvailable);
                this.erlConnect.socket.Send (bts);
                this.dataBuffer = new ByteBuffer (bts);
            }
            isSend = true;
        }
        */
        FilterCmdManager.Instance.procPort (message.Cmd, message.getPort ());
        /*(if (message.Cmd == "/yxzh/miai_port/get_info") {
            messagePort = message.getPort();
            needProcPortDict.Add (message.getPort(), message.Cmd);
        }
        */
        Log.Info(message.Cmd+"|"+ message.toJsonString());
        //if (!isSend && this.erlConnect.transCallBack != null) {
            //this.erlConnect.transCallBack.Invoke ();

        int len = (int)this.dataBuffer.bytesAvailable;
        int pos = this.dataBuffer.position;

        byte[] tmp = new byte[len];
        byte[] bak = new byte[pos];

        this.dataBuffer.position = 0;
        this.dataBuffer.readBytes (bak, 0, pos);
        this.dataBuffer.readBytes (tmp, 0, len);
        this.dataBuffer.clear ();
        this.dataBuffer = new ByteBuffer (tmp);

        Log.Debug ("ConnectCount.getInstance().number=" + ConnectCount.getInstance ().number);
        //base.erlConnect.socket.Send (bak);

        if (this.dataBuffer.bytesAvailable > 0) {
            this.receive (null, this.isServer);
        }
    }
 protected void BtnRegister_Click(object sender, EventArgs e)
 {
     sql = "INSERT INTO Student VALUES('" + TxtBxStudentNo.Text + "'," + TxtBxRollNo.Text + ",'" + TxtBxName.Text.ToUpper() + "'," + DDLSemester.SelectedItem.Value + "," + DDLDepartment.SelectedValue + "," + DDLSection.SelectedValue + "," + DDLGroup.SelectedValue + ")";
     try
     {
         c = new Connect(sql);
         LblResult.Text = "Registered";
         LblResult.ForeColor = Color.Green;
     }
     catch (Exception ex)
     {
         LblResult.Text = ex.ToString();
         LblResult.ForeColor = Color.Red;
     }
 }
 /// <summary>
 /// This method deletes a team from the database.
 /// </summary>
 /// <param name="teamID">An integer parameter containing the team ID.</param>
 /// <returns>It returns true if the team is successfully deleted otherwise false.</returns>
 public static bool DeleteTeam(int teamID)
 {
     sql = "DELETE FROM Teams WHERE TeamID=@teamID";
     Connect.ConnectEMS();
     string[] s = { "@teamID" };
     try
     {
         c = new Connect(sql, s, teamID);
         return true;
     }
     catch(Exception ex)
     {
         return false;
     }
 }
 protected void BtnLoginStudent_Click(object sender, EventArgs e)
 {
     sql = "SELECT * FROM Student WHERE StudentNo='" + TxtBxLoginStudentNo.Text + "'";
     c = new Connect(sql);
     if (c.ds.Tables[0].Rows.Count != 0)
     {
         Session["StudentNo"] = c.ds.Tables[0].Rows[0]["StudentNo"].ToString();
         Response.Redirect("~/Students/ViewAttendance.aspx");
     }
     else
     {
         LblStudentNoCheck.Text = "Not Registered";
         LblStudentNoCheck.ForeColor = Color.Red;
     }
 }
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     sql = "INSERT INTO Login VALUES('" + DDLFacultyName.SelectedItem.Text + "','" + TxtBxUsername.Text + "','" + TxtBxPassword.Text + "','Faculty'," + DDLFacultyName.SelectedValue + ",(SELECT DepartmentID FROM Department WHERE DepartmentName='" + LblDepartment.Text + "'))";
     try
     {
         c = new Connect(sql);
         LblResult.Text = "Registered";
         LblResult.ForeColor = Color.Green;
     }
     catch (Exception ex)
     {
         LblResult.Text = ex.ToString();
         LblResult.ForeColor = Color.Red;
     }
 }
Ejemplo n.º 31
0
 public void Dispose()
 {
     _mailController?.Dispose();
     Connect?.Dispose();
 }
Ejemplo n.º 32
0
    /* private void LoadQuyen()
     * {
     *   string strSql = "select * from DuAn";
     *   slQuyen.DataSource = Connect.GetTable(strSql);
     *   slQuyen.DataTextField = "TenQuyen";
     *   slQuyen.DataValueField = "MaQuyen";
     *   slQuyen.DataBind();
     *   //slQuyen.Items.Add(new ListItem("-- Tất cả --", "0"));
     *   // slQuyen.Items.FindByText("-- Tất cả --").Selected = true;
     * }*/
    #region paging
    private void SetPage()
    {
        string sql = "";

        sql += "   select count(*)   from  PhieuTraNo  where '1'='1'";

        if (pTenKhachHang != "")
        {
            sql += " and PhieuTraNo.IDKhachHang in (select KhachHang.IDKhachHang from KhachHang where KhachHang.TenKhachHang like N'%" + pTenKhachHang + "%' )";
        }
        if (pTenSanPham != "")
        {
            sql += " and PhieuTraNo.MaPhieuTraNo like N'%" + pTenSanPham + "%'";
        }
        if (pTuNgayNhap != "")
        {
            sql += " and PhieuTraNo.Ngay >='" + StaticData.ConvertDDMMtoMMDD(pTuNgayNhap) + " 00:00:00'";
        }
        if (pDenNgayNhap != "")
        {
            sql += " and PhieuTraNo.Ngay <='" + StaticData.ConvertDDMMtoMMDD(pDenNgayNhap) + " 00:00:00'";
        }
        DataTable tbTotalRows = Connect.GetTable(sql);
        //  Response.Write("<script>alert('"+tbTotalRows.Rows[0][0].ToString()+"')</script>");
        int TotalRows = int.Parse(tbTotalRows.Rows[0][0].ToString());

        if (TotalRows % PageSize == 0)
        {
            MaxPage = TotalRows / PageSize;
        }
        else
        {
            MaxPage = TotalRows / PageSize + 1;
        }
        txtLastPage = MaxPage.ToString();
        if (Page == 1)
        {
            for (int i = 1; i <= MaxPage; i++)
            {
                if (i <= 5)
                {
                    switch (i)
                    {
                    case 1: txtPage1 = i.ToString(); break;

                    case 2: txtPage2 = i.ToString(); break;

                    case 3: txtPage3 = i.ToString(); break;

                    case 4: txtPage4 = i.ToString(); break;

                    case 5: txtPage5 = i.ToString(); break;
                    }
                }
                else
                {
                    return;
                }
            }
        }
        else
        {
            if (Page == 2)
            {
                for (int i = 1; i <= MaxPage; i++)
                {
                    if (i == 1)
                    {
                        txtPage1 = "1";
                    }
                    if (i <= 5)
                    {
                        switch (i)
                        {
                        case 2: txtPage2 = i.ToString(); break;

                        case 3: txtPage3 = i.ToString(); break;

                        case 4: txtPage4 = i.ToString(); break;

                        case 5: txtPage5 = i.ToString(); break;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                int Cout = 1;
                if (Page <= MaxPage)
                {
                    for (int i = Page; i <= MaxPage; i++)
                    {
                        if (i == Page)
                        {
                            txtPage1 = (Page - 2).ToString();
                            txtPage2 = (Page - 1).ToString();
                        }
                        if (Cout <= 3)
                        {
                            if (i == Page)
                            {
                                txtPage3 = i.ToString();
                            }
                            if (i == (Page + 1))
                            {
                                txtPage4 = i.ToString();
                            }
                            if (i == (Page + 2))
                            {
                                txtPage5 = i.ToString();
                            }
                            Cout++;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                else
                {
                    //Page = MaxPage;
                    SetPage();
                }
            }
        }
    }
        private void btnLuu_NhomTre_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            DataTable table = (DataTable)dgvNhomTre.DataSource;
            string    sql   = "";
            int       stt   = 0;

            try
            {
                stt = int.Parse(Connect.GetTable("select top 1 maNhomTre from NhomTre order by maNhomTre desc").Rows[0][0].ToString());
            }
            catch { }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (table.Rows[i]["maNhomTre"].ToString().Trim() == "")
                {
                    sql = @" insert into NhomTre(maNhomTre,TenNhomTre,TiLe,DamDV,DamTV,BeoDV,BeoTV,Duong,Calo,Canxi,Photpho,sat,vitaminA,vitaminB1,vitaminB2,vitaminPP,vitaminC,CaAn,CoCauNhomTre) 
                             values(
                             " + (++stt) + @",
                             " + (table.Rows[i]["TenNhomTre"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["TenNhomTre"].ToString().Trim() + "'") + @",
                             " + (table.Rows[i]["TiLe"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["TiLe"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["DamDV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["DamDV"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["DamTV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["DamTV"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["BeoDV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["BeoDV"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["BeoTV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["BeoTV"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["Duong"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Duong"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["Calo"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Calo"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["Canxi"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Canxi"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["Photpho"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Photpho"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["sat"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["sat"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["vitaminA"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminA"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["vitaminB1"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminB1"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["vitaminB2"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminB2"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["vitaminPP"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminPP"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["vitaminC"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminC"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["CaAn"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["CaAn"].ToString().Trim() + "'") + @", 
                             " + (table.Rows[i]["CoCauNhomTre"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["CoCauNhomTre"].ToString().Trim() + "'") + @"
                             )";
                    Connect.Exec(sql);
                }
                else
                {
                    sql = @" update NhomTre
                             set TenNhomTre = " + (table.Rows[i]["TenNhomTre"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["TenNhomTre"].ToString().Trim() + "'") + @" ,
                                 TiLe = " + (table.Rows[i]["TiLe"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["TiLe"].ToString().Trim() + "'") + @" , 
                                 DamDV = " + (table.Rows[i]["DamDV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["DamDV"].ToString().Trim() + "'") + @" , 
                                 DamTV = " + (table.Rows[i]["DamTV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["DamTV"].ToString().Trim() + "'") + @" , 
                                 BeoDV = " + (table.Rows[i]["BeoDV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["BeoDV"].ToString().Trim() + "'") + @" , 
                                 BeoTV = " + (table.Rows[i]["BeoTV"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["BeoTV"].ToString().Trim() + "'") + @" , 
                                 Duong = " + (table.Rows[i]["Duong"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Duong"].ToString().Trim() + "'") + @" , 
                                 Calo = " + (table.Rows[i]["Calo"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Calo"].ToString().Trim() + "'") + @" , 
                                 Canxi = " + (table.Rows[i]["Canxi"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Canxi"].ToString().Trim() + "'") + @" , 
                                 Photpho = " + (table.Rows[i]["Photpho"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["Photpho"].ToString().Trim() + "'") + @" , 
                                 sat = " + (table.Rows[i]["sat"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["sat"].ToString().Trim() + "'") + @" , 
                                 vitaminA = " + (table.Rows[i]["vitaminA"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminA"].ToString().Trim() + "'") + @" , 
                                 vitaminB1 = " + (table.Rows[i]["vitaminB1"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminB1"].ToString().Trim() + "'") + @" , 
                                 vitaminB2 = " + (table.Rows[i]["vitaminB2"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminB2"].ToString().Trim() + "'") + @" , 
                                 vitaminPP = " + (table.Rows[i]["vitaminPP"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminPP"].ToString().Trim() + "'") + @" , 
                                 vitaminC = " + (table.Rows[i]["vitaminC"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["vitaminC"].ToString().Trim() + "'") + @" , 
                                 CaAn = " + (table.Rows[i]["CaAn"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["CaAn"].ToString().Trim() + "'") + @" , 
                                 CoCauNhomTre = " + (table.Rows[i]["CoCauNhomTre"].ToString().Trim() == "" ? "NULL" : "'" + table.Rows[i]["CoCauNhomTre"].ToString().Trim() + "'") + @"
                             where maNhomTre = " + table.Rows[i]["maNhomTre"];
                    Connect.Exec(sql);
                }
            }
            this.Enabled = true;
            MessageBox.Show("Đã lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            LoadNhomTre();
        }
    //private void LoadKho()
    //{
    //    string strSql = "select * from tb_Kho";
    //    slKho.DataSource = Connect.GetTable(strSql);
    //    slKho.DataTextField = "TenKho";
    //    slKho.DataValueField = "idKho";
    //    slKho.DataBind();
    //    slKho.Items.Add(new ListItem("-- Chọn --", "0"));
    //    slKho.Items.FindByText("-- Chọn --").Selected = true;
    //}
    private void LoadThongTinDonHang()
    {
        if (mQuyen.ToUpper() != "ADMIN" && mQuyen.ToUpper() != "NVVP")
        {
            ckbDaNhanTien.Disabled = true;
            ckbDaNhanTien.Visible  = false;
        }
        if (sIdDonHang != "")
        {
            string    sql   = "select * from tb_DonHang where idDonHang='" + sIdDonHang + "'";
            DataTable table = Connect.GetTable(sql);
            if (table.Rows.Count > 0)
            {
                if (mQuyen.ToUpper() == "KH" && mIdKhachHang != table.Rows[0]["idKhachHang"].ToString())
                {
                    Response.Redirect("../Home/DangNhap.aspx");
                }
                dvTitle.InnerHtml = "SỬA THÔNG TIN ĐƠN HÀNG";
                btLuu.Text        = "SỬA";

                txtMaDonHang.Value = table.Rows[0]["MaDonHang"].ToString();
                txtNgayLap.Value   = DateTime.Parse(table.Rows[0]["NgayLap"].ToString()).ToString("dd/MM/yyyy");

                string TenKH = StaticData.getField("tb_KhachHang", "TenKhachHang", "idKhachHang", table.Rows[0]["idKhachHang"].ToString());

                //btHuy.Text = "DSĐH CỦA " + TenKH.ToUpper();
                //slKho.Value = table.Rows[0]["idKho"].ToString();
                txtDienThoaiNguoiGui.Value = table.Rows[0]["SDTNguoiGui"].ToString();
                txtNguoiGui.Value          = table.Rows[0]["NguoiGui"].ToString();
                txtChiNhanhGui.Value       = StaticData.getField("tb_ChiNhanh", "TenChiNhanh", "IDChiNhanh", table.Rows[0]["idChiNhanhGui"].ToString());
                hdIDChiNhanhGui.Value      = table.Rows[0]["idChiNhanhGui"].ToString();
                // txtPhiCOD.Value = table.Rows[0]["PhiCOD"].ToString();

                double PhiCOD = table.Rows[0]["PhiCOD"].ToString() == "" ? 0 : double.Parse(table.Rows[0]["PhiCOD"].ToString());
                txtPhiCOD.Value = PhiCOD.ToString("N0").Replace(",", ".");

                //  txtDiaChiNguoiNhan.Value = table.Rows[0]["DiaChiNguoiNhan"].ToString();
                txtNguoiNhan.Value            = TenKH;
                txtSoDienThoaiNguoiNhan.Value = StaticData.getField("tb_KhachHang", "SoDienThoai", "idKhachHang", table.Rows[0]["idKhachHang"].ToString());
                txtDiaChiNguoiNhan.Value      = StaticData.getField("tb_KhachHang", "DiaChi", "idKhachHang", table.Rows[0]["idKhachHang"].ToString());
                hdIdKhachHang.Value           = table.Rows[0]["idKhachHang"].ToString();

                txtChiNhanhNhan.Value  = StaticData.getField("tb_ChiNhanh", "TenChiNhanh", "IDChiNhanh", table.Rows[0]["idChiNhanhNhan"].ToString());
                hdIDChiNhanhNhan.Value = table.Rows[0]["idChiNhanhNhan"].ToString();


                double ThanhToan = table.Rows[0]["ThanhToan"].ToString() == "" ? 0 : double.Parse(table.Rows[0]["ThanhToan"].ToString());
                double TienCuoc  = table.Rows[0]["TongCuoc"].ToString() == "" ? 0 : double.Parse(table.Rows[0]["TongCuoc"].ToString());
                txtTongTien.Value   = TienCuoc.ToString("N0").Replace(",", ".");
                txt_ThanhToan.Value = ThanhToan.ToString("N0").Replace(",", ".");
                string sql1 = "select * from tb_ChiTietDonHang where IDDonHang ='" + sIdDonHang + "'";

                DataTable data = Connect.GetTable(sql1);
                //SetPage();
                loadSP(data);
            }
        }
        else
        {
            if (mQuyen.ToUpper() == "NVGN")
            {
                //slNhanVienGiao.Value = mIdNguoiDung;
                //slNhanVienGiao.Disabled = true;
                Response.Redirect("../Home/DangNhap.aspx");
            }
        }
    }
Ejemplo n.º 35
0
 internal void OnConnect() => Connect?.Invoke();
Ejemplo n.º 36
0
    /// <summary>
    /// Delete a ch_students_lessons record
    /// </summary>
    /// <param name="stu_les1">the ch_students_lessons record to delete</param>
    public static void DeleteStudentLesson(ch_students_lessons stu_les1)
    {
        string strSql = "DELETE * FROM ch_students_lessons WHERE les_id=" + stu_les1.les_Id + " AND usr_id=" + stu_les1.usr_Id;

        Connect.DoAction(strSql, "ch_students_lessons");
    }
Ejemplo n.º 37
0
        /// <summary>   Constructor. </summary>
        ///
        /// <remarks>   Asim Naeem, 7/20/2017. </remarks>
        ///
        /// <param name="aConnect"> . </param>


        public MySqlDatabase(Connect aConnect) :
            base(aConnect)
        {
        }
Ejemplo n.º 38
0
    public static string htmlSP(DataTable tb)
    {
        string html = "";

        if (tb == null)
        {
            return("");
        }
        if (tb.Rows.Count <= 0)
        {
            return("");
        }
        for (int i = 0; i < tb.Rows.Count; i++)
        {
            string    link   = "/" + GenerateURL(tb.Rows[i]["TenSanPham"].ToString()) + "-" + tb.Rows[i]["idSanPham"].ToString();
            string    sqlAnh = "select top 2 * from tb_HinhAnhSanPham where idSanPham = " + tb.Rows[i]["idSanPham"].ToString();
            DataTable tbAnh  = Connect.GetTable(sqlAnh);
            string    Anh1   = "";
            string    Anh2   = "";
            if (tbAnh.Rows.Count > 0)
            {
                Anh1 = tbAnh.Rows[0]["LinkHinh"].ToString();
                if (tbAnh.Rows.Count > 1)
                {
                    Anh2 = tbAnh.Rows[1]["LinkHinh"].ToString();
                }
                else
                {
                    Anh2 = Anh1;
                }
            }
            html += @"<div class='item'>         
                                        <div class='item-inner product-layout transition product-grid'>
                                            <div class='product-item-container'>
                                                <div class='left-block left-b'>
                                                    
                                                    <div class='product-image-container second_img'>
                                                        <a href='" + link + @"' target='_self' title='Lastrami bacon'>
                                                            <img src='" + LinkAnh(Anh1) + @"' class='img-1 img-responsive' alt='image1'>
                                                            <img src='" + LinkAnh(Anh2) + @"' class='img-2 img-responsive' alt='image2'>
                                                        </a>
                                                    </div>
                                                    <!--quickview 
////                                                    <div class='so-quickview'>
////                                                      <a class='iframe-link btn-button quickview quickview_handler visible-lg' href='quickview.html' title='Quick view' data-fancybox-type='iframe'><i class='fa fa-eye'></i><span>Xem nhanh</span></a>
////                                                    </div>                                                     
                                                    end quickview-->

                                                    
                                                </div>
                                                <div class='right-block'>
                                                    <div class='button-group so-quickview cartinfo--left'>
                                                        <button type='button' class='addToCart' title='Thêm vào giỏ' onclick='ThemGioHangadd(" + tb.Rows[i]["idSanPham"].ToString() + "," + tb.Rows[i]["GiaMoi"].ToString() + @")'>
                                                            <span>Thêm vào giỏ </span>   
                                                        </button>
                                                    </div>
                                                    <div class='caption hide-cont'>
                                                        <h4><a href='" + link + @"' title='Pastrami bacon' target='_self'>" + tb.Rows[i]["TenSanPham"].ToString() + @"</a></h4>
                                                        
                                                    </div>
                                                    <p class='price'>
                                                      <span class='price-new'>" + StaticData.FormatDouble(tb.Rows[i]["GiaMoi"].ToString()) + @"</span>
                                                    </p>
                                                </div>

                                            </div>
                                        </div>      
                                    </div>";
        }
        return(html);
    }
Ejemplo n.º 39
0
    public static string htmlSanPhamHotKM1(string loai)
    {
        string sql = "select top 8 *,'Anh' = (select top 1 LinkHinh from tb_HinhAnhSanPham where idSanPham = sp.idSanPham) from tb_SanPham sp where KichHoat = 1";

        //switch (loai)
        //{
        //    case "hot":
        sql += " and SetHot = 1";
        //break;
        //    case "km":
        //        sql += " and GiaMoi <  GiaCu and GiaCu is not NULL"; break;
        //}
        DataTable tb   = Connect.GetTable(sql);
        string    html = "";
        int       tem  = 0;

        for (int i = 0; i < tb.Rows.Count; i++)
        {
            if (i == tem)
            {
                if (i != 0)
                {
                    html += "</div>";
                }
                html += "<div class='item '>";
                tem  += 1;
            }
            string link = GenerateURL(tb.Rows[i]["TenSanPham"].ToString()) + "-" + tb.Rows[i]["idSanPham"].ToString();
            //            html += @"
            //                    <div class='product-layout item-inner style1'>
            //                        <div class='item-image'>
            //                            <div class='item-img-info'>
            //                                <a href='" + link + @"' target='_self' title='Mandouille short'>
            //                                    <img src='" + LinkAnh(tb.Rows[i]["Anh"].ToString()) + @"' alt='Mandouille short'>
            //                                    </a>
            //                            </div>
            //                        </div>
            //                        <div class='item-info'>
            //                            <div class='item-title'>
            //                                <a href='" + link + @"' target='_self' title='Mandouille short'>" + Cut(tb.Rows[i]["TenSanPham"].ToString(), 28) + @"</a>
            //                            </div>
            //                            <div class='content_price price'>
            //                                <span class='price-new product-price'>" + StaticData.FormatDouble(tb.Rows[i]["GiaMoi"].ToString()) + @"</span>&nbsp;&nbsp;
            //
            //                                <span class='price-old'>" + StaticData.FormatDouble(tb.Rows[i]["GiaCu"].ToString()) + @"</span>&nbsp;
            //
            //                            </div>
            //                        </div>
            //</div>
            //                        <!-- End item-info -->";
            html += @"<div class='item'>         
                                        <div class='item-inner product-layout transition product-grid'>
                                            <div class='product-item-container'>
                                                <div class='left-block left-b'>
                                                    
                                                    <div class='product-image-container second_img'>
                                                        <a href='" + link + @"' target='_self' title='Lastrami bacon'>
                                                            <img src='" + LinkAnh(tb.Rows[i]["Anh"].ToString()) + @"' class='img-1 img-responsive' alt='image1'>
                                                            <img src='" + LinkAnh(tb.Rows[i]["Anh"].ToString()) + @"' class='img-2 img-responsive' alt='image2'>
                                                        </a>
                                                    </div>
                                                    <!--quickview 
////                                                    <div class='so-quickview'>
////                                                      <a class='iframe-link btn-button quickview quickview_handler visible-lg' href='quickview.html' title='Quick view' data-fancybox-type='iframe'><i class='fa fa-eye'></i><span>Xem nhanh</span></a>
////                                                    </div>                                                     
                                                    end quickview-->

                                                    
                                                </div>
                                                <div class='right-block'>
                                                    <div class='button-group so-quickview cartinfo--left'>
                                                        <button type='button' class='addToCart' title='Thêm vào giỏ' onclick='ThemGioHangadd(" + tb.Rows[i]["idSanPham"].ToString() + "," + tb.Rows[i]["GiaMoi"].ToString() + @")'>
                                                            <span>Thêm vào giỏ </span>   
                                                        </button>
                                                    </div>
                                                    <div class='caption hide-cont'>
                                                        <h4><a href='" + link + @"' title='Pastrami bacon' target='_self'>" + tb.Rows[i]["TenSanPham"].ToString() + @"</a></h4>
                                                        
                                                    </div>
                                                    <p class='price'>
                                                      <span class='price-new'>" + StaticData.FormatDouble(tb.Rows[i]["GiaMoi"].ToString()) + @"</span>
                                                    </p>
                                                </div>

                                            </div>
                                        </div>      
                                    </div>";
        }
        if (html != "")
        {
            html += "</div>";
        }

        return(html);
    }
Ejemplo n.º 40
0
    private void LoadTinTuc()
    {
        string    sql  = "select top 4 * from tb_TinTuc where SetHome = 1";
        DataTable tb   = Connect.GetTable(sql);
        string    html = "";
        int       tem  = 0;

        for (int i = 0; i < tb.Rows.Count; i++)
        {
            if (i == tem)
            {
                if (i != 0)
                {
                    html += "</div>";
                }
                html += "<div class='item '>";
                tem  += 4;
            }
            string link = GetRouteUrl("newdefault", new { nameEn = MyStaticData.GenerateURL(tb.Rows[i]["TieuDe"].ToString()), id = tb.Rows[i]["idTinTuc"].ToString() });
            //html += @"<div class='cat-wrap'>
            //                        <div class='media'>

            //                            <div class='item item-1'>
            //                                <div class='media-left'>
            //                                    <a href='" + link + @"' target='_self'>
            //                                    <img src='" + MyStaticData.LinkAnh(tb.Rows[i]["AnhDaiDien"].ToString()) + @"' alt='' class='media-object'>
            //                                    </a>
            //                                </div>
            //                                <div class='media-body'>
            //                                    <h4 class='media-heading'>
            //                                    <a href='" + link + @"' title='" + tb.Rows[i]["TieuDe"].ToString() + @"' target='_self'>" + tb.Rows[i]["TieuDe"].ToString() + @"</a>
            //                                    </h4>
            //                                    <div class='media-content'>
            //                                        <div class='media-date-added'><i class='fa fa-calendar'></i> " + StaticData.ConvertMMDDYYtoDDMMYY(tb.Rows[i]["Ngay"].ToString()) + @"</div>
            //                                        <div class='media-subcontent'>
            //                                        </div>
            //                                    </div>
            //                                </div>
            //                            </div>

            //                        </div>
            //                    </div>";
            html += @"
                    <div class='product-layout item-inner style1'>
                        <div class='item-image'>
                            <div class='item-img-info'>
                                <a href='" + link + @"' target='_self' title='Mandouille short'>
                                    <img src='" + MyStaticData.LinkAnh(tb.Rows[i]["AnhDaiDien"].ToString()) + @"' alt='Mandouille short'>
                                    </a>
                            </div>
                        </div>
                        <div class='item-info'>
                            <div class='item-title'>
                                <a href='" + link + @"' target='_self' title='Mandouille short'>" + MyStaticData.Cut(tb.Rows[i]["TieuDe"].ToString(), 100) + @"</a>
                            </div>
                        </div>
</div>
                        <!-- End item-info -->";
        }
        if (html != "")
        {
            html += "</div>";
        }
        dvTinTucHot.InnerHtml     = html;
        dvTuVanTieuDung.InnerHtml = html;
    }
Ejemplo n.º 41
0
 private void frmChuyenHS_Load(object sender, EventArgs e)
 {
     Connect.LoadCBB(cboLopTu, "tenphong", "select * From phong");
     Connect.LoadCBB(cboLopden, "tenphong", "select * From phong");
 }
Ejemplo n.º 42
0
 public void load()
 {
     dataGridView1.DataSource = Connect.LayBang("select * from Khoa");
 }
Ejemplo n.º 43
0
    private void LoadSanPham()
    {
        string    sql   = GetSQL_ListAll();
        DataTable table = Connect.GetTable(sql);

        if (!String.IsNullOrEmpty(q))
        {
            table = filterName(table, q);
        }
        //DataTable data2 = table;
        //var d = data2.AsEnumerable().GroupBy(row => row.Field<Int32>("IDGianHang")).Select(c => c.Count());

        if (table == null)
        {
            dvDSSanPham.InnerHtml = "<a> Không tìm thấy sản phẩm nào </a>";
            return;
        }

        SetPage();
        string html = "";

        curentPage.InnerText = pageNum.ToString();
        int totalPage = (table.Rows.Count / PageSize + 1);

        if (pageNum > totalPage)
        {
            pageNum = totalPage;
            dvDSSanPham.InnerHtml = "<a> Không tìm thấy sản phẩm nào </a>";
            return;
        }

        int from = (pageNum - 1) * PageSize;
        int to   = (((pageNum - 1) * PageSize + 1) + PageSize) - 1;

        //table.Rows.
        pageNumbers.InnerText = totalPage.ToString();
        for (int i = 0; i < table.Rows.Count; i++)
        {
            if (from <= i && i < to)
            {
                string    sqlha = "select * from tb_HinhAnhSanPham where idSanPham = " + table.Rows[i]["idSanPham"];
                DataTable tbha  = Connect.GetTable(sqlha);
                string    Anh1  = "";
                string    Anh2  = "";
                if (tbha.Rows.Count > 0)
                {
                    Anh1 = tbha.Rows[0]["LinkHinh"].ToString();
                    if (tbha.Rows.Count > 1)
                    {
                        Anh2 = tbha.Rows[1]["LinkHinh"].ToString();
                    }
                    else
                    {
                        Anh2 = Anh1;
                    }
                }
                string link = GetRouteUrl("product", new { nameEn = MyStaticData.GenerateURL(table.Rows[i]["TenSanPham"].ToString()), id = table.Rows[i]["idSanPham"].ToString() });
                html += "<div class='product-layout col-lg-15 col-md-4 col-sm-6 col-xs-12'>";
                html += "   <div class='product-item-container'>";
                html += "       <div class='left-block left-b' style='height: 230px'>";
                html += @"           <div class='product-image-container second_img'>

									<a href='"                                     + link + @"' target='_self' title='Lastrami bacon' style='height: 229px; display: flex; align-items: center'>
										<img src='"                                         + Anh1 + @"' class='img-1 img-responsive' alt='image1' style='max-height: 229px'>
									</a>
								</div>"                                ;
                html += "       </div>";
                html += "       <div class='right-block'>";
                html += @"          <div class='button-group so-quickview cartinfo-left' style='top:10px'>
								<button type='button' class='addToCart' title='Mua ngay'>
									<a href='"                                     + link + @"' target='_self' title='Lastrami bacon'><span>Mua ngay</span><a>  
								</button>
							</div>"                            ;
                html += @"          <div class='caption hide-cont'>
									<h4><a href='"                                     + link + @"' title='Pastrami bacon' target='_self'>" + MyStaticData.Cut(table.Rows[i]["TenSanPham"].ToString(), 44) + @"</a></h4>
								</div>"                                ;
                html += @"          <p class='price'>
									<span class='price-new'>"                                     + StaticData.FormatDouble(table.Rows[i]["GiaMoi"].ToString()) + @"Đ</span>
								</p>"                                ;
                html += @"          <div class='description item-desc'>
									<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est . </p>
								</div>"                                ;
                html += @"          <div class='list-block hidden'>
									<button class='addToCart btn-button' type='button' title='Add to Cart'><i class='fa fa-shopping-basket'></i>
									</button>
									<button class='wishlist btn-button' type='button' title='Add to Wish List'><i class='fa fa-heart'></i>
									</button>
									<button class='compare btn-button' type='button' title='Compare this Product'><i class='fa fa-refresh'></i>
									</button>
									<!--quickview-->                                                      
									<a class='iframe-link btn-button quickview quickview_handler visible-lg' href='quickview.html' title='Quick view' data-fancybox-type='iframe'><i class='fa fa-eye'></i></a>
									<!--end quickview-->
								</div>"                                ;
                html += "       </div>";
                html += "   </div>";
                html += "</div>";
            }
            dvDSSanPham.InnerHtml = html;
        }


        //        string sql = "";
        //        sql += @"select * from
        //            (
        //                SELECT ROW_NUMBER() OVER
        //                  (
        //                        ORDER BY idSanPham desc
        //                  )AS RowNumber
        //                  ,*,'LinkHinh' = (select top 1 LinkHinh from tb_HinhAnhSanPham where idSanPham = s.idSanPham)
        //                  from tb_SanPham s ";
        //        sql += "where and TenSanPham like N'%" + search + "%'";
        //        sql += ") as tb1 WHERE RowNumber BETWEEN (" + Page + " - 1) * " + PageSize + " + 1 AND (((" + Page + " - 1) * " + PageSize + " + 1) + " + PageSize + ") - 1";
        //        DataTable table = Connect.GetTable(sql);
        //        //txtNoiDung.InnerHtml = table.Rows[0]["NoiDung"].ToString();
        //        SetPage();
        //        string html = MyStaticData.htmlSP(table);
        //        //container.InnerHtml = html;
        //        //string htmlPhanTrang = "";
        //        string url = "/product/search?name=" + search;
        //        url += "&Page=";

        ////Page 1
        //if (txtPage1 != "")
        //{
        //    if (Page.ToString() == txtPage1)
        //        htmlPhanTrang += "           <span class='page current'>" + txtPage1 + "</span>";
        //    else
        //        htmlPhanTrang += "           <span class='prev'><a href='" + url + txtFistPage + "' title=''>←</a></span><span class='page'><a href='" + url + txtPage1 + "' title=''>" + txtPage1 + "</a></span>";
        //}
        //else
        //{
        //    //html += "           <a id='page_1' class='notepagingnone' href='" + url + txtPage1 + "' />" + txtPage1 + "</a>";
        //}
        ////Page 2
        //if (txtPage2 != "")
        //{
        //    if (Page.ToString() == txtPage2)
        //        htmlPhanTrang += "           <span class='page current'>" + txtPage2 + "</span>";
        //    else
        //        htmlPhanTrang += "           <span class='page'><a href='" + url + txtPage2 + "' title=''>" + txtPage2 + "</a></span>";
        //}
        //else
        //{
        //    //html += "           <a id='page_2' class='notepagingnone' href='" + url + txtPage2 + "' />" + txtPage2 + "</a>";
        //}
        ////Page 3
        //if (txtPage3 != "")
        //{
        //    if (Page.ToString() == txtPage3)
        //        htmlPhanTrang += "           <span class='page current'>" + txtPage3 + "</span>";
        //    else
        //        htmlPhanTrang += "           <span class='page'><a href='" + url + txtPage3 + "' title=''>" + txtPage3 + "</a></span>";
        //}
        //else
        //{
        //    //html += "           <a id='page_3' class='notepagingnone' href='" + url + txtPage3 + "' />" + txtPage3 + "</a>";
        //}
        ////Page 4
        //if (txtPage4 != "")
        //{
        //    if (Page.ToString() == txtPage4)
        //        htmlPhanTrang += "           <span class='page current'>" + txtPage4 + "</span>";
        //    else
        //        htmlPhanTrang += "           <span class='page'><a href='" + url + txtPage4 + "' title=''>" + txtPage4 + "</a></span>";
        //}
        //else
        //{
        //    //html += "           <a id='page_4' class='notepagingnone' href='" + url + txtPage4 + "' />" + txtPage4 + "</a>";
        //}
        ////Page 5
        //if (txtPage5 != "")
        //{
        //    if (Page.ToString() == txtPage5)
        //        htmlPhanTrang += "           <span class='page current'>" + txtPage5 + "</span>";
        //    else
        //        htmlPhanTrang += "           <span class='page'><a href='" + url + txtPage5 + "' title=''>" + txtPage5 + "</a></span><span class='next'><a href='" + url + txtLastPage + "' title=''>→</a></span>";
        //}
        //else
        //{
        //    //htmlPhanTrang += "           <span class='next'><a href='" + url + txtLastPage + "' title=''>→</a></span>";
        //}
        ////dvPhanTrang.InnerHtml = htmlPhanTrang;
    }
Ejemplo n.º 44
0
    private void LoadDanhMuc()
    {
        if (Request.QueryString["cat"] == null)
        {
            string strSql = "select * from tb_LoaiSanPham where idCapCha = 0";

            DataTable cat1 = Connect.GetTable(strSql);
            if (cat1 == null)
            {
                DanhMuc.Visible = false;
                return;
            }
            else
            {
                if (cat1.Rows.Count <= 0)
                {
                    DanhMuc.Visible = false;
                    return;
                }
            }
            TenDanhMuc.InnerText = "Danh mục";
            string html = "";
            for (int i = 0; i < cat1.Rows.Count; i++)
            {
                string name    = cat1.Rows[i]["TenLoaiSanPham"].ToString();
                string id      = cat1.Rows[i]["idLoaiSanPham"].ToString();
                bool   isCheck = false;
                if (cat != null)
                {
                    foreach (string item in cat)
                    {
                        if (item == id)
                        {
                            html   += "<label class=\"checkbox-custom filterCheckbox_1-Ku checked_3LVu\">";
                            isCheck = true;
                            break;
                        }
                    }
                }

                if (!isCheck)
                {
                    html += "<label class=\"checkbox-custom filterCheckbox_1-Ku\">";
                }
                html += "<input type=\"checkbox\" class=\"input-cb-custom\" data-code=\"cat=" + id + "\"><span class=\"box-check_1KOw\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\" width=\"48\" height=\"48\" class=\"icon-check_mVLE\"><g data-name=\"Layer 2\"><g data-name=\"Layer 1\"><path d=\"M0,0H48V48H0Z\" fill=\"none\"></path>";
                html += "<polygon points=\"40 15.46 36.37 11.99 18.56 28.95 11.78 22.48 8 26.09 17.77 35.41 17.79 35.4 18.42 36.01 40 15.46\"></polygon>";
                html += "</g>";
                html += "</g></svg></span><span class=\"text_eu8q\">" + name + "</span></label>";
            }
            dsDanhMuc.InnerHtml = html;
            return;
        }
        /////////////////////////////////////////////////////////////////////////////////////
        string idDanhMuc = Request.QueryString["cat"].ToString();

        string    catName = @"select l.TenLoaiSanPham from tb_LoaiSanPham l where l.idLoaiSanPham = '" + idDanhMuc + "'";
        DataTable tbName  = Connect.GetTable(catName);

        if (tbName == null)
        {
            return;
        }
        else
        {
            if (tbName.Rows.Count <= 0)
            {
                return;
            }
        }
        string tenDanhMuc = tbName.Rows[0][0].ToString();

        TenDanhMuc.InnerText = tenDanhMuc;

        string sql = "select * from tb_LoaiSanPham l where l.idCapCha = '" + idDanhMuc + "'";

        DataTable data = Connect.GetTable(sql);

        if (data == null)
        {
            dsDanhMuc.InnerHtml = "";
            return;
        }
        string htmlDsDanhMuc = "";

        for (int i = 0; i < data.Rows.Count; i++)
        {
            string name    = data.Rows[i]["TenLoaiSanPham"].ToString();
            string id      = data.Rows[i]["idLoaiSanPham"].ToString();
            bool   isCheck = false;
            if (cat != null)
            {
                foreach (string item in cat)
                {
                    if (item == id)
                    {
                        htmlDsDanhMuc += "<label class=\"checkbox-custom filterCheckbox_1-Ku checked_3LVu\">";
                        isCheck        = true;
                        break;
                    }
                }
            }

            if (!isCheck)
            {
                htmlDsDanhMuc += "<label class=\"checkbox-custom filterCheckbox_1-Ku\">";
            }
            htmlDsDanhMuc += "<input type=\"checkbox\" class=\"input-cb-custom\" data-code=\"cat=" + id + "\"><span class=\"box-check_1KOw\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\" width=\"48\" height=\"48\" class=\"icon-check_mVLE\"><g data-name=\"Layer 2\"><g data-name=\"Layer 1\"><path d=\"M0,0H48V48H0Z\" fill=\"none\"></path>";
            htmlDsDanhMuc += "<polygon points=\"40 15.46 36.37 11.99 18.56 28.95 11.78 22.48 8 26.09 17.77 35.41 17.79 35.4 18.42 36.01 40 15.46\"></polygon>";
            htmlDsDanhMuc += "</g>";
            htmlDsDanhMuc += "</g></svg></span><span class=\"text_eu8q\">" + name + "</span></label>";
        }
        dsDanhMuc.InnerHtml = htmlDsDanhMuc;
    }
Ejemplo n.º 45
0
    protected void btLuu_Click(object sender, EventArgs e)
    {
        string MaPhieuTra   = "";
        string TenKhachHang = "";
        string NgayTra      = "";
        string SoTien       = "";
        string IDNhaCungCap = "";
        int    temp         = 0;

        if (txtMaPhieuTra.Value.Trim() != "")
        {
            if (sIdDonHang != "")
            {
                string    sqlCheckDH = "select top 1 IDTraNoCOD from tb_TraNoCOD where MaPhieuTra='" + txtMaPhieuTra.Value.Trim() + "'";
                DataTable tbCheckDH  = Connect.GetTable(sqlCheckDH);
                if (tbCheckDH.Rows.Count > 0)
                {
                    Response.Write("<script>alert('Mã đơn hàng đã tồn tại!')</script>");
                    return;
                }
                else
                {
                    MaPhieuTra = StaticData.ValidParameter(txtMaPhieuTra.Value.Trim());
                    temp       = 0;
                }
            }
            else
            {
                Response.Write("<script>alert('Bạn không được phép trả nợ!')</script>");
                temp = 1;
            }
        }

        TenKhachHang = StaticData.ValidParameter(txtTenKhachHang.Value.Trim());
        string    sqlCheckID = "select top 1 idDonHang from tb_DonHang where MaDonHang=N'" + TenKhachHang + "'";
        DataTable tbCheckID  = Connect.GetTable(sqlCheckID);

        if (tbCheckID.Rows.Count > 0)
        {
            IDNhaCungCap = tbCheckID.Rows[0]["idDonHang"].ToString();
        }
        NgayTra = StaticData.ConvertDDMMtoMMDD(txtNgayLap.Value.Trim());
        SoTien  = txtSoTienTra1.Value.Trim().Replace(".", "");;
        if (temp == 0)
        {
            // đang làm tới đây.
            string    sqlMaHoaDonLasest = "SELECT TOP 1 IDTraNoCOD FROM tb_TraNoCOD ORDER BY IDTraNoCOD DESC";
            DataTable tbl = Connect.GetTable(sqlMaHoaDonLasest);
            string    sql = @"INSERT INTO tb_TraNoCOD(IDDonHang,MaPhieuTra,SoTien,NgayTra,idNguoiDung)
                                     VALUES (N'" + IDNhaCungCap
                            + "',N'" + MaPhieuTra.Trim()
                            + "',N'" + SoTien.Trim()


                            + "',N'" + NgayTra
                            + "',N'" + mIdNguoiDung
                            + "')";
            bool chksql = Connect.Exec(sql);
        }
        Response.Redirect("CongNoCOD.aspx?");
    }
 internal static extern uint WNetCancelConnection([MarshalAs(UnmanagedType.LPWStr)] string lpName, Connect dwFlags,
                                                  [MarshalAs(UnmanagedType.Bool)] bool fForce);
Ejemplo n.º 47
0
    /// <summary>
    /// Add a new ch_students_lessons record to the database
    /// </summary>
    /// <param name="stu_les1">a new ch_students_lessons you want to add</param>
    public static void AddStudentLesson(ch_students_lessons stu_les1)
    {
        string strSql = "INSERT INTO ch_students_lessons(les_id, usr_id) VALUES(" + stu_les1.les_Id + ", " + stu_les1.usr_Id + ")";

        Connect.DoAction(strSql, "ch_students_lessons");
    }
 internal static extern uint WNetUseConnection(IntPtr hwndOwner,
                                               [MarshalAs(UnmanagedType.Struct)] ref NetResource lpNetResource,
                                               [MarshalAs(UnmanagedType.LPWStr)] string lpPassword, [MarshalAs(UnmanagedType.LPWStr)] string lpUserId,
                                               [MarshalAs(UnmanagedType.U4)] Connect dwFlags, StringBuilder lpAccessName,
                                               [MarshalAs(UnmanagedType.U4)] out uint lpBufferSize, [MarshalAs(UnmanagedType.U4)] out uint lpResult);
Ejemplo n.º 49
0
    /// <summary>
    /// delete all students in a specific lesson
    /// </summary>
    /// <param name="les_id">lesson id of the specific lesson.</param>
    public static void DeleteAllStudentsLesson(int les_id)
    {
        string strSql = "DELETE * FROM ch_students_lessons WHERE les_id=" + les_id;

        Connect.DoAction(strSql, "ch_students_lessons");
    }
 private void runFeedback_CancelRun(object sender, EventArgs e)
 {
     Connect.AbortRun();
 }
    protected void loadSPLucBan(DataTable data)
    {
        if (data.Rows.Count > 0)
        {
            string slistSP = "";

            string html     = "";
            double TongTien = 0;
            for (int i = 0; i < data.Rows.Count; i++)
            {
                string MaHH      = "";
                string TenHH     = "";
                string IDHangHoa = "";
                //string idChiTietNhapMua = data.Rows[i]["IDChiTietNhapMua"].ToString();
                //string sqlid = "select * from tb_ChiTietNhapMua where IDChiTietNhapMua= '" + idChiTietNhapMua + "'";
                //DataTable tbid = Connect.GetTable(sqlid);
                //if (tbid.Rows.Count > 0)
                //{
                // IDHangHoa = data.Rows[0]["IDHangHoa"].ToString();
                //}
                //string sql = "select * from tb_HangHoa where IDHangHoa = '" + MaHH + "'";
                //DataTable tb = Connect.GetTable(sql);
                //if (tb.Rows.Count > 0)
                //{
                IDHangHoa = data.Rows[i]["idHangHoa"].ToString();
                //    MaHH = data.Rows[i]["MaHangHoa"].ToString();
                string    sql = "select * from tb_HangHoa where idHangHoa = N'" + IDHangHoa + "'";
                DataTable tb  = Connect.GetTable(sql);
                if (tb.Rows.Count > 0)
                {
                    TenHH = tb.Rows[0]["TenHangHoa"].ToString();
                }

                slistSP += IDHangHoa + "-" + data.Rows[i]["SoLuong"] + "-" + data.Rows[i]["TinhTrang"] + "-" + data.Rows[i]["DonGia"] + "-" + data.Rows[i]["ThanhTien"];
                html    += "<tr id='tr_" + IDHangHoa + "'>";
                html    += "<td>" + (i + 1) + "</td>";
                //    html += "     <td style='text-align:center;vertical-align: inherit;'>" + MaHH + "</td>";
                html += "     <td style='text-align:center;vertical-align: inherit;'>" + TenHH + "</td>";
                //html += "       <td style='text-align:center'>" + data.Rows[i]["DonViTinh"] + "</td>";
                //string MaNhapMua = "";
                //string sqlma = "SELECT  tb_NhapMua.MaNhapMua FROM tb_ChiTietNhapMua, tb_NhapMua WHERE tb_ChiTietNhapMua.IDNhapMua=tb_NhapMua.IDNhapMua and IDChiTietNhapMua = '" + idChiTietNhapMua + "'";
                //DataTable tbma = Connect.GetTable(sqlma);
                //if (tbma.Rows.Count > 0)
                //{
                //    MaNhapMua = tbma.Rows[0]["MaNhapMua"].ToString();
                //}
                //html += "       <td style='text-align:center'>" + MaNhapMua + "</td>";
                html += "       <td style='text-align:center'>" + data.Rows[i]["SoLuong"] + "</td>";


                html += "       <td style='text-align:center'>" + double.Parse(data.Rows[i]["DonGia"].ToString()).ToString("N0").Replace(",", ".") + "</td>";
                //html += "<td style='text-align:center'><input class='idSLSP' style='width: 40px' type='number' data-id = '" + data.Rows[i]["Id"] + "' value='" + data.Rows[i]["SoLuong"] + "' runat='server'/></i></td>";


                html += "   <td style='text-align:center'>" + data.Rows[i]["TinhTrang"].ToString() + "</td>";


                //html += "<td style='text-align:center'><a onclick=''><img class='imgedit' id='DeleteSP_" + data.Rows[i]["Id"] + "' src='../Images/delete.png'/></a></td>";
                html += "   <td style='text-align: center'><a style='cursor:pointer' onclick='XoaSanPham(\"" + IDHangHoa + "\")'><i class='fa fa-trash'></i></a></td>";
                //  html += "       <td style='text-align:center'>" + data.Rows[i]["HangGui"] + "</td>";
                if (i < data.Rows.Count - 1)
                {
                    slistSP += ",";
                }


                html += "</tr>";
                double ThanhTien = double.Parse(data.Rows[i]["ThanhTien"].ToString());
                double SoLuong   = double.Parse(data.Rows[i]["SoLuong"].ToString());
                TongTien += (ThanhTien);
            }
            txtTongTien.Value   = TongTien.ToString();
            txt_ThanhToan.Value = TongTien.ToString();
            //txtCKTien.Value = ((TongTien * ChietKhau) / 100).ToString();
            listSanPham.Value        = slistSP;
            danhSachSPChon.InnerHtml = html;
        }
    }
 private void runFeedback_DebugTest(object sender, DebugTestArgs e)
 {
     Connect.Debug(_application, e.Test);
 }
    protected void btLuu_Click(object sender, EventArgs e)
    {
        string MaDonHang = "";
        string NgayLap   = "";

        string SDTNguoiGui = "";
        string Nguoigui    = "";
        //string idKho = "";
        string idChiNhanhGui = "";

        string ThanhToan = "";
        // string NguoiNhan = "";
        // string DiaChiNguoiNhan = "";
        // string SoDienThoaiNguoiNhan = "";
        string idChiNhanhNhan = "";
        string idKhachHang    = "";
        string TongCuoc       = "";
        string PhiCOD         = "";

        string ChuyenPhatNhanh = "";
        string MaTinhTrang     = "";
        string GhiChu          = "";

        string isDaNhanTien = ckbDaNhanTien.Checked.ToString();
        bool   NguoiNhanTra = radiNguoiNhanTra.Checked;


        //Mã đơn hàng
        if (txtMaDonHang.Value.Trim() != "")
        {
            if (sIdDonHang == "")
            {
                string    sqlCheckDH = "select top 1 idDonHang from tb_DonHang where MaDonHang='" + txtMaDonHang.Value.Trim() + "'";
                DataTable tbCheckDH  = Connect.GetTable(sqlCheckDH);
                if (tbCheckDH.Rows.Count > 0)
                {
                    Response.Write("<script>alert('Mã đơn hàng đã tồn tại!')</script>");
                    return;
                }
                else
                {
                    MaDonHang = StaticData.ValidParameter(txtMaDonHang.Value.Trim());
                }
            }
            else
            {
                string    sqlCheckDH = "select top 1 idDonHang from tb_DonHang where idDonHang!='" + sIdDonHang + "' and MaDonHang='" + txtMaDonHang.Value.Trim() + "'";
                DataTable tbCheckDH  = Connect.GetTable(sqlCheckDH);
                if (tbCheckDH.Rows.Count > 0)
                {
                    Response.Write("<script>alert('Mã đơn hàng đã tồn tại!')</script>");
                    return;
                }
                else
                {
                    MaDonHang = StaticData.ValidParameter(txtMaDonHang.Value.Trim());
                }
            }
        }
        else
        {
            Response.Write("<script>alert('Bạn chưa nhập mã đơn hàng!')</script>");
            return;
        }
        //Ngày lập
        //   MaDonHang = txtMaDonHang.Value.Trim();

        NgayLap = StaticData.ConvertDDMMtoMMDD(txtNgayLap.Value.Trim());
        // DiaChiNguoiNhan = txtDiaChiNguoiNhan.Value.Trim();
        idChiNhanhNhan = hdIDChiNhanhNhan.Value.Trim();
        if (idChiNhanhNhan == "")
        {
            Response.Write("<script>alert('Bạn chưa nhập chi nhánh nhận!')</script>");
            return;
        }



        idChiNhanhGui = hdIDChiNhanhGui.Value.Trim();
        if (idChiNhanhGui == "")
        {
            Response.Write("<script>alert('Bạn chưa nhập chi nhánh gởi!')</script>");
            return;
        }

        SDTNguoiGui = txtDienThoaiNguoiGui.Value.Trim();
        Nguoigui    = txtNguoiGui.Value.Trim();
        PhiCOD      = txtPhiCOD.Value.Trim().Replace(".", "");
        if (PhiCOD != "")
        {
            double PhiCOD1 = double.Parse(PhiCOD.ToString());
            if (SDTNguoiGui == "" || Nguoigui == "")
            {
                Response.Write("<script>alert('Bạn chưa nhập số điện thoại và người gửi!')</script>");
                return;
            }
        }



        //Khách hàng
        idKhachHang = hdIdKhachHang.Value.Trim();

        if (idKhachHang == "")
        {
            string DTKH = txtSoDienThoaiNguoiNhan.Value.Trim();
            if (DTKH == "")
            {
                Response.Write("<script>alert('Bạn chưa nhập số điện thoại người nhận !')</script>");
                return;
            }
            string KH          = txtNguoiNhan.Value.Trim();
            string DiaChi      = txtDiaChiNguoiNhan.Value.Trim();
            string MaKhachHang = "";
            string sMa         = "";
            // string _Ngay = "";
            string    sql   = "select isnull(max(IDKhachHang),0)+1 as 'MaKhachHang' from tb_KhachHang";
            DataTable table = Connect.GetTable(sql);
            MaKhachHang = table.Rows[0]["MaKhachHang"].ToString();
            //_Ngay = DateTime.Now.ToString("yyyy-MM-dd");
            string[] ngay       = DateTime.Now.ToString("MM/dd/yyyy").Split('/');
            string   MaDonHang1 = ngay[0] + ngay[1] + ngay[2];
            // txtMaDonHang.DataSource = Connect.GetTable(sql);
            sMa = MaDonHang1 + "00" + MaKhachHang + "";

            string    sqlkt  = "select * from tb_KhachHang where SoDienThoai = N'" + DTKH + "'";
            DataTable table1 = Connect.GetTable(sqlkt);
            if (table1.Rows.Count > 0)
            {
                idKhachHang = table1.Rows[0]["idKhachHang"].ToString();
            }
            else
            {
                string sqlInsertDH1 = "insert into tb_KhachHang(MaKhachHang,TenKhachHang,SoDienThoai,DiaChi)";
                sqlInsertDH1 += " values('" + sMa + "',N'" + KH + "','" + DTKH + "',N'" + DiaChi + "'";


                sqlInsertDH1 += ")";
                bool ktInsertKH1 = Connect.Exec(sqlInsertDH1);
                if (ktInsertKH1)
                {
                    idKhachHang = StaticData.getField("tb_KhachHang", "idKhachHang", "SoDienThoai", DTKH);
                }
            }
        }
        TongCuoc = txtTongTien.Value.Trim().Replace(".", "");

        // PhiCOD = txtPhiCOD.Value.Trim().Replace(".", "");

        //Gói dịch vụ
        ChuyenPhatNhanh = txt_ChuyenPhatNhanh.Value.Trim().Replace(".", "");
        string PhiChuyenPhatNhanh = txt_CuocChuyenPhatNhanh.Value.Trim().Replace(".", "");

        //Ghi chú
        GhiChu = txtGhiChu.Value.Trim();
        double TongTien1 = 0;

        string[] arraySPList = null;
        if (ChuyenPhatNhanh == "" || ChuyenPhatNhanh == null)
        {
            if (listSanPham.Value.Trim() == "" || listSanPham.Value.Trim() == null)
            {
                Response.Write("<script>alert('Bạn chưa nhập sản phẩm nào!')</script>");
                //temp = 1;
            }
            else
            {
                arraySPList = listSanPham.Value.Trim().Split(',');
                if (arraySPList != null)
                {
                    for (int i = 0; i < arraySPList.Length; i++)
                    {
                        //  double DonGia = double.Parse(arraySPList[i].Split('-')[3]);
                        double DonGia = arraySPList[i].Split('-')[4].ToString() == "" ? 0 : double.Parse(arraySPList[i].Split('-')[4].ToString());
                        TongTien1 += DonGia;
                    }
                }
                //MessageSanPham.Style.Add("display", "none");
            }
        }

        ThanhToan = txt_ThanhToan.Value.Trim().Replace(",", ".");

        if (NguoiNhanTra == false)
        {
            if (ThanhToan == "")
            {
                Response.Write("<script>alert('Bạn chưa nhập thanh toán !')</script>");
            }
        }
        else
        {
            ThanhToan = "0";
        }

        double Tien = 0;

        //  Tien = TongTien1.Replace(",", ".");
        if (ChuyenPhatNhanh != "")
        {
            TongTien1 = double.Parse(PhiChuyenPhatNhanh);
        }
        //////////
        if (sIdDonHang == "")
        {
            // string MaDonHang1 = MyStaticData.TaoMaDonHang();
            string sqlInsertDH = "insert into tb_DonHang(MaDonHang,NgayLap,SDTNguoiGui,NguoiGui,idChiNhanhGui,idKhachHang,NguoiNhanTra,idChiNhanhNhan,PhiCOD,TongCuoc,ChuyenPhatNhanh,CuocChuyenPhatNhanh,ThanhToan,idNguoiDung,MaTinhTrangCPN)";
            sqlInsertDH += " values('" + MaDonHang + "','" + NgayLap + "','" + SDTNguoiGui + "',N'" + Nguoigui + "',N'" + idChiNhanhGui + "',N'" + idKhachHang + "','" + NguoiNhanTra + "',N'" + idChiNhanhNhan + "',N'" + PhiCOD + "',N'" + TongTien1 + "',N'" + ChuyenPhatNhanh + "',N'" + PhiChuyenPhatNhanh + "',N'" + ThanhToan + "',N'" + mIdNguoiDung + "'";
            if (ChuyenPhatNhanh != "")
            {
                sqlInsertDH += ",N'XDVP'";
            }
            else
            {
                sqlInsertDH += ",N''";
            }

            sqlInsertDH += ")";
            bool ktInsertKH = Connect.Exec(sqlInsertDH);
            if (ktInsertKH)
            {
                string idDonHang = StaticData.getField("tb_DonHang", "idDonHang", "MaDonHang", MaDonHang);
                //Response.Redirect("QuanLyDonHang-CapNhat.aspx?idDonHang=" + idDonHang);
                // Response.Redirect("QuanLyDonHang.aspx" + (Page == "" ? "" : "?Page=" + Page));
                if (ChuyenPhatNhanh == "")
                {
                    SaveOrderDetail(arraySPList, idDonHang);
                }
                Response.Redirect("QuanLyDonHang.aspx?Page=" + Page);
            }
            else
            {
                Response.Write("<script>alert('Lỗi thêm đơn hàng, bạn vui lòng kiểm tra lại dữ liệu nhập!')</script>");
            }
        }
        else
        {
            string sqlUpdateDH = "";
            sqlUpdateDH += "update tb_DonHang set";
            sqlUpdateDH += " NgayLap = '" + NgayLap + "'";
            sqlUpdateDH += " ,MaDonHang = '" + MaDonHang + "'";

            sqlUpdateDH += " ,SDTNguoiGui = '" + SDTNguoiGui + "'";
            sqlUpdateDH += " ,NguoiGui = N'" + Nguoigui + "'";
            sqlUpdateDH += " ,idChiNhanhGui = '" + idChiNhanhGui + "'";



            //sqlUpdateDH += " ,DiaChiNguoiNhan = N'" + DiaChiNguoiNhan + "'";
            //
            sqlUpdateDH += " ,idKhachHang = '" + idKhachHang + "'";
            sqlUpdateDH += " ,idChiNhanhNhan = '" + idChiNhanhNhan + "'";
            sqlUpdateDH += " ,PhiCOD = '" + PhiCOD + "'";
            sqlUpdateDH += " ,NguoiNhanTra = '" + NguoiNhanTra + "'";

            sqlUpdateDH += " ,TongCuoc = '" + TongTien1 + "'";
            sqlUpdateDH += " ,ChuyenPhatNhanh = '" + ChuyenPhatNhanh + "'";
            sqlUpdateDH += " ,CuocChuyenPhatNhanh = '" + PhiChuyenPhatNhanh + "'";
            sqlUpdateDH += " ,ThanhToan = '" + ThanhToan + "'";
            sqlUpdateDH += " where idDonHang ='" + sIdDonHang + "'";
            bool ktUpdateKH = Connect.Exec(sqlUpdateDH);
            if (ktUpdateKH)
            {
                //if (Page != "")
                //    Response.Redirect("QuanLyDonHang.aspx?Page=" + Page);
                //else
                //    Response.Redirect("QuanLyDonHang.aspx");
                //SaveOrderDetail(arraySPList, sIdDonHang);
                //Response.Write("<script>alert('Sửa thành công!')</script>");

                string sqlDeleteCTSupervisor = @"DELETE FROM tb_ChiTietDonHang
                                            WHERE idDonHang = '" + sIdDonHang + "'";

                bool ExsqlDelete = Connect.Exec(sqlDeleteCTSupervisor);
                if (ExsqlDelete)
                {
                    //SaveOrderDetail(arraySPList, sIdDonHang);
                    if (ChuyenPhatNhanh == "")
                    {
                        SaveOrderDetail(arraySPList, sIdDonHang);
                    }
                }

                Response.Redirect("QuanLyDonHang.aspx?Page=" + Page);
            }
            else
            {
                Response.Write("<script>alert('Lỗi !')</script>");
            }
        }
    }
Ejemplo n.º 54
0
 public void SetConnectContext(Connect _connect)
 {
     connect = _connect;
 }
Ejemplo n.º 55
0
 public VoiceResponse Connect(Connect connect)
 {
     this.Append(connect);
     return(this);
 }
        private string BangDiemDanh_SQL()
        {
            string cacNgayNghi = BangDiemDanh_CacNgayNghi();
            int    songaynghi, songaythubaynghi, songayhoc, songaythubayhoc;

            PhanLoaiNgay(cacNgayNghi, out songaynghi, out songaythubaynghi, out songayhoc, out songaythubayhoc);
            if (bangdiemdanh_tontai)
            {
                string sql =
                    @"
                        UPDATE BangDiemDanh
                        SET 
                            cacngaynghi = " + "'" + cacNgayNghi + "'" + @",
                            songayhoc = " + songayhoc + @",
                            songaynghi = " + songaynghi + @",
                            songaythubayhoc = " + songaythubayhoc + @",
                            songaythubaynghi = " + songaythubaynghi + @"
                        WHERE mabangdiemdanh = " + bangdiemdanh + @"
                    ";
                return(sql);
            }
            else
            {
                string    command = @"select max(mabangdiemdanh) from BangDiemDanh";
                DataTable table   = Connect.GetTable(command);
                string    str_max_mabangdiemdanh = table.Rows[0][0].ToString();
                int       max_mabangdiemdanh     = Convert.ToInt32(str_max_mabangdiemdanh);
                bangdiemdanh = (max_mabangdiemdanh + 1).ToString();

                string malophoc = cboLopHoc_DiemDanhHocSinh.SelectedValue.ToString();
                string thang    = cboThang_DiemDanhHocSinh.SelectedValue.ToString();
                string nam      = cboNamHoc_DiemDanhHocSinh.SelectedValue.ToString();

                string sql =
                    @"
                        INSERT INTO BangDiemDanh
                                                (
                                                mabangdiemdanh,
                                                cacngaynghi,
                                                songayhoc, 
                                                songaynghi,
                                                songaythubayhoc,
                                                songaythubaynghi, 
                                                malophoc,
                                                thang, 
                                                nam
                                                )
                        VALUES 
                            ("
                    + bangdiemdanh + ","
                    + "'" + cacNgayNghi + "',"
                    + songayhoc + ","
                    + songaynghi + ","
                    + songaythubayhoc + ","
                    + songaythubaynghi + @","
                    + "'" + malophoc + "',"
                    + thang + ","
                    + nam + @"
                            )
                    ";
                return(sql);
            }
        }
Ejemplo n.º 57
0
 public ViewSanPham()
 {
     InitializeComponent();
     cn = new Connect();
 }
Ejemplo n.º 58
0
 private void LoadThongTinDonHang()
 {
     if (mQuyen.ToUpper() != "ADMIN" && mQuyen.ToUpper() != "NVVP")
     {
         //ckbDaNhanTien.Disabled = true;
         //ckbDaNhanTien.Visible = false;
     }
     if (sIdDonHang != "")
     {
         string    sql   = "select * from tb_DonHang where idDonHang='" + sIdDonHang + "'";
         DataTable table = Connect.GetTable(sql);
         if (table.Rows.Count > 0)
         {
             if (mQuyen.ToUpper() == "KH" && mIdKhachHang != table.Rows[0]["idKhachHang"].ToString())
             {
                 Response.Redirect("../Home/DangNhap.aspx");
             }
             //dvTitle.InnerHtml = "SỬA THÔNG TIN ĐƠN HÀNG";
             //btLuu.Text = "SỬA";
             //txtMaDonHang.Value = table.Rows[0]["MaDonHang"].ToString();
             //txtNgayLap.Value = DateTime.Parse(table.Rows[0]["NgayLap"].ToString()).ToString("dd/MM/yyyy");
             //string TenKH = StaticData.getField("tb_KhachHang", "TenKhachHang", "idKhachHang", table.Rows[0]["idKhachHang"].ToString());
             //////txtNguoiGui.Value = TenKH;
             //txtTenKhachHang.Value = StaticData.getField("tb_KhachHang", "SoDienThoai", "idKhachHang", table.Rows[0]["idKhachHang"].ToString());
             //hdIdKhachHang.Value = table.Rows[0]["idKhachHang"].ToString();
             //btHuy.Text = "DSĐH CỦA " + TenKH.ToUpper();
             //slKho.Value = table.Rows[0]["idKho"].ToString();
             if (mQuyen.ToUpper() == "NVGN")
             {
                 if (mIdNguoiDung != table.Rows[0]["idNguoiDung"].ToString())
                 {
                     Response.Redirect("../Home/DangNhap.aspx");
                 }
             }
             else
             {
             }
             if (table.Rows[0]["ThoiDiemDuKienGiao"].ToString() != "")
             {
                 ////txtNgayDuKienGiao.Value = DateTime.Parse(table.Rows[0]["ThoiDiemDuKienGiao"].ToString()).ToString("dd/MM/yyyy");
                 ////txtGioDuKienGiao.Value = DateTime.Parse(table.Rows[0]["ThoiDiemDuKienGiao"].ToString()).Hour.ToString();
                 ////txtPhutDuKienGiao.Value = DateTime.Parse(table.Rows[0]["ThoiDiemDuKienGiao"].ToString()).Minute.ToString();
             }
             ////slGoiDichVu.Value = table.Rows[0]["GoiDichVu"].ToString();
             ////txtThongTinBuuGui.Value = table.Rows[0]["ThongTinBuuGui"].ToString().Trim();
             ////if (table.Rows[0]["isDaNhanTien"].ToString() == "True")
             ////    ckbDaNhanTien.Checked = true;
             //dvButtonChiTietDonHang.InnerHtml = "<input id='btCapNhatChiTietDonHang' type='button' value='Thêm' onclick='CapNhatChiTietDonHang(\"THÊM\", \"" + table.Rows[0]["idDonHang"].ToString() + "\",\"\")' class='btn btn-primary btn-flat' />";
             //dvChiTietDonHang.Style.Add("display", "block");
             //txtTenKhachHang.Disabled = true;
             ////if (table.Rows[0]["NguoiNhanTra"].ToString() == "True")
             ////    radiNguoiNhanTra.Checked = true;
             //if (mQuyen.ToUpper() == "NVGN")
             //{
             //    txtMaDonHang.Disabled = true;
             //    txtGhiChu.Disabled = true;
             //}
         }
     }
     else
     {
         if (mQuyen.ToUpper() == "NVGN")
         {
             //slNhanVienGiao.Value = mIdNguoiDung;
             //slNhanVienGiao.Disabled = true;
             Response.Redirect("../Home/DangNhap.aspx");
         }
     }
 }
    protected void btLuu_Click(object sender, EventArgs e)
    {
        string TenHuyen    = "";
        string idNguoiDung = "";
        string MaLoaiCuoc  = "";

        //Tên huyên
        if (txtTenHuyen.Value.Trim() != "")
        {
            TenHuyen = txtTenHuyen.Value.Trim();
        }
        else
        {
            Response.Write("<script>alert('Bạn chưa nhập tên huyện!')</script>");
            return;
        }
        //Nhân viên giao
        idNguoiDung = slNhanVienGiao.Value.Trim();
        //Loại cước
        MaLoaiCuoc = slLoaiCuoc.Value.Trim();
        //////////
        if (sIdHuyen == "")
        {
            string sqlInsertHuyen = "insert into tb_Huyen(TenHuyen,idTinh,idNguoiDung,MaLoaiCuoc)";
            sqlInsertHuyen += " values(N'" + TenHuyen + "'";
            sqlInsertHuyen += ",'" + sIdTinh + "'";
            if (idNguoiDung != "" && idNguoiDung != "0")
            {
                sqlInsertHuyen += ",'" + idNguoiDung + "'";
            }
            else
            {
                sqlInsertHuyen += ",null";
            }
            if (MaLoaiCuoc != "" && MaLoaiCuoc != "0")
            {
                sqlInsertHuyen += ",'" + MaLoaiCuoc + "')";
            }
            else
            {
                sqlInsertHuyen += ",null)";
            }
            bool ktInsertHuyen = Connect.Exec(sqlInsertHuyen);
            if (ktInsertHuyen)
            {
                Response.Redirect("DanhMucTinh-Huyen.aspx?idTinh=" + sIdTinh);
            }
            else
            {
                Response.Write("<script>alert('Lỗi thêm huyện!')</script>");
            }
        }
        else
        {
            string sqlUpdateHuyen = "";
            sqlUpdateHuyen += "update tb_Huyen set";
            sqlUpdateHuyen += " TenHuyen = N'" + TenHuyen + "'";
            if (idNguoiDung != "" && idNguoiDung != "0")
            {
                sqlUpdateHuyen += ",idNguoiDung = '" + idNguoiDung + "'";
            }
            else
            {
                sqlUpdateHuyen += ",idNguoiDung = null";
            }
            if (MaLoaiCuoc != "" && MaLoaiCuoc != "0")
            {
                sqlUpdateHuyen += ",MaLoaiCuoc = '" + MaLoaiCuoc + "'";
            }
            else
            {
                sqlUpdateHuyen += ",MaLoaiCuoc = null";
            }
            sqlUpdateHuyen += " where idHuyen ='" + sIdHuyen + "'";
            bool ktUpdateHuyen = Connect.Exec(sqlUpdateHuyen);
            if (ktUpdateHuyen)
            {
                Response.Redirect("DanhMucTinh-Huyen.aspx?idTinh=" + sIdTinh);
            }
            else
            {
                Response.Write("<script>alert('Lỗi !')</script>");
            }
        }
    }
Ejemplo n.º 60
0
    private void LoadDuAn()
    {
        string sql = "";

        sql += @"select * from( SELECT ROW_NUMBER() OVER(ORDER BY PhieuTraNo.IDPhieuTraNo desc)AS RowNumber,* from  PhieuTraNo where IDKhachHang !='10108' ";
        if (pTenKhachHang != "")
        {
            sql += " and PhieuTraNo.IDKhachHang in (select KhachHang.IDKhachHang from KhachHang where KhachHang.TenKhachHang like N'%" + pTenKhachHang + "%' )";
        }
        if (pTenSanPham != "")
        {
            sql += " and PhieuTraNo.MaPhieuTraNo like N'%" + pTenSanPham + "%'";
        }
        if (pTuNgayNhap != "")
        {
            sql += " and PhieuTraNo.Ngay >='" + StaticData.ConvertDDMMtoMMDD(pTuNgayNhap) + " 00:00:00'";
        }
        if (pDenNgayNhap != "")
        {
            sql += " and PhieuTraNo.Ngay <='" + StaticData.ConvertDDMMtoMMDD(pDenNgayNhap) + " 00:00:00'";
        }
        sql += "  ) as tb1";

        DataTable showTien = Connect.GetTable("select isnull(sum(SoTien),0) from (" + sql + ") as tb2");

        sql += " WHERE RowNumber BETWEEN (" + Page + " - 1) * " + PageSize + " + 1 AND (((" + Page + " - 1) * " + PageSize + " + 1) + " + PageSize + ") - 1";

        DataTable table = Connect.GetTable(sql);

        SetPage();

        string html = @" <table class='table table-bordered table-striped'>
                    <tr>
                        <th class='th'>
                          STT
                        </th>
                        <th class='th'>
                         Mã phiếu trả
                        </th>
                        <th class='th'>
                          Ngày
                        </th>
                          <th class='th'>
                         Tên khách hàng
                        </th>
                       <th class='th'>
                         Số tiền
                        </th>
                          <th class='th'>
                         Ghi chú
                        </th>

                        <th class='th'>"

                      //</th>
                      //<th class='th'>
                      + @"
                        </th>
                    </tr>";

        // double SoTienPhaiThu = 0;
        for (int i = 0; i < table.Rows.Count; i++)
        {
            html += "       <tr>";
            html += "       <td>" + (((Page - 1) * PageSize) + i + 1).ToString() + "</td>";


            html += "       <td>" + table.Rows[i]["MaPhieuTraNo"].ToString() + "</td>";



            html += "       <td>" + DateTime.Parse(table.Rows[i]["Ngay"].ToString()).ToString("dd/MM/yyyy") + "</td>";
            html += "       <td>" + StaticData.getField("KhachHang", "TenKhachHang", "IDKhachHang", table.Rows[i]["IDKhachHang"].ToString().Trim()) + "</td>";
            string Gia          = table.Rows[i]["SoTien"].ToString().Trim();
            string ThemChuoiMoi = "";
            try
            {
                ThemChuoiMoi += "Người thu: " + table.Rows[i]["NguoiDung"].ToString() + " lúc ";
                ThemChuoiMoi += DateTime.Parse(table.Rows[i]["NgayThaoTac"].ToString()).ToString("dd/MM/yyyy HH:mm");
            }
            catch
            {
            }
            if (Gia.Trim() == "0")
            {
                html += "<td>0 (" + ThemChuoiMoi + ")</td>";
            }
            else
            {
                html += "<td>" + double.Parse(Gia).ToString("#,##").Replace(",", ".") + " (" + ThemChuoiMoi + ")</td>";
            }

            html += "       <td>" + table.Rows[i]["GhiChu"].ToString().Replace("\n", "<br />") + "</td>";

            //html += " <td style='text-align:center;font-size: 100%;'><a href='#' onclick='window.location=\"PhieuTraNoKhachHang-CapNhat.aspx?Page=" + Page.ToString() + "&IDChiTietGiaTheoKhach=" + table.Rows[i]["IDPhieuTraNo"].ToString() + "\"'><img title='Sửa' class='imgCommand' src='../Images/edit.png'  /> Sửa </a></td>";
            html += " <td style='text-align:center;font-size: 100%;'><a href='#' onclick='DeleteKhachHangSanPham(\"" + table.Rows[i]["IDPhieuTraNo"].ToString() + "\")'><img title='Xóa' class='imgCommand' src='../Images/delete.png' />Xóa</a></td>";
            html += "       </tr>";
        }
        html += "   <tr>";
        html += "       <td colspan='12' class='footertable'>";
        string url = "PhieuTraNoKhachHang.aspx?";

        if (pTenKhachHang != "")
        {
            url += "TenKhachHang=" + pTenKhachHang + "&";
        }
        if (pTenSanPham != "")
        {
            url += "TenSanPham=" + pTenSanPham + "&";
        }
        if (pTuNgayNhap != "")
        {
            url += "TuNgayNhap=" + pTuNgayNhap + "&";
        }
        if (pDenNgayNhap != "")
        {
            url += "DenNgayNhap=" + pDenNgayNhap + "&";
        }
        url  += "Page=";
        html += "           <a class='notepaging' id='page_fist' href='" + url + txtFistPage + "' /><<</a>";
        //Page 1
        if (txtPage1 != "")
        {
            if (Page.ToString() == txtPage1)
            {
                html += "           <a id='page_1' class='notepagingactive' href='" + url + txtPage1 + "' />" + txtPage1 + "</a>";
            }
            else
            {
                html += "           <a id='page_1' class='notepaging' href='" + url + txtPage1 + "' />" + txtPage1 + "</a>";
            }
        }
        else
        {
            html += "           <a id='page_1' class='notepagingnone' href='" + url + txtPage1 + "' />" + txtPage1 + "</a>";
        }
        //Page 2
        if (txtPage2 != "")
        {
            if (Page.ToString() == txtPage2)
            {
                html += "           <a id='page_2' class='notepagingactive' href='" + url + txtPage2 + "' />" + txtPage2 + "</a>";
            }
            else
            {
                html += "           <a id='page_2' class='notepaging' href='" + url + txtPage2 + "' />" + txtPage2 + "</a>";
            }
        }
        else
        {
            html += "           <a id='page_2' class='notepagingnone' href='" + url + txtPage2 + "' />" + txtPage2 + "</a>";
        }
        //Page 3
        if (txtPage3 != "")
        {
            if (Page.ToString() == txtPage3)
            {
                html += "           <a id='page_3' class='notepagingactive' href='" + url + txtPage3 + "' />" + txtPage3 + "</a>";
            }
            else
            {
                html += "           <a id='page_3' class='notepaging' href='" + url + txtPage3 + "' />" + txtPage3 + "</a>";
            }
        }
        else
        {
            html += "           <a id='page_3' class='notepagingnone' href='" + url + txtPage3 + "' />" + txtPage3 + "</a>";
        }
        //Page 4
        if (txtPage4 != "")
        {
            if (Page.ToString() == txtPage4)
            {
                html += "           <a id='page_4' class='notepagingactive' href='" + url + txtPage4 + "' />" + txtPage4 + "</a>";
            }
            else
            {
                html += "           <a id='page_4' class='notepaging' href='" + url + txtPage4 + "' />" + txtPage4 + "</a>";
            }
        }
        else
        {
            html += "           <a id='page_4' class='notepagingnone' href='" + url + txtPage4 + "' />" + txtPage4 + "</a>";
        }
        //Page 5
        if (txtPage5 != "")
        {
            if (Page.ToString() == txtPage5)
            {
                html += "           <a id='page_5' class='notepagingactive' href='" + url + txtPage5 + "' />" + txtPage5 + "</a>";
            }
            else
            {
                html += "           <a id='page_5' class='notepaging' href='" + url + txtPage5 + "' />" + txtPage5 + "</a>";
            }
        }
        else
        {
            html += "           <a id='page_5' class='notepagingnone' href='" + url + txtPage5 + "' />" + txtPage5 + "</a>";
        }

        html += "           <a id='page_last' class='notepaging' href='" + url + txtLastPage + "' />>></a>";
        html += "   </td>";

        html += "</tr>";
        html += "<tr style='background-color:yellow;font-weight: bold;'>";
        html += "<td colspan='4' style='text-align:right;'>Tổng cộng</td>";
        html += "<td >" + double.Parse(showTien.Rows[0][0].ToString()).ToString("#,##").Replace(",", ".") + "</td>";
        html += "<td colspan='3'>&nbsp;</td>";
        html += "</tr>";
        html += "     </table>";

        dvNguoiDung.InnerHtml = html;
    }