Exemplo n.º 1
0
    private void UpdateDownloads(int id)
    {
        string path      = "";
        string ext       = "";
        string file_name = "";
        int    fileSize  = 0;

        try
        {
            System.Data.SqlTypes.SqlDateTime nullDate;
            nullDate = SqlDateTime.Null;

            DBconnection obj = new DBconnection();
            obj.SetCommandSP = "z_UpdateDownload";

            obj.AddParam("@id", id);

            obj.AddParam("@download_type", rbtnDownloadType.SelectedItem.Text.ToString());

            try
            {
                obj.AddParam("@event_date", DateTime.Parse(event_date.SelectedDate.ToString()));
            }
            catch
            { obj.AddParam("@event_date", nullDate); }
            obj.AddParam("@event_name", txtEventName.Text.ToString());
            obj.AddParam("@title", txtTitle.Text.ToString());
            obj.AddParam("@author", txtAuthor.Text.ToString());

            try
            {
                obj.AddParam("@file_name", Session["DownloadedFile"].ToString());
            }
            catch { obj.AddParam("@file_name", ""); }


            int exe = obj.ExecuteNonQuery();

            if (exe > 0)
            {
                clear();

                showmsg("Download Has Been Updated Successfully !", "view_download.aspx");
            }
        }
        catch (Exception ex)
        { }
    }
Exemplo n.º 2
0
        public async Task Unclaim(ulong side)
        {
            DBconnection _conn = DBconnection.Instance();

            _conn.DBName = "cynicalp_weebnation";

            ulong CurrentOwnerID = 0;
            ulong DiceID         = 0;

            if (_conn.IsConnected())
            {
                string query = "SELECT DiceID,DiceOwner FROM dice WHERE DiceNumber=@side";
                var    cmd   = new MySqlCommand(query, _conn.Connection);
                cmd.Parameters.AddWithValue("@side", side);
                var reader = await cmd.ExecuteReaderAsync();

                if (!reader.HasRows)
                {
                    return;
                }

                while (await reader.ReadAsync())
                {
                    DiceID         = (ulong)reader.GetInt64(0);
                    CurrentOwnerID = (ulong)reader.GetInt64(1);
                }
                _conn.Close();
            }

            if (CurrentOwnerID != Context.User.Id || DiceID == 0)
            {
                await Context.Channel.SendErrorAsync("You cannot unclaim a side you do not own.");

                return;
            }

            if (_conn.IsConnected())
            {
                string query = "DELETE FROM dice WHERE DiceID=@did";
                var    cmd   = new MySqlCommand(query, _conn.Connection);
                cmd.Parameters.AddWithValue("@did", DiceID);
                await cmd.ExecuteNonQueryAsync();

                _conn.Close();
            }

            await Context.Channel.SendSuccessAsync($"Side ${side} successfully unclaimed.");
        }
Exemplo n.º 3
0
        public void IncreaseQuantity(int quantity)
        {
            DBconnection dbConnection = new DBconnection();

            dbConnection.OpenConnection();

            string query = "UPDATE products SET quantity = quantity + @quantity, updated_at = NOW() WHERE id = @id";

            using (MySqlCommand cmd = new MySqlCommand(query, dbConnection.connection))
            {
                cmd.Parameters.AddWithValue("@quantity", quantity);
                cmd.Parameters.AddWithValue("@id", this.Id);

                cmd.ExecuteNonQuery();
            }
        }
Exemplo n.º 4
0
    // Get


    public DataTable SearchDownloadsByAlphabet()
    {
        DataTable dt = new DataTable();

        try
        {
            DBconnection obj = new DBconnection();

            obj.SetCommandSP = "z_SearchByAlphabetDownloads";
            obj.AddParam("@name", this.title);

            dt = obj.ExecuteTable();
        }
        catch { }
        return(dt);
    }
Exemplo n.º 5
0
    public DataTable GetDownloadsByDownloadsType()
    {
        DataTable dt = new DataTable();

        try
        {
            DBconnection obj = new DBconnection();

            obj.SetCommandSP = "z_GetDownloadsByDownloadType";
            obj.AddParam("@download_type", this.downloadType);

            dt = obj.ExecuteTable();
        }
        catch { }
        return(dt);
    }
        public Candidate DeleteCandidate(int id)
        {
            Candidate Candidate = GetCandidateById(id);

            var SessionFactory = DBconnection.GetSessionFactory();

            using (var session = SessionFactory.OpenSession())
            {
                using (var trans = session.BeginTransaction())
                {
                    session.Delete(Candidate);
                    trans.Commit();
                }
            }
            return(Candidate);
        }
        public bool SAVEStudentDAL(StudentInformation aStudent, string Details)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "insert into Students(CID,StudentID,Name) values((select ID from Course where Course.Details='" + Details + "'),'" + aStudent.StudentID + "','" + aStudent.name + "' )";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 8
