Exemplo n.º 1
0
        public void updateLikes(int UserID, int addID)
        {
            //Add current profile to like
            List <int> likeList;
            SqlCommand objCommand = new SqlCommand();

            //objCommand  = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "TP_GetLikes";

            objCommand.Parameters.AddWithValue("@UserId", UserID);

            objDB.GetDataSetUsingCmdObj(objCommand);
            Byte[] byteArray;
            //objDB.GetField("Likes", 0) != System.DBNull.Value

            byteArray = (Byte[])objDB.GetField("Likes", 0);



            BinaryFormatter deSerializer = new BinaryFormatter();

            MemoryStream memStream = new MemoryStream(byteArray);


            try
            {
                likeList = (List <int>)deSerializer.Deserialize(memStream);
            }
            catch
            {
                likeList = new List <int>();
            }


            likeList.Add(addID);

            BinaryFormatter serializer = new BinaryFormatter();

            MemoryStream stream = new MemoryStream();

            Byte[] Store;

            serializer.Serialize(stream, likeList);

            Store                  = memStream.ToArray();
            objCommand             = new SqlCommand();
            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "TP_StoreLikes";

            objCommand.Parameters.AddWithValue("@UserId", UserID);
            objCommand.Parameters.AddWithValue("@Likes", Store);
            objDB.DoUpdateUsingCmdObj(objCommand);
        }
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            string email = txtCurrentEmail.Text;
            string newPhone = txtPhonenumber.Text;

            SqlCommand phoneCmd = new SqlCommand();
            DBConnect objDB = new DBConnect();

            phoneCmd.CommandType = CommandType.StoredProcedure;
            phoneCmd.CommandText = "dbo.TP_ResetPhonenumber";

            SqlParameter inputEmail = new SqlParameter("@email", email);
            inputEmail.Direction = ParameterDirection.Input;
            inputEmail.SqlDbType = SqlDbType.NVarChar;
            inputEmail.Size = 50;
            phoneCmd.Parameters.Add(inputEmail);

            SqlParameter inputPhone = new SqlParameter("@newPhone", newPhone);
            inputPhone.Direction = ParameterDirection.Input;
            inputPhone.SqlDbType = SqlDbType.NVarChar;
            inputPhone.Size = 50;
            phoneCmd.Parameters.Add(inputPhone);

            phoneCmd.Parameters.Add("@results", SqlDbType.Int).Direction = ParameterDirection.Output;
            objDB.DoUpdateUsingCmdObj(phoneCmd);
            int result = Convert.ToInt32(phoneCmd.Parameters["@results"].Value);

            if (result == 1)
                lblMsg.Text = "Your phone number was changed succesfully!";
            else if (result == 0)
                lblMsg.Text = "Your phone number was not changed!Please try again";
        }
Exemplo n.º 3
0
        public bool AddCustomer()
        {
            bool added = true;

            DBConnect objDB = new DBConnect();

            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;

            objCommand.CommandText = "TPAddCustomer";


            objCommand.Parameters.AddWithValue("@Email", Email);
            objCommand.Parameters.AddWithValue("@Password", Password);
            objCommand.Parameters.AddWithValue("@FirstName", FirstName);
            objCommand.Parameters.AddWithValue("@LastName", LastName);
            objCommand.Parameters.AddWithValue("@PhoneNumber", PhoneNumber);
            objCommand.Parameters.AddWithValue("@DeliveryAddress", DeliveryAddress);
            objCommand.Parameters.AddWithValue("@BillingAddress", BillingAddress);
            objCommand.Parameters.AddWithValue("@SecurityQuestion", SecurityQuestion);
            objCommand.Parameters.AddWithValue("@SecurityAnswer", SecurityAnswer);
            objCommand.Parameters.AddWithValue("@VWID", VWID);

            var result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result == -1)
            {
                added = false;
            }
            return(added);
        }
Exemplo n.º 4
0
        public bool AddAddRestaurant()
        {
            bool added = true;

            DBConnect objDB = new DBConnect();

            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;

            objCommand.CommandText = "TPAddRestaurant";


            objCommand.Parameters.AddWithValue("@Email", Email);
            objCommand.Parameters.AddWithValue("@Password", Password);
            objCommand.Parameters.AddWithValue("@FirstName", FirstName);
            objCommand.Parameters.AddWithValue("@LastName", LastName);
            objCommand.Parameters.AddWithValue("@Cuisine", Cuisine);
            objCommand.Parameters.AddWithValue("@RestaurantName", RestaurantName);
            objCommand.Parameters.AddWithValue("@Location", Location);
            objCommand.Parameters.AddWithValue("@PhoneNumber", PhoneNumber);
            objCommand.Parameters.AddWithValue("@SecurityQuestion", SecurityQuestion);
            objCommand.Parameters.AddWithValue("@SecurityAnswer", SecurityAnswer);
            objCommand.Parameters.AddWithValue("@ImgURL", ImgURL);
            objCommand.Parameters.AddWithValue("@VWID", VWID);

            var result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result == -1)
            {
                added = false;
            }
            return(added);
        }
Exemplo n.º 5
0
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            string email = txtCurrentEmail.Text;
            string newName = txtNewName.Text;

            SqlCommand name = new SqlCommand();
            DBConnect objDB = new DBConnect();

            name.CommandType = CommandType.StoredProcedure;
            name.CommandText = "dbo.TP_ResetName";

            SqlParameter inputEmail = new SqlParameter("@email", email);
            inputEmail.Direction = ParameterDirection.Input;
            inputEmail.SqlDbType = SqlDbType.NVarChar;
            inputEmail.Size = 50;
            name.Parameters.Add(inputEmail);

            SqlParameter inputName = new SqlParameter("@newName", newName);
            inputName.Direction = ParameterDirection.Input;
            inputName.SqlDbType = SqlDbType.NVarChar;
            inputName.Size = 50;
            name.Parameters.Add(inputName);

               name.Parameters.Add("@result", SqlDbType.Int).Direction = ParameterDirection.Output;
               objDB.DoUpdateUsingCmdObj(name);
                int result = Convert.ToInt32(name.Parameters["@result"].Value);

            if (result == 1)
                  lblMsg.Text = "Your name was changed succesfully!";
            else if (result==0)
                  lblMsg.Text = "Your name was not changed!";
        }
