public Boolean cartExists(int loginID) { Boolean cartExists = false; DataSet cart = new DataSet(); DBConnect objDB = new DBConnect(); SqlCommand logID = new SqlCommand(); logID.CommandType = CommandType.StoredProcedure; logID.CommandText = ("TP_findCartByLogin"); SqlParameter theID = new SqlParameter("@loginID", loginID); theID.Direction = ParameterDirection.Input; theID.SqlDbType = SqlDbType.Int; theID.Size = 4; logID.Parameters.Add(theID); cart = objDB.GetDataSetUsingCmdObj(logID); int size = Convert.ToInt32(cart.Tables[0].Rows[0][0].ToString()); if (size > 0) { cartExists = true; return cartExists; } else { return cartExists; } }
public Boolean AssestmentsUpdate(String fiscalYear,double financialAidRateGrad,double plandFundFeeGradRate,double financialAidRateUndergrad,double plandFundFeeRateUndergrad ) { SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "AssesmentsUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYear); objcomm.Parameters.Add("@financialAidRateGrad", financialAidRateGrad); objcomm.Parameters.Add("@plandFundFeeGradRate", plandFundFeeGradRate); objcomm.Parameters.Add("@financialAidRateUndergrad", financialAidRateUndergrad); objcomm.Parameters.Add("@plandFundFeeRateUndergrad", plandFundFeeRateUndergrad); SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32); outputParameter.Direction = ParameterDirection.ReturnValue; objcomm.Parameters.Add(outputParameter); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); int result = int.Parse(objcomm.Parameters["@result"].Value.ToString()); if (result == 1) { return true; } else { return false; } }
public bool ValidMerchantLogin(string email, string password) { DataSet myDS = new DataSet(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TP_ValidMerchantLogin"; objCommand.Parameters.AddWithValue("@email", email); objCommand.Parameters.AddWithValue("@password", password); DBConnect objDB = new DBConnect(); myDS = objDB.GetDataSetUsingCmdObj(objCommand); bool returnvalue = true; //if the values are found in the DB return true if ((myDS.Tables[0].Rows.Count <= 1) && (myDS.Tables[0].Rows[0]["password"].ToString() == password)) { returnvalue = true; } //the user does not exist in the DB else { returnvalue = false; } return returnvalue; }
public void rebind() { DBConnect db = new DBConnect(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetAllCourses"; gvCourses.DataSource = db.GetDataSetUsingCmdObj(command); gvCourses.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { DBConnect db = new DBConnect(); string merchEmail = Session["emailSession"].ToString(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetMerchAccount"; command.Parameters.AddWithValue("@email", merchEmail); DataSet ds = db.GetDataSetUsingCmdObj(command); gvMerchAccount.DataSource = ds; gvMerchAccount.DataBind(); }
public DataSet GetDepartments() { SqlCommand dep = new SqlCommand(); DBConnect objDB = new DBConnect(); DataSet department = new DataSet(); dep.CommandType = CommandType.StoredProcedure; dep.CommandText = "dbo.TP_getDepartments"; department = objDB.GetDataSetUsingCmdObj(dep); return department; }
protected void btnAPI_Click(object sender, EventArgs e) { Label lblAPI = new Label(); DBConnect db = new DBConnect(); string merchEmail = Session["emailSession"].ToString(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetAPI"; command.Parameters.AddWithValue("@email", merchEmail); DataSet ds = db.GetDataSetUsingCmdObj(command); string api = ds.Tables[0].Rows[0]["APIKey"].ToString(); lblAPI.Text = api; }
public void loadProducts() { //display data from each item in Product DB into correct template feilds //display product name into label //display product url image into image DBConnect dbobj = new DBConnect(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "GetAllProducts"; DataSet ds = dbobj.GetDataSetUsingCmdObj(objCommand); rptProducts.DataSource = ds; rptProducts.DataBind(); }
//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"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DBConnect DB = new DBConnect(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetDep"; DataSet ds = DB.GetDataSetUsingCmdObj(command); ddDepartment.DataSource = ds; ddDepartment.DataTextField = "DepartmentName"; ddDepartment.DataValueField = "DepartmentID"; ddDepartment.DataBind(); } }
public void loadCreditCards(string email) { DBConnect objdb = new DBConnect(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "TPgetCustomerCard"; sqlCommand.Parameters.AddWithValue("@email", email); DataSet dataset = objdb.GetDataSetUsingCmdObj(sqlCommand); if (dataset.Tables[0].Rows.Count > 0) { ddlCreditCardList.DataSource = dataset; ddlCreditCardList.DataTextField = "CardNumber"; ddlCreditCardList.DataValueField = "CVV"; ddlCreditCardList.DataBind(); } }
protected void btnViewBill_Click(object sender, EventArgs e) { int studID = int.Parse(ddStudentSelect.SelectedValue.ToString()); DBConnect db = new DBConnect(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetBill"; command.Parameters.AddWithValue("@StudentID", studID); gvBill.DataSource = db.GetDataSetUsingCmdObj(command); gvBill.DataBind(); int total = 0; for (int row = 0; row < gvBill.Rows.Count; row++) { total += int.Parse(gvBill.Rows[row].Cells[5].Text); } gvBill.FooterRow.Cells[1].Text = "Total Due: "; gvBill.FooterRow.Cells[5].Text = "$" + total; }
protected void Page_Load(object sender, EventArgs e) { if (Request["email"] != null) { // check email validity string email = Request["email"].ToString(); //check if email is unique w stored procedure DataSet myDS = new DataSet(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TP_ValidLogin"; objCommand.Parameters.AddWithValue("@Email", email); objCommand.Parameters.AddWithValue("@password", ""); DBConnect objDB = new DBConnect(); myDS = objDB.GetDataSetUsingCmdObj(objCommand); if (myDS.Tables[0].Rows.Count > 0) { Response.Write("Email already exists!"); } else { Response.Write("Ok"); } } else if (Request["name"] != null) { // check everything else string name = Request["name"].ToString(); if (name.Length > 0) { Response.Write("Ok"); } else { Response.Write("Nope"); } } else { Response.Redirect("Login.aspx"); } }
public float GetCreditLimit(string fName) { try { DBConnect DB = new DBConnect(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetCreditLimit"; command.Parameters.AddWithValue("@FirstName", fName); DataSet ds = DB.GetDataSetUsingCmdObj(command); return float.Parse(ds.Tables[0].Rows[0]["CreditLimit"].ToString()); } catch { return 0; } }
public DataSet GetProductCatalog(string DepartmentNumber) { SqlCommand prod = new SqlCommand(); DBConnect objDB = new DBConnect(); DataSet product = new DataSet(); prod.CommandType = CommandType.StoredProcedure; prod.CommandText = "dbo.TP_getProductCatalog"; SqlParameter findProducts = new SqlParameter("@depNum", DepartmentNumber); findProducts.Direction = ParameterDirection.Input; findProducts.SqlDbType = SqlDbType.Int; findProducts.Size = 4; prod.Parameters.Add(findProducts); product = objDB.GetDataSetUsingCmdObj(prod); return product; }
public void NonInstractionalCompensationUpdate(String fiscalYear, int accountNumber, double budget, double fringeBenefitRate) { SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "NonInstractionalCompensationUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYear); objcomm.Parameters.Add("@accountNumber", accountNumber); objcomm.Parameters.Add("@budget", budget); objcomm.Parameters.Add("@fringeBenefitRate", fringeBenefitRate); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); //int result = int.Parse(objcomm.Parameters["@result"].Value.ToString()); //if (result == 1) //{ // return true; //} //else //{ // return false; //} }
public void NonInstractionalCompensation(String fiscalYearId, DataTable dt) { foreach (DataRow row in dt.Rows) { int accountNumber = int.Parse(row[0].ToString()); Double fringeBenefitRate = Double.Parse(row[1].ToString()); Double budget = Double.Parse(row[2].ToString()); SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "NonInstractionalCompensationUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYearId); objcomm.Parameters.Add("@accountNumber", accountNumber); objcomm.Parameters.Add("@fringeBenefitRate", fringeBenefitRate); objcomm.Parameters.Add("@budget", budget); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); } }
public void NonCompensationExpensesUpdate(String fiscalYear, String expenseType, String accountNum, double budget) { SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "NonCompensationExpensesUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYear); objcomm.Parameters.Add("@expenseType", expenseType); objcomm.Parameters.Add("@budget", budget); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); }
public void NonCompensationExpenses(String fiscalYearId, DataTable dt) { foreach (DataRow row in dt.Rows) { String expenseType = row[0].ToString(); String accountNum = row[1].ToString(); Double budget = Double.Parse(row[2].ToString()); SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "NonCompensationExpensesUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYearId); objcomm.Parameters.Add("@expenseType", expenseType); objcomm.Parameters.Add("@accountNum", accountNum); 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.GetDataSetUsingCmdObj(objcomm); } }
public void FringeBenefits(DataTable dt) { foreach (DataRow row in dt.Rows) { String accountCode = row[0].ToString(); Double gvrnSponsoredPrjRates = Double.Parse(row[1].ToString()); Double clinicalFacultyRates = Double.Parse(row[2].ToString()); Double otherRates = Double.Parse(row[3].ToString()); SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "FringeBenefitUpdate"; objcomm.Parameters.Add("@accountCode", accountCode); objcomm.Parameters.Add("@gvrnSponsoredPrjRates", gvrnSponsoredPrjRates); objcomm.Parameters.Add("@clinicalFacultyRates", clinicalFacultyRates); objcomm.Parameters.Add("@otherRates", otherRates); //SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32); //outputParameter.Direction = ParameterDirection.ReturnValue; //objcomm.Parameters.Add(outputParameter); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); } }
public void DirectExpensesUpdate(String fiscalYear) { SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "DirectExpensesUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYear); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); }
public void DifferentialRevenueUpdate(String fiscalYear, int undergradStudents, double undergradRate, int gradCHG, double gradRate) { SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "DifferentialRevenueUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYear); objcomm.Parameters.Add("@numberUndergradStudents", undergradStudents); objcomm.Parameters.Add("@undergradRate", undergradRate); objcomm.Parameters.Add("@gradStudentsCHG", gradCHG); objcomm.Parameters.Add("@gradRate", gradRate); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); }
public DataSet getData() { return(objDB.GetDataSetUsingCmdObj(objCmd)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string query = "SELECT * FROM Student"; DBConnect db = new DBConnect(); ddStudentSelect.DataSource = db.GetDataSet(query); ddStudentSelect.DataValueField = "StudentID"; ddStudentSelect.DataTextField = "Name"; ddStudentSelect.DataBind(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetAllCourses"; gvCourses.DataSource = db.GetDataSetUsingCmdObj(command); gvCourses.DataBind(); for(int r = 0; r<gvCourses.Rows.Count; r++) { CheckBox cb; cb = (CheckBox)gvCourses.Rows[r].FindControl("cbSelectCourse"); if (int.Parse(gvCourses.Rows[r].Cells[10].Text) == 0) { cb.Enabled = false; } } } }
private string getImageURL(int prodNum) { string imgURL; DataSet url = new DataSet(); DBConnect objdb = new DBConnect(); SqlCommand findURL = new SqlCommand(); findURL.CommandType = CommandType.StoredProcedure; findURL.CommandText = "dbo.TP_getImageURL"; SqlParameter theProductNumber = new SqlParameter("@prodNum", prodNum); theProductNumber.Direction = ParameterDirection.Input; theProductNumber.SqlDbType = SqlDbType.Int; theProductNumber.Size = 4; findURL.Parameters.Add(theProductNumber); url = objdb.GetDataSetUsingCmdObj(findURL); return imgURL = url.Tables[0].Rows[0][0].ToString(); }
public DataSet serializedCart(int loginID) { DataSet theCart = new DataSet(); DBConnect objDB = new DBConnect(); SqlCommand getCart = new SqlCommand(); getCart.CommandType = CommandType.StoredProcedure; getCart.CommandText = "TP_getCart"; SqlParameter theID = new SqlParameter("@loginID", loginID); theID.Direction = ParameterDirection.Input; theID.SqlDbType = SqlDbType.Int; theID.Size = 4; getCart.Parameters.Add(theID); theCart = objDB.GetDataSetUsingCmdObj(getCart); return theCart; //code for getting the cart object }
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; }
public Boolean RevenueSummaryUpdate(String fiscalYear) { SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "RevenueExpenseSummaryUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYear); SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32); outputParameter.Direction = ParameterDirection.ReturnValue; objcomm.Parameters.Add(outputParameter); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); int result = int.Parse(objcomm.Parameters["@result"].Value.ToString()); if (result == 1) { return true; } else { return false; } }
public Boolean TuitionDifferentialRevenue() { String fiscalYearId = "FY2014"; double numberUndergradStudents = 2865; //Where does it come from? double undergradRate = 900; double gradStudentsCHG = 1312; //Why 1312? double gradRate = 60; SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "TuitionDifferentialRevenueUpdate"; objcomm.Parameters.Add("@fiscalYearId", fiscalYearId); objcomm.Parameters.Add("@numberUndergradStudents", numberUndergradStudents); objcomm.Parameters.Add("@undergradRate", undergradRate); objcomm.Parameters.Add("@gradStudentsCHG", gradStudentsCHG); objcomm.Parameters.Add("@gradRate", gradRate); SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32); outputParameter.Direction = ParameterDirection.ReturnValue; objcomm.Parameters.Add(outputParameter); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); int result = int.Parse(objcomm.Parameters["@result"].Value.ToString()); if (result == 1) { return true; } else { return false; } }
public Boolean checkAPIExist(string key) { DBConnect objDB = new DBConnect(); DataSet foundKey = new DataSet(); SqlCommand findKeys = new SqlCommand(); findKeys.CommandType = CommandType.StoredProcedure; findKeys.CommandText = "dbo.TP_CheckAPIExist"; SqlParameter theKey = new SqlParameter("@APIKey", key); theKey.Direction = ParameterDirection.Input; theKey.SqlDbType = SqlDbType.NVarChar; theKey.Size = 50; findKeys.Parameters.Add(theKey); foundKey = objDB.GetDataSetUsingCmdObj(findKeys); int found = Convert.ToInt32(foundKey.Tables[0].Rows[0]["foundKeys"].ToString()); if (found == 0) { return false; } else { return true; } }
public Boolean CHG() { String fiscalYearId = "FY2014"; String termId = "SS1_2014"; double undergradRate = 567; double gradRate = 805; double exportUndergradRate = 540; double exportGradRate = 805; double undergradGrossCHG = 3038; double gradGrossCHG = 68; double undergradExportedCHG = 744; double gradExportedCHG = 19; SqlCommand objcomm = new SqlCommand(); objcomm.CommandType = CommandType.StoredProcedure; objcomm.CommandText = "CHG_Update"; objcomm.Parameters.Add("@fiscalYearId", fiscalYearId); objcomm.Parameters.Add("@termId", termId); objcomm.Parameters.Add("@undergradRate", undergradRate); objcomm.Parameters.Add("@gradRate", gradRate); objcomm.Parameters.Add("@exportUndergradRate", exportUndergradRate); objcomm.Parameters.Add("@exportGradRate", exportGradRate); objcomm.Parameters.Add("@gradGrossCHG", gradGrossCHG); objcomm.Parameters.Add("@undergradGrossCHG", undergradGrossCHG); objcomm.Parameters.Add("@undergradExportedCHG", undergradExportedCHG); objcomm.Parameters.Add("@gradExportedCHG", gradExportedCHG); SqlParameter outputParameter = new SqlParameter("@result", DbType.Int32); outputParameter.Direction = ParameterDirection.ReturnValue; objcomm.Parameters.Add(outputParameter); DBConnect objDB = new DBConnect(); objDB.GetDataSetUsingCmdObj(objcomm); int result = int.Parse(objcomm.Parameters["@result"].Value.ToString()); if (result == 1) { return true; } else { return false; } }
public List <GalleryImagesClass> retrievePhotosList(String RequestingUser, String RequestedUserEmail, String privacySetting) { Profile ProfileObject = new Profile(); List <GalleryImagesClass> TempProfileArray = new List <GalleryImagesClass>(); Boolean checkifFriends = ProfileObject.CheckIf2UsersAreFriends(RequestingUser, RequestedUserEmail); if (checkifFriends == true) { DBConnect objDB = new DBConnect(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TP_RetrieveImageGallery"; objCommand.Parameters.AddWithValue("@Email", RequestedUserEmail); DataSet ImageGDS = objDB.GetDataSetUsingCmdObj(objCommand); List <GalleryImagesClass> ProfileArray = new List <GalleryImagesClass>(); for (int i = 0; i < ImageGDS.Tables[0].Rows.Count; i++) { GalleryImagesClass galleryobject = new GalleryImagesClass(); galleryobject.ImageID = int.Parse(ImageGDS.Tables[0].Rows[i]["ImageID"].ToString()); galleryobject.userEmail = ImageGDS.Tables[0].Rows[i]["userEmail"].ToString(); galleryobject.ImageURL = ImageGDS.Tables[0].Rows[i]["ImageURL"].ToString(); galleryobject.caption = ImageGDS.Tables[0].Rows[i]["caption"].ToString(); ProfileArray.Add(galleryobject); } return(ProfileArray); } if (privacySetting == "Public") { DBConnect objDB = new DBConnect(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TP_RetrieveImageGallery"; objCommand.Parameters.AddWithValue("@Email", RequestedUserEmail); DataSet ImageGDS = objDB.GetDataSetUsingCmdObj(objCommand); List <GalleryImagesClass> ProfileArray = new List <GalleryImagesClass>(); for (int i = 0; i < ImageGDS.Tables[0].Rows.Count; i++) { GalleryImagesClass galleryobject = new GalleryImagesClass(); galleryobject.ImageID = int.Parse(ImageGDS.Tables[0].Rows[i]["ImageID"].ToString()); galleryobject.userEmail = ImageGDS.Tables[0].Rows[i]["userEmail"].ToString(); galleryobject.ImageURL = ImageGDS.Tables[0].Rows[i]["ImageURL"].ToString(); galleryobject.caption = ImageGDS.Tables[0].Rows[i]["caption"].ToString(); ProfileArray.Add(galleryobject); } return(ProfileArray); } if (privacySetting == "Friends") { Boolean flag = ProfileObject.CheckIf2UsersAreFriends(RequestingUser, RequestedUserEmail); if (flag == true) { DBConnect objDB = new DBConnect(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TP_RetrieveImageGallery"; objCommand.Parameters.AddWithValue("@Email", RequestedUserEmail); DataSet ImageGDS = objDB.GetDataSetUsingCmdObj(objCommand); List <GalleryImagesClass> ProfileArray = new List <GalleryImagesClass>(); for (int i = 0; i < ImageGDS.Tables[0].Rows.Count; i++) { GalleryImagesClass galleryobject = new GalleryImagesClass(); galleryobject.ImageID = int.Parse(ImageGDS.Tables[0].Rows[i]["ImageID"].ToString()); galleryobject.userEmail = ImageGDS.Tables[0].Rows[i]["userEmail"].ToString(); galleryobject.ImageURL = ImageGDS.Tables[0].Rows[i]["ImageURL"].ToString(); galleryobject.caption = ImageGDS.Tables[0].Rows[i]["caption"].ToString(); ProfileArray.Add(galleryobject); } return(ProfileArray); } else { return(TempProfileArray); } } if (privacySetting == "FOF") { //Check if Friends of Friends Boolean flag = ProfileObject.CheckIfFOF(RequestingUser, RequestedUserEmail); if (flag == true) { DBConnect objDB = new DBConnect(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TP_RetrieveImageGallery"; objCommand.Parameters.AddWithValue("@Email", RequestedUserEmail); DataSet ImageGDS = objDB.GetDataSetUsingCmdObj(objCommand); List <GalleryImagesClass> ProfileArray = new List <GalleryImagesClass>(); for (int i = 0; i < ImageGDS.Tables[0].Rows.Count; i++) { GalleryImagesClass galleryobject = new GalleryImagesClass(); galleryobject.ImageID = int.Parse(ImageGDS.Tables[0].Rows[i]["ImageID"].ToString()); galleryobject.userEmail = ImageGDS.Tables[0].Rows[i]["userEmail"].ToString(); galleryobject.ImageURL = ImageGDS.Tables[0].Rows[i]["ImageURL"].ToString(); galleryobject.caption = ImageGDS.Tables[0].Rows[i]["caption"].ToString(); ProfileArray.Add(galleryobject); } return(ProfileArray); } else { return(TempProfileArray); } } else { return(TempProfileArray); } }