0
        public ActionResult GastosCategoria()
        {
            int id = Convert.ToInt32(Session["user"].ToString());

            SqlCommand comando = new DBconnection().GetConnction();

            comando.CommandText = @"SELECT categorias.nome AS 'categoria', SUM(gastos.valor) AS 'valor', cartoes.id_pessoas FROM categorias INNER JOIN gastos 
ON gastos.id_categoria = categorias.Id INNER JOIN cartoes ON cartoes.Id = gastos.id_cartao 
WHERE MONTH(gastos.entrada) = MONTH(GETDATE()) AND cartoes.id_pessoas = @ID GROUP BY categorias.nome, cartoes.id_pessoas";
            comando.Parameters.AddWithValue("@ID", id);
            DataTable tabela = new DataTable();

            tabela.Load(comando.ExecuteReader());

            return(Content(JsonConvert.SerializeObject(new { tabela })));
        }
Exemplo n.º 9
0
    public int AddFeedback()
    {
        int          i   = 0;
        DBconnection obj = new DBconnection();

        obj.SetCommandSP = "z_AddFeedback";
        obj.AddParam("@name", this.Name);
        obj.AddParam("@emailid", this.EmailId);
        obj.AddParam("@club_name", this.ClubName);
        obj.AddParam("@mobile", this.Mobile);
        obj.AddParam("@comments", this.Comments);
        obj.AddParam("@ipaddress", this.Ipaddress);

        i = obj.ExecuteNonQuery();
        return(i);
    }
Exemplo n.º 10
0
        public bool Cancel_checkInDAL(int ReservationID, Cost aCost)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "UPDATE RECORD set CustomerStatus='Boocked' where RECORD.Id=" + ReservationID + "   UPDATE ROOM set ROOM.Status='Available' where Room_Id=(SELECT RECORD.RoomId from RECORD where Record.id=" + ReservationID + ") Update COST set Due=" + aCost.Due + " +(select LastPayment from Cost where Id=" + ReservationID + ") where ID=" + ReservationID + "";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
    private void GetAdminTeam(int id)
    {
        DBconnection obj = new DBconnection();

        obj.SetCommandSP = "sp_GetAdminTeam";
        obj.AddParam("@id", id);
        DataTable dt = new DataTable();

        dt = obj.ExecuteTable();
        if (dt.Rows.Count > 0)
        {
            DDLYears.SelectedItem.Text   = dt.Rows[0]["years"].ToString();
            DDLMemName.SelectedItem.Text = dt.Rows[0]["Name"].ToString();
            DDLDesig.SelectedItem.Text   = dt.Rows[0]["designation"].ToString();
        }
    }
 private void GetProfile(int id)
 {
     try
     {
         DBconnection obj = new DBconnection();
         obj.SetCommandSP = "z_GetDistMemberforAdminTeams";
         obj.AddParam("@MemberId", id);
         DataTable dt = new DataTable();
         dt = obj.ExecuteTable();
         if (dt.Rows.Count > 0)
         {
             lblClubName.Text = dt.Rows[0]["club_name"].ToString();
         }
     }
     catch { }
 }
Exemplo n.º 13
0
        public bool DeleteRoomsDAL(Room aRoom)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "DELETE ROOM where Room_ID=" + aRoom.Id + "";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           result     = Action.ExecuteNonQuery();

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 14
0
        public bool UpdateRoomInfoDAL(Room aRoom)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "Update ROOM set Floor='" + aRoom.Floor + "',RoomNo='" + aRoom.RoomNo + "',Type='" + aRoom.Type + "',Class='" + aRoom.Class + "',Rent=" + aRoom.Rent + " where Room_Id=" + aRoom.Id + " ";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           result     = Action.ExecuteNonQuery();

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 15
0
        public bool SaveRoomsDAL(Room aRoom)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "Insert into Room(Floor,RoomNo,Type,Class,Rent,Status) values ('" + aRoom.Floor + "','" + aRoom.RoomNo + "','" + aRoom.Type + "','" + aRoom.Class + "'," + aRoom.Rent + ",'Available') ";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 16