Exemplo n.º 6
0
        public Boolean AssessmentsUpdate(String fiscalYear)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "UpdateAssessments";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);

            SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32);
            outputParameter.Direction = ParameterDirection.ReturnValue;

            objcomm.Parameters.Add(outputParameter);

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);

            int result = int.Parse(objcomm.Parameters["@result"].Value.ToString());

            if (result == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 7
0
        public bool AddNewCustomer(Customer newCustomer)
        {
            DBConnect objDB = new DBConnect();
            SqlCommand objCommand = new SqlCommand();
            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "AddTPCustomer";
            objCommand.Parameters.AddWithValue("@Name", newCustomer.name);
            objCommand.Parameters.AddWithValue("@Email", newCustomer.email );
            objCommand.Parameters.AddWithValue("@password", newCustomer.password);
            objCommand.Parameters.AddWithValue("@address", newCustomer.shippingAddress);
            objCommand.Parameters.AddWithValue("@city", newCustomer.shippingAddress);
            objCommand.Parameters.AddWithValue("@state", newCustomer.shippingState);
            objCommand.Parameters.AddWithValue("@zipcode", newCustomer.shippingZipcode);

            //integer to determine if value was added into DB or not
            int result= objDB.DoUpdateUsingCmdObj(objCommand);

            if (!(result <= 0)) //if a new row was successsfully added
            {
                return false;
            }
            else               //else the row was not added successfully
            {
                return true;

            }
        }
Exemplo n.º 8
0
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            string oldpass = txtOldPass.Text;
            string newpass1 = txtNewPass1.Text;
            string newpass2 = txtNewPass2.Text;
            if (newpass1 == newpass2)
            {
                DBConnect db = new DBConnect();

                string email = Session["emailSession"].ToString();
                SqlCommand command = new SqlCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "UpdateMerch";
                command.Parameters.AddWithValue("@email", email);
                command.Parameters.AddWithValue("@oldPass", oldpass);
                command.Parameters.AddWithValue("@newPass1", newpass1);
                command.Parameters.AddWithValue("@newPass2", newpass2);
                db.DoUpdateUsingCmdObj(command);
            }

            else
            {
                Label lblerror = new Label();
                lblerror.Text = "New Passwords do not match please try again";
            }
        }
Exemplo n.º 9
0
        public bool AddNewMerchant()
        {
            bool added = true;

            DBConnect objDB = new DBConnect();

            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;

            objCommand.CommandText = "TPAddMerchants";


            objCommand.Parameters.AddWithValue("@FirstName", FirstName);
            objCommand.Parameters.AddWithValue("@LastName", LastName);
            objCommand.Parameters.AddWithValue("@CompanyName", CompanyName);
            objCommand.Parameters.AddWithValue("@Email", Email);
            objCommand.Parameters.AddWithValue("@Password", Password);
            objCommand.Parameters.AddWithValue("@APIKey", APIKey);
            objCommand.Parameters.AddWithValue("@MerchantAccountID", MerchantAccountID);


            var result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result == -1)
            {
                added = false;
            }
            return(added);
        }
Exemplo n.º 10
0
        public bool NewCustomer(CustomerInformation newCustomer)
        {
            DBConnect  objDB      = new DBConnect();
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "TP_NewCustomer";
            objCommand.Parameters.AddWithValue("@loginID", newCustomer.LoginID);
            objCommand.Parameters.AddWithValue("@password", newCustomer.Password);
            objCommand.Parameters.AddWithValue("@name", newCustomer.Name);
            objCommand.Parameters.AddWithValue("@address", newCustomer.Address);
            objCommand.Parameters.AddWithValue("@city", newCustomer.City);
            objCommand.Parameters.AddWithValue("@state", newCustomer.State);
            objCommand.Parameters.AddWithValue("@zipcode", newCustomer.ZipCode);

            //integer to determine if value was added into DB or not
            int result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (!(result <= 0)) //if a new row was successsfully added
            {
                return(false);
            }
            else               //else the row was not added successfully
            {
                return(true);
            }
        }
Exemplo n.º 11
0
        public string[] UpdateCustomer(CustomerClass fred, CreditCardClass cc, object[] stupid)
        {
            DBConnect DB = new DBConnect();
            SqlCommand command = new SqlCommand();
            string[] meh = new string[3];
            ErrorCodes ec = new ErrorCodes();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "CustomerUpdate";
            command.Parameters.AddWithValue("@FirstName", fred.Firstname);
            command.Parameters.AddWithValue("@Address", fred.Address);
            command.Parameters.AddWithValue("@City", fred.City);
            command.Parameters.AddWithValue("@State", fred.State);
            command.Parameters.AddWithValue("@ZipCode", fred.ZipCode);
            command.Parameters.AddWithValue("@AccountBalance", cc.AccountBalance);
            meh[0] = (DB.DoUpdateUsingCmdObj(command) > 0) ? "true" : "false";
            SqlCommand sandy = new SqlCommand();
            sandy.CommandType = CommandType.StoredProcedure;
            sandy.CommandText = "VerifyInfo";
            sandy.Parameters.AddWithValue("@CreditCardNum", cc.CardNumber);
            sandy.Parameters.AddWithValue("@CVV", cc.CVV);
            sandy.Parameters.AddWithValue("@TransAmnt", float.Parse(stupid[2].ToString()));
            sandy.Parameters.AddWithValue("@FirstName", fred.Firstname);
            SqlParameter returnParam = new SqlParameter("@RVAL", DbType.Int32);
            returnParam.Direction = ParameterDirection.ReturnValue;
            sandy.Parameters.Add(returnParam);

            //            DataSet ds = DB.GetDataSetUsingCmdObj(sandy);
            DB.GetDataSetUsingCmdObj(sandy);
            meh[1] = sandy.Parameters["@RVAL"].Value.ToString();
            meh[2] = ec.GetErrorCodeMessage(int.Parse(meh[1]));

            return meh;
        }
Exemplo n.º 12
0
        public bool UpdateAccountInfo(int accType, string loginID, string name, string phone, string address,
                                      string city, string state, int zipCode)
        {
            DBConnect  objDB      = new DBConnect();
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;

            objCommand.CommandText = "TP_UpdateAccount";

            objCommand.Parameters.AddWithValue("@AccountType", accType);
            objCommand.Parameters.AddWithValue("@Email", loginID);
            objCommand.Parameters.AddWithValue("@Name", name);
            objCommand.Parameters.AddWithValue("@Phone", phone);
            objCommand.Parameters.AddWithValue("@Address", address);
            objCommand.Parameters.AddWithValue("@City", city);
            objCommand.Parameters.AddWithValue("@State", state);
            objCommand.Parameters.AddWithValue("@ZipCode", zipCode);

            int result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result != -1)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 13
0
 protected static bool updateRestaurant(Restaurant restaurant)
 {
     try {
         DBConnect  dbConnect = new DBConnect();
         SqlCommand cmd       = new SqlCommand {
             CommandType = CommandType.StoredProcedure,
             CommandText = "TP_updateRestaurantUser"
         };
         cmd.Parameters.AddWithValue("@accountID", restaurant.username);
         cmd.Parameters.AddWithValue("@restaurant_name", restaurant.restaurant_name);
         cmd.Parameters.AddWithValue("@restaurant_phone_number", restaurant.restaurant_phone_number);
         cmd.Parameters.AddWithValue("@restaurant_logo", restaurant.restaurant_logo);
         cmd.Parameters.AddWithValue("@restaurant_cuisine", restaurant.restaurant_cuisine);
         int rowCount = dbConnect.DoUpdateUsingCmdObj(cmd);
         if (rowCount == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     } catch (SqlException ex) {
         Debug.WriteLine(ex.Message + ex.StackTrace);
         return(false);
     }
 }
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtPhonenumber.Text) || String.IsNullOrEmpty(txtCurrentEmail.Text))
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('All fields are required.Thank you!'); </script>");

            string email = txtCurrentEmail.Text;
            string newPhone = txtPhonenumber.Text;
            SqlCommand phoneCmd = new SqlCommand();
            DBConnect objDB = new DBConnect();

            phoneCmd.CommandType = CommandType.StoredProcedure;
            phoneCmd.CommandText = "dbo.TP_ResetPhonenumber";

            SqlParameter inputEmail = new SqlParameter("@email", email);
            inputEmail.Direction = ParameterDirection.Input;
            inputEmail.SqlDbType = SqlDbType.NVarChar;
            inputEmail.Size = 50;
            phoneCmd.Parameters.Add(inputEmail);

            SqlParameter inputPhone = new SqlParameter("@newPhone", newPhone);
            inputPhone.Direction = ParameterDirection.Input;
            inputPhone.SqlDbType = SqlDbType.NVarChar;
            inputPhone.Size = 50;
            phoneCmd.Parameters.Add(inputPhone);

            phoneCmd.Parameters.Add("@results", SqlDbType.Int).Direction = ParameterDirection.Output;
            objDB.DoUpdateUsingCmdObj(phoneCmd);
            int result = Convert.ToInt32(phoneCmd.Parameters["@results"].Value);

            if (result == 1)
                lblMsg.Text = "Your phone number was changed succesfully!";
            else if (result == 0)
                lblMsg.Text = "Your phone number was not changed!Please try again";
        }
        protected void btnPlaceOrder_Click(object sender, EventArgs e)
        {
            List<cartItem> cartItems = new List<cartItem>();
            cartItems = (List<cartItem>)Session["cart"];

            DBConnect objDB = new DBConnect();
            SqlCommand addPurchase = new SqlCommand();

            addPurchase.CommandType = CommandType.StoredProcedure;
            addPurchase.CommandText = "TP_CustomerTransactions";

            SqlCommand updateProdQuan = new SqlCommand();

            updateProdQuan.CommandType = CommandType.StoredProcedure;
            updateProdQuan.CommandText = "TP_subtractProducts";

            foreach(cartItem obj in cartItems)
            {
                SqlParameter prodID = new SqlParameter("@prodNum", obj.ProdNum);
                prodID.Direction = ParameterDirection.Input;
                prodID.SqlDbType = SqlDbType.Int;
                prodID.Size = 4;
                addPurchase.Parameters.Add(prodID);

                SqlParameter quantity = new SqlParameter("@quantity", obj.ProdQuantity);
                quantity.Direction = ParameterDirection.Input;
                prodID.SqlDbType = SqlDbType.Int;
                prodID.Size = 4;
                addPurchase.Parameters.Add(quantity);

                SqlParameter loginiD = new SqlParameter("@loginID", Convert.ToInt32(Session["loginId"]));
                loginiD.Direction = ParameterDirection.Input;
                loginiD.SqlDbType = SqlDbType.Int;
                loginiD.Size = 4;
                addPurchase.Parameters.Add(loginiD);

                SqlParameter quan = new SqlParameter("@prodNum", obj.ProdNum);
                quan.Direction = ParameterDirection.Input;
                quan.SqlDbType = SqlDbType.Int;
                quan.Size = 4;
                updateProdQuan.Parameters.Add(quan);
                objDB.DoUpdateUsingCmdObj(updateProdQuan);

            }
            //SqlCommand removeCart = new SqlCommand();

            //updateProdQuan.CommandType = CommandType.StoredProcedure;
            //updateProdQuan.CommandText = "TP_removeCart";

            //SqlParameter id = new SqlParameter("@custID", Convert.ToInt32(Session["loginId"]));
            //id.Direction = ParameterDirection.Input;
            //id.SqlDbType = SqlDbType.Int;
            //id.Size = 4;
            //objDB.DoUpdateUsingCmdObj(removeCart);

            //List<cartItem> emptyCart = new List<cartItem>();
            //Session["cart"] = emptyCart;
        }
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtCurrentEmail.Text) || String.IsNullOrEmpty(txtPassword.Text) || String.IsNullOrEmpty(txtNewEmail2.Text))
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('All fields are required.Thank you!'); </script>");

            {
                string currentEmail = txtCurrentEmail.Text;
                string passord = txtPassword.Text;
                string newEmail2 = txtNewEmail2.Text;

                SqlCommand emailCmd = new SqlCommand();
                DBConnect objDB = new DBConnect();

                emailCmd.CommandType = CommandType.StoredProcedure;
                emailCmd.CommandText = "dbo.TP_ResetEmail";

                SqlParameter inputEmail = new SqlParameter("@currentEmail", currentEmail);

                inputEmail.Direction = ParameterDirection.Input;
                inputEmail.SqlDbType = SqlDbType.NVarChar;
                inputEmail.Size = 50;
                emailCmd.Parameters.Add(inputEmail);

                SqlParameter inputPassword = new SqlParameter("@password", passord);

                inputPassword.Direction = ParameterDirection.Input;
                inputPassword.SqlDbType = SqlDbType.NVarChar;
                inputPassword.Size = 50;
                emailCmd.Parameters.Add(inputPassword);

                SqlParameter inputEmail2 = new SqlParameter("@newEmail", newEmail2);

                inputEmail2.Direction = ParameterDirection.Input;
                inputEmail2.SqlDbType = SqlDbType.NVarChar;
                inputEmail2.Size = 50;
                emailCmd.Parameters.Add(inputEmail2);

                emailCmd.Parameters.Add("@result", SqlDbType.Int).Direction = ParameterDirection.Output;

                objDB.DoUpdateUsingCmdObj(emailCmd);
                int result = Convert.ToInt32(emailCmd.Parameters["@result"].Value);

                if (result == -1)
                    lblMsg.Text = "The password you entered is incorrect!";

                else if (result == 0)
                {
                    lblMsg.Text = "The new email you entered already exists.";
                }
                else
                {
                    lblMsg.Text = "The email was changed succesfully.";
                }
            }
        }