0
        public bool Save_Customer_DiscountDAL(Cost aCost)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "UPDATE COST set Total=" + aCost.TotalCost + ",Due=" + aCost.Due + ",Discount=" + aCost.Discount + " where id=" + aCost.Id + "";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 17
0
    // Get RI President

    public DataTable GetRIPresident()
    {
        DataTable dt = new DataTable();

        try
        {
            DBconnection obj = new DBconnection();

            obj.SetCommandSP = "z_GetRIPresident";
            obj.AddParam("@id", this.id);

            dt = obj.ExecuteTable();
        }
        catch { }
        return(dt);
    }
Exemplo n.º 18
0
    // Get Interact Club

    public DataTable GetInteractClub()
    {
        DataTable dt = new DataTable();

        try
        {
            DBconnection obj = new DBconnection();

            obj.SetCommandSP = "z_GetInteractClub";
            obj.AddParam("@interact_id", this.id);

            dt = obj.ExecuteTable();
        }
        catch { }
        return(dt);
    }
        public bool SaveEvaluationDAL(StudentInformation aStudent, Course aCourse)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "Update Students  Set Attendance=" + aStudent.Attendance + ",Presentation=" + aStudent.Presentation + ",Assignment=" + aStudent.Assignment + ",Quiz1=" + aStudent.Quiz1 + ",Quiz2=" + aStudent.Quiz2 + ",Quiz3=" + aStudent.Quiz3 + ",QUIZ=" + aStudent.QUIZ + " ,Midterm=" + aStudent.Mid + ",Final=" + aStudent.Final + ",TotalMarks=" + aStudent.Total + ",EvaluationGrade='" + aStudent.EvaluationGrade + "' where  Students.StudentID='" + aStudent.StudentID + "' and students.CID=(select ID from course where CourseID='" + aCourse.CourseID + "')";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 20
0
        public bool CancelReservationDAL(Customer aCustomer)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = " UPDATE RECORD set  CustomerStatus='Reservation Cancelled' where RECORD.Id=" + aCustomer.Id + "";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool DeleteStudentDAL(StudentInformation aStudent, string Details)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "Delete Students  where CID=(select ID from Course where CourseID='" + Details + "') and StudentID='" + aStudent.StudentID + "' and Name='" + aStudent.name + "' ";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 22
0
        public bool RoomBooking_avilityDAL(Record aRecord)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        Query      = "UPDATE Record set RoomNo='" + aRecord.RoomNO + "' where RoomNo='" + aRecord.RoomNO + "' and (CheckInDate='" + aRecord.CheckInDate + "' or CheckInDate='" + aRecord.CheckOutDate + "' or CheckOutDate='" + aRecord.CheckInDate + "' or CheckOutDate='" + aRecord.CheckOutDate + "' or(CheckInDate Between '" + aRecord.CheckInDate + "' and '" + aRecord.CheckOutDate + "') or (CheckOutDate between  '" + aRecord.CheckInDate + "' and '" + aRecord.CheckOutDate + "' ))";
            SqlCommand    Action     = new SqlCommand(Query, connection);
            int           result     = Action.ExecuteNonQuery();

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 23
0
    public DataTable GetDownloadsById()
    {
        DataTable dt = new DataTable();

        try
        {
            DBconnection obj = new DBconnection();

            obj.SetCommandSP = "z_GetDownloadById";
            obj.AddParam("@id", this.id);

            dt = obj.ExecuteTable();
        }
        catch { }
        return(dt);
    }
Exemplo n.º 24
0
        public bool SaveReservationInformation_DAL(Customer aCustomer, Record aRecord, Cost aCost)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "Insert into CUSTOMER(Name,Age,Sex,DOB,Profession,ProfessionAddress,PermanentAddress,PresentAddress,ContactNo,Email,[NID/PassportNo]) Values('" + aCustomer.Name + "'," + aCustomer.Age + ",'" + aCustomer.Sex + "','" + aCustomer.DOB + "','" + aCustomer.Profession + "','" + aCustomer.ProfessionAddress + "','" + aCustomer.PermanentAddress + "','" + aCustomer.PresentAddress + "','" + aCustomer.ContactNo + "','" + aCustomer.Email + "','" + aCustomer.NIDorPassportNo + "') INSERT into RECORD(Id,RoomId,RoomNo,BookingDate,CheckInDate,CheckOutDate,PaymentStatus,CustomerStatus) values(" + aCustomer.Id + " ," + aRecord.RoomID + ",'" + aRecord.RoomNO + "','" + aRecord.BookingDate + "','" + aRecord.CheckInDate + "','" + aRecord.CheckOutDate + "','" + aRecord.PaymentStatus + "','Boocked')  INSERT into COST values(" + aCustomer.Id + " ," + aCost.TotalCost + "," + aCost.Due + "," + aCost.LastPayment + ",0)";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 25