Exemplo n.º 17
0
 public void saveStudent()
 {
     SqlCommand command = new SqlCommand();
     command.CommandType = CommandType.StoredProcedure;
     command.CommandText = "NewStudent";
     command.Parameters.AddWithValue("@ID", id);
     command.Parameters.AddWithValue("@Name", name);
     command.Parameters.AddWithValue("@Tuition", tuition);
     DBConnect DB = new DBConnect();
     DB.DoUpdateUsingCmdObj(command);
 }
Exemplo n.º 18
0
        public void CreateFiscalYear(String fiscalYear)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;
            objcomm.CommandText = "sp_CreateFiscalYear";
            objcomm.Parameters.Add("@fiscalYear", fiscalYear);

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 19
0
        public static void ExecuteUpdate(SqlCommand command)
        {
            //Open Connection
            DBConnect newConnection = new DBConnect();

            //Execute Command
            newConnection.DoUpdateUsingCmdObj(command);

            //Close DB Connection
            newConnection.CloseConnection();
        }
        public string doSerialize(Liked liked, string userEmail)
        {
            string          rVal;
            BinaryFormatter serializer = new BinaryFormatter();

            MemoryStream memStream = new MemoryStream();

            Byte[] byteArray;

            serializer.Serialize(memStream, liked);

            byteArray = memStream.ToArray();
            objCommand.CommandType = CommandType.StoredProcedure;

            objCommand.CommandText = "addLiked";



            objCommand.Parameters.AddWithValue("@userEmail", userEmail);

            objCommand.Parameters.AddWithValue("@userLiked", byteArray);



            int retVal = objDB.DoUpdateUsingCmdObj(objCommand);



            //// Check to see whether the update was successful

            if (retVal > 0)
            {
                rVal = " added to liked collection";
            }
            else
            {
                rVal = "A problem occured in storing the liked profile";
            }
            return(rVal);
        }
Exemplo n.º 21
0
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            {
                string currentEmail = txtCurrentEmail.Text;
                string passord = txtPassword.Text;
                string newEmail2 = txtNewEmail2.Text;

                SqlCommand emailCmd = new SqlCommand();
                DBConnect objDB = new DBConnect();

                emailCmd.CommandType = CommandType.StoredProcedure;
                emailCmd.CommandText = "dbo.TP_ResetEmail";

                SqlParameter inputEmail = new SqlParameter("@currentEmail", currentEmail);

                inputEmail.Direction = ParameterDirection.Input;
                inputEmail.SqlDbType = SqlDbType.NVarChar;
                inputEmail.Size = 50;
                emailCmd.Parameters.Add(inputEmail);

                SqlParameter inputPassword = new SqlParameter("@password", passord);

                inputPassword.Direction = ParameterDirection.Input;
                inputPassword.SqlDbType = SqlDbType.NVarChar;
                inputPassword.Size = 50;
                emailCmd.Parameters.Add(inputPassword);

                SqlParameter inputEmail2 = new SqlParameter("@newEmail", newEmail2);

                inputEmail2.Direction = ParameterDirection.Input;
                inputEmail2.SqlDbType = SqlDbType.NVarChar;
                inputEmail2.Size = 50;
                emailCmd.Parameters.Add(inputEmail2);

                emailCmd.Parameters.Add("@result", SqlDbType.Int).Direction = ParameterDirection.Output;

                objDB.DoUpdateUsingCmdObj(emailCmd);
                int result = Convert.ToInt32(emailCmd.Parameters["@result"].Value);

                if (result == -1)
                    lblMsg.Text = "The password you entered is incorrect!";

                else if (result == 0)
                {
                    lblMsg.Text = "The new email you entered already exists.";
                }
                else
                {
                    lblMsg.Text = "The email was changed succesfully.";
                }
            }
        }
Exemplo n.º 22
0
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            SqlCommand pass = new SqlCommand();
                DBConnect objDB = new DBConnect();

                pass.CommandType = CommandType.StoredProcedure;
                pass.CommandText = "dbo.TP_ResetPassword";

            //string currentPassword = (string)pass.ExecuteScalar();
            //if (currentPassword == txtCurrentPassword.Text)
            //     { }

            //else
            //    lblMsg.Text = "Please enter your current password again!";

                string currentEmail = txtCurrentEmail.Text;
                string currentPassword = txtCurrentPassword.Text;
                string newPassword1 = txtNewPassword.Text;

              SqlParameter inputEmail = new SqlParameter("@email", currentEmail);

                inputEmail.Direction = ParameterDirection.Input;
                inputEmail.SqlDbType = SqlDbType.NVarChar;
                inputEmail.Size = 50;
                pass.Parameters.Add(inputEmail);

                SqlParameter inputPassword = new SqlParameter("@currentPass", currentPassword);

                inputPassword.Direction = ParameterDirection.Input;
                inputPassword.SqlDbType = SqlDbType.NVarChar;
                inputPassword.Size = 50;
                pass.Parameters.Add(inputPassword);

                SqlParameter inputPassword1 = new SqlParameter("@newPass", newPassword1);

                inputPassword1.Direction = ParameterDirection.Input;
                inputPassword1.SqlDbType = SqlDbType.NVarChar;
                inputPassword1.Size = 50;
                pass.Parameters.Add(inputPassword1);

                pass.Parameters.Add("@returnId", SqlDbType.Int).Direction = ParameterDirection.Output;

                objDB.DoUpdateUsingCmdObj(pass);
                int result = Convert.ToInt32(pass.Parameters["@returnId"].Value);

                if (result == 1)
                    lblMsg.Text = "The password you entered is incorrect!";

                else if (result == 0)
                    lblMsg.Text = "The password was not changed.";
                //  Response.Redirect("LoginPage.aspx");
        }
Exemplo n.º 23
0
 protected static bool addCustomer(Customer customer, String card_num, String card_cvv, String exp_month, String exp_year, String card_zip)
 {
     if (apiService.new_customer_wallet(customer.username, card_num, card_cvv, exp_month, exp_year, card_zip) == "true")
     {
         if (checkUser(customer.username) == false)
         {
             try {
                 DBConnect  dbConnect = new DBConnect();
                 SqlCommand cmd       = new SqlCommand {
                     CommandType = CommandType.StoredProcedure,
                     CommandText = "TP_createNewCustomer"
                 };
                 cmd.Parameters.AddWithValue("@accountID", customer.username);
                 cmd.Parameters.AddWithValue("@password", customer.password);
                 cmd.Parameters.AddWithValue("@customer_flag", 1);
                 cmd.Parameters.AddWithValue("@first_name", customer.first_name);
                 cmd.Parameters.AddWithValue("@last_name", customer.last_name);
                 cmd.Parameters.AddWithValue("@phone_number", customer.phone_number);
                 cmd.Parameters.AddWithValue("@delivery_street", customer.delivery_street_address);
                 cmd.Parameters.AddWithValue("@delivery_city", customer.delivery_city);
                 cmd.Parameters.AddWithValue("@delivery_state", customer.delivery_state);
                 cmd.Parameters.AddWithValue("@delivery_zip", customer.delivery_zip);
                 SqlParameter rowsAffected = new SqlParameter("@return", DbType.Int32);
                 rowsAffected.Direction = ParameterDirection.ReturnValue;
                 cmd.Parameters.Add(rowsAffected);
                 int rowCount = dbConnect.DoUpdateUsingCmdObj(cmd);
                 if (rowCount != -1)
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             } catch (SqlException ex) {
                 Debug.WriteLine("SQL Exception in creating an email.");
                 Debug.WriteLine(ex.StackTrace);
                 Debug.WriteLine(ex.Message);
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 24
0
 protected static bool updateCustomer(Customer customer)
 {
     try {
         if (customer.delivery_city == null)
         {
             DBConnect  dbConnect = new DBConnect();
             SqlCommand cmd       = new SqlCommand {
                 CommandType = CommandType.StoredProcedure,
                 CommandText = "TP_updateCustomerUser"
             };
             cmd.Parameters.AddWithValue("@accountID", customer.username);
             cmd.Parameters.AddWithValue("@first_name", customer.first_name);
             cmd.Parameters.AddWithValue("@last_name", customer.last_name);
             cmd.Parameters.AddWithValue("@phone_number", customer.phone_number);
             int rowCount = dbConnect.DoUpdateUsingCmdObj(cmd);
             if (rowCount == 1)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             DBConnect  dbConnect = new DBConnect();
             SqlCommand cmd       = new SqlCommand {
                 CommandType = CommandType.StoredProcedure,
                 CommandText = "TP_updateCustomerUserDeliveryInfo"
             };
             cmd.Parameters.AddWithValue("@accountID", customer.username);
             cmd.Parameters.AddWithValue("@delivery_street_address", customer.delivery_street_address);
             cmd.Parameters.AddWithValue("@delivery_city", customer.delivery_city);
             cmd.Parameters.AddWithValue("@delivery_state", customer.delivery_state);
             cmd.Parameters.AddWithValue("@delivery_zip", customer.delivery_zip);
             int rowCount = dbConnect.DoUpdateUsingCmdObj(cmd);
             if (rowCount == 1)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     } catch (SqlException ex) {
         Debug.WriteLine(ex.Message + ex.StackTrace);
         return(false);
     }
 }
Exemplo n.º 25
0
        public void insertIntoPurchase(string email, string CardNum, string ProductID)
        {
            //Email, CardNum, SaleTotal, Products
            DBConnect objdb = new DBConnect();
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "TP_InsertIntoPurchase";
            sqlCommand.Parameters.AddWithValue("@email", email);
            sqlCommand.Parameters.AddWithValue("@CardNum", CardNum);
            //sqlCommand.Parameters.AddWithValue("@SaleTotal", SaleTotal);
            sqlCommand.Parameters.AddWithValue("@products", ProductID);
            objdb.DoUpdateUsingCmdObj(sqlCommand);

            //
        }
Exemplo n.º 26
0
        //Register Merchant Button
        protected void btnContinue_Click(object sender, EventArgs e)
        {
            DBConnect DB = new DBConnect();
            Register register = new Register();
            Merchant newMerchant = new Merchant();

            newMerchant.groupName = txtName.Text;
            newMerchant.email = txtEmail.Text;
            newMerchant.address = txtAddress.Text;
            newMerchant.url = txtURL.Text;

            SqlCommand command = new SqlCommand();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "RegisterMerchant";
            command.Parameters.AddWithValue("@GroupName", newMerchant.groupName);
            command.Parameters.AddWithValue("@Email", newMerchant.email);
            command.Parameters.AddWithValue("@Address", newMerchant.address);
            command.Parameters.AddWithValue("@URL", newMerchant.url);
            DB.DoUpdateUsingCmdObj(command);

            DB = new DBConnect();
            SqlCommand key = new SqlCommand();
            key.CommandType = CommandType.StoredProcedure;
            key.CommandText = "InsertKey";
            key.Parameters.AddWithValue("@GroupName", newMerchant.groupName);
            DataSet ds = DB.GetDataSetUsingCmdObj(key);
            string apikey = ds.Tables[0].Rows[0]["APIKey"].ToString();
            lblGeneralError.Text = "Your APIKey is " + apikey;

            //Stored procedure to insert new merchant into a merchant table

            //if "Remember Me" is checked, store userName in cookie
            //if (chkbxRemeberMe.Checked)
            //{
            //    HttpCookie emailCookie = new HttpCookie("Login_Cookie");//cookie's name
            //    emailCookie.Values["email"] = txtEmail.Text;           //set cookies value

            //    emailCookie.Values["LastVisited"] = DateTime.Now.ToString();
            //    emailCookie.Expires = DateTime.Now.AddYears(1);
            //    Response.Cookies.Add(emailCookie);
            //}
            //else
            //{
            //    //remove user's email from username textbox
            //    Response.Cookies.Remove("mycookie");
            //}
            //Response.Redirect("Login.aspx");
        }
Exemplo n.º 27
0
        public void AddAdmin(AdminObject admin)
        {
            DBConnect objDB = new DBConnect();
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;
            objcomm.CommandText = "sp_addadmin";

            objcomm.Parameters.Add("@tuid", admin.tuid);
            objcomm.Parameters.Add("@firstName", admin.firstName);
            objcomm.Parameters.Add("@lastName", admin.lastName);
            objcomm.Parameters.Add("@department", admin.department);
            objcomm.Parameters.Add("@accessLevel", admin.accessLevel);

            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 28
0
        public bool HelloWorld(CreditCardClass cc, CustomerClass arthur)
        {
            DBConnect DB = new DBConnect();
            SqlCommand command = new SqlCommand();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "AddCard";
            command.Parameters.AddWithValue("@CreditCardNumber", cc.CardNumber);
            command.Parameters.AddWithValue("@CVV", cc.CVV);
            command.Parameters.AddWithValue("@AccountNumber", cc.AccountNumber);
            command.Parameters.AddWithValue("@CreditLimit", cc.CreditLimit);
            command.Parameters.AddWithValue("@AccountBalance", cc.AccountBalance);
            command.Parameters.AddWithValue("@FirstName", arthur.Firstname);
            command.Parameters.AddWithValue("@LastName", arthur.LastName);

            return (DB.DoUpdateUsingCmdObj(command) > 0) ? true : false;
        }
Exemplo n.º 29
0
        public int CreateWallet()
        {
            SqlCommand objCommand = new SqlCommand();
            int        walletID   = 0;



            //store procedure
            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "";

            //objCommand.Parameters.AddWithValue("");

            int retVal = dbConnect.DoUpdateUsingCmdObj(objCommand);

            return(retVal);
        }
Exemplo n.º 30
0
 protected static bool addRestaurantUser(Restaurant restaurant, String checking_account_num, String checking_account_routing)
 {
     if (apiService.new_restaurant_wallet(restaurant.username, checking_account_num, checking_account_routing) == "true")
     {
         if (checkUser(restaurant.username) == false)
         {
             try {
                 DBConnect  dBConnect = new DBConnect();
                 SqlCommand cmd       = new SqlCommand {
                     CommandType = CommandType.StoredProcedure,
                     CommandText = "TP_createNewRestaurantUser"
                 };
                 cmd.Parameters.AddWithValue("@accountID", restaurant.username);
                 cmd.Parameters.AddWithValue("@password", restaurant.password);
                 cmd.Parameters.AddWithValue("@customer_flag", restaurant.customer_flag);
                 cmd.Parameters.AddWithValue("@restaurant_name", restaurant.restaurant_name);
                 cmd.Parameters.AddWithValue("@restaurant_phone_number", restaurant.restaurant_phone_number);
                 cmd.Parameters.AddWithValue("@restaurant_logo", restaurant.restaurant_logo);
                 cmd.Parameters.AddWithValue("@restaurant_cuisine", restaurant.restaurant_cuisine);
                 int rowCount = dBConnect.DoUpdateUsingCmdObj(cmd);
                 if (rowCount != -1)
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             } catch (SqlException ex) {
                 Debug.WriteLine("Sql exception in creating a user.");
                 Debug.WriteLine(ex.Message + ex.StackTrace);
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 31
0
        public bool EmptyCart(int id)
        {
            DBConnect  objDB      = new DBConnect();
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;

            objCommand.CommandText = "TP_EmptyCart";

            objCommand.Parameters.AddWithValue("@CustomerID", id);

            int result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result != -1)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 32
0
        public bool UpdateCC(int cardID, string cardNumber, string expiration)
        {
            DBConnect  objDB      = new DBConnect();
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "TP_UpdateCC";

            objCommand.Parameters.AddWithValue("@CardID", cardID);
            objCommand.Parameters.AddWithValue("@CardNumber", cardNumber);
            objCommand.Parameters.AddWithValue("@Expiration", expiration);

            int result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result != -1)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 33
0
        public bool NewPasswordFromForgot(string username, string userType, string password, string password2)
        {
            DBConnect  objDB      = new DBConnect();
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "TP_NewPWFromForgot";

            objCommand.Parameters.AddWithValue("@LoginID", username);
            objCommand.Parameters.AddWithValue("@AccountType", userType);
            objCommand.Parameters.AddWithValue("@OldPassword", password);
            objCommand.Parameters.AddWithValue("@NewPassword", password2);

            int result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result != -1)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 34
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            string title = "";
            string name = ddStudentSelect.SelectedItem.Text;
            int studentID = int.Parse(ddStudentSelect.SelectedValue);
            int checkedBoxCount = 0;
            for (int row = 0; row < gvCourses.Rows.Count; row++)
            {
                CheckBox CBox;
                CBox = (CheckBox)gvCourses.Rows[row].FindControl("cbSelectCourse");

                if (CBox.Checked)
                {

                  //  string courseCRN = gvCourses.Rows[row].Cells[1].Text;
                    int crn = int.Parse(gvCourses.Rows[row].Cells[1].Text);
                    float price = 1000 * int.Parse(gvCourses.Rows[row].Cells[9].Text);
                    title = gvCourses.Rows[row].Cells[2].Text;
                    Course c = new Course(crn, title, int.Parse(gvCourses.Rows[row].Cells[3].Text), gvCourses.Rows[row].Cells[4].Text, gvCourses.Rows[row].Cells[5].Text, gvCourses.Rows[row].Cells[6].Text, gvCourses.Rows[row].Cells[7].Text, gvCourses.Rows[row].Cells[8].Text, int.Parse(gvCourses.Rows[row].Cells[9].Text), int.Parse(gvCourses.Rows[row].Cells[11].Text));
                    SqlCommand command = new SqlCommand();
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "CourseRegistration";
                    command.Parameters.AddWithValue("@CRN", crn);
                    command.Parameters.AddWithValue("@StudentID", studentID);
                    command.Parameters.AddWithValue("@Name", name);
                    command.Parameters.AddWithValue("@Title", title);
                    command.Parameters.AddWithValue("@Price", price);
                    DBConnect DB = new DBConnect();
                    DB.DoUpdateUsingCmdObj(command);
                    if (c.DecrementSeats() == -1)
                    {
                        gvCourses.Rows[row].Cells[0].Enabled = false;
                    }
                    c.DecrementSeats();
                    rebind();

                    checkedBoxCount++;
                }
            }
        }
Exemplo n.º 35
0
 protected static String[] generateTokens(String username)
 {
     try {
         String[] cookie = new string[3];
         RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
         Byte[]   ident           = new Byte[16];
         Byte[]   validator       = new Byte[64];
         DateTime currentDTplus30 = DateTime.Now.AddDays(30);
         provider.GetNonZeroBytes(ident);
         provider.GetNonZeroBytes(validator);
         cookie[0] = Convert.ToBase64String(ident);
         cookie[1] = Convert.ToBase64String(validator);
         cookie[2] = Convert.ToString(currentDTplus30);
         DBConnect  dBConnect     = new DBConnect();
         SqlCommand token_gen_cmd = new SqlCommand {
             CommandType = CommandType.StoredProcedure,
             CommandText = "TP_createNewAccountRemToken"
         };
         token_gen_cmd.Parameters.AddWithValue("@accountID", username);
         token_gen_cmd.Parameters.AddWithValue("@tokenIdent", Convert.ToBase64String(ident));
         token_gen_cmd.Parameters.AddWithValue("@tokenValidator", Convert.ToBase64String(SHA512.Create().ComputeHash((validator))));
         token_gen_cmd.Parameters.AddWithValue("@tokenExpiration", currentDTplus30);
         int rowCount = dBConnect.DoUpdateUsingCmdObj(token_gen_cmd);
         if (rowCount != -1 && rowCount == 1)
         {
             return(cookie);
         }
         else
         {
             return(null);
         }
     } catch (Exception ex) {
         Debug.WriteLine("Error in token generation");
         Debug.WriteLine(ex.StackTrace);
         Debug.WriteLine(ex.Message);
         return(null);
     }
 }
Exemplo n.º 36
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DBConnect db = new DBConnect();
            string name = txtMerchName.Text;
            string addres = txtAddress.Text;
            string url = txtUrl.Text;
            string email = Session["emailSession"].ToString();
            SqlCommand command = new SqlCommand();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "UpdateMerch";
            command.Parameters.AddWithValue("@email", email);
            command.Parameters.AddWithValue("@address", addres);
            command.Parameters.AddWithValue("@name", name);
            command.Parameters.AddWithValue("@url", url);
            db.DoUpdateUsingCmdObj(command);

            txtAddress.Text = "";
            txtEmail.Text = "";
            txtMerchName.Text = "";
            txtUrl.Text = "";

            this.Visible = false;
        }
Exemplo n.º 37
0
        public bool ChangePassword(int accountType, string loginID, string oldPassword,
                                   string newPassword)
        {
            DBConnect objDB = new DBConnect();

            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "TP_ChangePassword";

            objCommand.Parameters.AddWithValue("@AccountType", accountType);
            objCommand.Parameters.AddWithValue("@LoginID", loginID);
            objCommand.Parameters.AddWithValue("@OldPassword", oldPassword);
            objCommand.Parameters.AddWithValue("@NewPassword", newPassword);

            int result = objDB.DoUpdateUsingCmdObj(objCommand);

            if (result != -1)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 38
0
 protected static bool updateUser(User user)
 {
     try {
         DBConnect  dbConnect = new DBConnect();
         SqlCommand cmd       = new SqlCommand {
             CommandType = CommandType.StoredProcedure,
             CommandText = "TP_updateUser"
         };
         cmd.Parameters.AddWithValue("@accountID", user.username);
         cmd.Parameters.AddWithValue("@password", user.password);
         int rowCount = dbConnect.DoUpdateUsingCmdObj(cmd);
         if (rowCount == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     } catch (SqlException ex) {
         Debug.WriteLine(ex.Message + ex.StackTrace);
         return(false);
     }
 }
Exemplo n.º 39
0
        public void UpdateRevenue(String fiscalYear, String term, String gradUndergrad, String grossExported, String rate, String CHG)
        {
            DataSet ds = new DataSet();

            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "UpdateRevenue";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@term", term);
            objcomm.Parameters.Add("@gradUndergrad", gradUndergrad);
            objcomm.Parameters.Add("@grossExported", grossExported);
            objcomm.Parameters.Add("@CHG", CHG);
            objcomm.Parameters.Add("@rate", rate);

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 40
0
        public void UpdateNonCompensationExpenduters(String fiscalYear, String expenseType, String accountNumber, String budget)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "UpdateNonCompensationExpend";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@expenseType", expenseType);
            objcomm.Parameters.Add("@accountNumber", accountNumber);

            if (budget != "")
            {
                objcomm.Parameters.Add("@budget", budget);
            }

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 41
0
        public void UpdateIntoTuitionRevenue(String fiscalYear, String term, String grossExported, String graduateUndergraduate, String chg, String rate)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "UpdateCHG";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@term", term);
            objcomm.Parameters.Add("@grossExported", grossExported);
            objcomm.Parameters.Add("@graduateUndergraduate", graduateUndergraduate);

            if (chg != "")
            {
                objcomm.Parameters.Add("@chg", chg);
            }
            if (rate != "")
            {
                objcomm.Parameters.Add("@rate", rate);
            }

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 42
0
 public void doUpdate()
 {
     objDB.DoUpdateUsingCmdObj(objCmd);
 }
Exemplo n.º 43
0
        public void DeleteExpendetures()
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;
            objcomm.CommandText = "sp_deleteexpendetures";

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 44
0
        public void UpdateAssessment(String fiscalYear, String graduateUndergraduate, String assessment, String rate)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "UpdateAssessment";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@graduateUndergraduate", graduateUndergraduate);
            objcomm.Parameters.Add("@assessment", assessment);
            objcomm.Parameters.Add("@rate", rate);

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 45
0
        public void InsertCompensationExpenduters(String category, String fiscalYear, String expenseType, String accountNumber, String budget, String fringeBenefitRate)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "InsertCompensationExpenduters";

            objcomm.Parameters.Add("@category", category);
            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@expenseType", expenseType);
            objcomm.Parameters.Add("@accountNumber", accountNumber);

            if (budget != "")
            {
                objcomm.Parameters.Add("@budget", budget);
            }
            if (fringeBenefitRate != "")
            {
                objcomm.Parameters.Add("@fringeBenefitRate", fringeBenefitRate);
            }

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 46
0
        public void UpdateAllocatedCosts(String fiscalYear, String costDriver, String metricType, String rate, String totalMetric, String metrics, String costToAllocate)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "UpdateAllocatedCosts";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@costDriver", costDriver);
            objcomm.Parameters.Add("@metricType", metricType);

            if (rate != "")
            {
                objcomm.Parameters.Add("@rate", rate);
            }
            if (totalMetric != "")
            {
                objcomm.Parameters.Add("@totalMetric", totalMetric);
            }
            if (metrics != "")
            {
                objcomm.Parameters.Add("@metrics", metrics);
            }
            if (costToAllocate != "")
            {
                objcomm.Parameters.Add("@costToAllocate", costToAllocate);
            }

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 47
0
        public void InsertDifferentialRevenue(String fiscalYear, String graduateUndergraduate, String chg, String rate)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "InsertDifferentialRevenue";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@graduateUndergraduate", graduateUndergraduate);

            if (chg != "")
            {
                objcomm.Parameters.Add("@numberStudentsChg", chg);
            }
            if (rate != "")
            {
                objcomm.Parameters.Add("@rate", rate);
            }

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);
        }
Exemplo n.º 48
0
        public Boolean NonCompensationExpensesUpdate(String fiscalYear, String expenseType, double budget)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "NonCompensationExpensesUpdate";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@expenseType", expenseType);
            objcomm.Parameters.Add("@budget", budget);

            SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32);
            outputParameter.Direction = ParameterDirection.ReturnValue;

            objcomm.Parameters.Add(outputParameter);

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);

            int result = int.Parse(objcomm.Parameters["@result"].Value.ToString());

            if (result == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 49
0
        public Boolean DifferentialRevenueUpdate(String fiscalYear, String undergradGrad, double rate, double numberStudentsCHG)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;

            objcomm.CommandText = "UpdateDifferentialRevenue";

            objcomm.Parameters.Add("@fiscalYear", fiscalYear);
            objcomm.Parameters.Add("@graduateUndergraduate", undergradGrad);
            objcomm.Parameters.Add("@rate", rate);
            objcomm.Parameters.Add("@numberStudentsCHG", numberStudentsCHG);

            SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32);
            outputParameter.Direction = ParameterDirection.ReturnValue;

            objcomm.Parameters.Add(outputParameter);

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);

            int result = int.Parse(objcomm.Parameters["@result"].Value.ToString());

            if (result == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 50
0
        public void RevenueSummaryInsert(String fiscalYear)
        {
            SqlCommand objcomm = new SqlCommand();

            objcomm.CommandType = CommandType.StoredProcedure;
            objcomm.CommandText = "InsertRevenueExpenseSummary";
            objcomm.Parameters.Add("@fiscalYear", fiscalYear);

            //SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32);
            //outputParameter.Direction = ParameterDirection.ReturnValue;

            //objcomm.Parameters.Add(outputParameter);

            DBConnect objDB = new DBConnect();
            objDB.DoUpdateUsingCmdObj(objcomm);

            //int result = int.Parse(objcomm.Parameters["@result"].Value.ToString());

            //if (result == 1)
            //{
            //    return true;
            //}
            //else
            //{
            //    return false;
            //}
        }