0
    public DataTable GetDownloadsByEventType()
    {
        DataTable dt = new DataTable();

        try
        {
            DBconnection obj = new DBconnection();

            obj.SetCommandSP = "z_GetAllDowonloadsByEvents";
            obj.AddParam("@event_name", this.eventName);

            dt = obj.ExecuteTable();
        }
        catch { }
        return(dt);
    }
Exemplo n.º 26
0
    public DataTable GetRiDgDataCurrentYear()
    {
        DataTable dt = new DataTable();

        try
        {
            DBconnection obj = new DBconnection();

            obj.SetCommandSP = "z_GetRiDgDataCurrentYear";
            obj.AddParam("@year", this.year);

            dt = obj.ExecuteTable();
        }
        catch { }
        return(dt);
    }
Exemplo n.º 27
0
 protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         string       i   = e.CommandArgument.ToString();
         int          id  = int.Parse(i.ToString());
         DBconnection obj = new DBconnection();
         obj.SetCommandSP = "sp_DeleteUpcomingEvent";
         obj.AddParam("@id", id);
         if (obj.ExecuteNonQuery() > 0)
         {
             //RadGrid1.DataBind();
             ManageGrid();
         }
     }
 }
Exemplo n.º 28
0
        public bool Confirm_PaymentDAL(Customer aCustomer, Record aRecord, Cost aCost)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "UPDATE CUSTOMER set CUSTOMER.Name = '" + aCustomer.Name + "',CUSTOMER.Age = " + aCustomer.Age + ",CUSTOMER.Sex = '" + aCustomer.Sex + "',CUSTOMER.DOB = '" + aCustomer.DOB + "',CUSTOMER.Profession = '" + aCustomer.Profession + "',CUSTOMER.ProfessionAddress = '" + aCustomer.ProfessionAddress + "',CUSTOMER.PermanentAddress = '" + aCustomer.PermanentAddress + "',CUSTOMER.PresentAddress = '" + aCustomer.PresentAddress + "',CUSTOMER.ContactNo = '" + aCustomer.ContactNo + "',CUSTOMER.Email = '" + aCustomer.Email + "',CUSTOMER.[NID/PassportNo] = '" + aCustomer.NIDorPassportNo + "' where CUSTOMER.Id = " + aCustomer.Id + " UPDATE RECORD set RoomId = " + aRecord.RoomID + ", RoomNo = '" + aRecord.RoomNO + "', BookingDate = '" + aRecord.BookingDate + "', CheckInDate = '" + aRecord.CheckInDate + "', CheckOutDate = '" + aRecord.CheckOutDate + "', PaymentStatus = '" + aRecord.PaymentStatus + "', CustomerStatus = 'Checked Out' where RECORD.Id = " + aCustomer.Id + "  UPDATE COST Set Total= " + aCost.TotalCost + ", Due = " + aCost.Due + " where COST.Id = " + aCustomer.Id + "";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 29
0
    private void GetPastDistrictGove(int id)
    {
        DBconnection obj = new DBconnection();

        obj.SetCommandSP = "z_GetPastDistGove";
        obj.AddParam("@id", id);
        DataTable dt = new DataTable();

        dt = obj.ExecuteTable();
        if (dt.Rows.Count > 0)
        {
            DDLYears.SelectedItem.Text = dt.Rows[0]["year"].ToString();
            txtRotarian.Text           = dt.Rows[0]["rotarian_name"].ToString();
            txtClubName.Text           = dt.Rows[0]["club_name"].ToString();
        }
    }
Exemplo n.º 30
0
        public bool Cancel_PaymentDAL(int ReservationID, Cost aCost)
        {
            SqlConnection connection = DBconnection.OpenConnection();
            string        query      = "UPDATE COST set Due=" + aCost.Due + " +(select LastPayment from Cost where Id=" + ReservationID + ") where ID=" + ReservationID + " ";
            SqlCommand    Action     = new SqlCommand(query, connection);
            int           Result     = Action.ExecuteNonQuery();

            if (Result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }