private bool setUserPrefferedShop(Int32 iUserId, out Int32 iShopId, out Boolean hasGroupOfPrivateShops, out Boolean bPerfromOperation) { iShopId = 0; hasGroupOfPrivateShops = false; bPerfromOperation = true; UserPreferredShopBL objPrefferedShop = UserPreferredShopBL.getShopByUserId(iUserId); Int32 iPrivateShopId = 0; if (Request.QueryString[Constants.QUERYSTRING_PRIVATELABELSHOPID] != null) { iPrivateShopId = Convert.ToInt32(Request.QueryString[Constants.QUERYSTRING_PRIVATELABELSHOPID]); } else if (Request.Form[Constants.QUERYSTRING_PRIVATELABELSHOPID] != null) { iPrivateShopId = Convert.ToInt32(Request.Form[Constants.QUERYSTRING_PRIVATELABELSHOPID]); } if (iPrivateShopId > 0) { BodyShopBL objShop = null; List <BodyShopPrivateLabelBL> lstBodyShopPrivateLabelBL = new List <BodyShopPrivateLabelBL>(); lstBodyShopPrivateLabelBL = BodyShopPrivateLabelBL.GetShopListByPrivateLabelId(iPrivateShopId); //Check that more than one shop within this private labeling group? if yes then don't assign preferred shop if (lstBodyShopPrivateLabelBL.Count > 1) { //This privateLabelId exist for a group of shops; user need to select preferred shop from "Select Preferred Shop" page hasGroupOfPrivateShops = true; return(false); } else { objShop = BodyShopBL.getShopById(Convert.ToInt32(lstBodyShopPrivateLabelBL[0].iShopID)); } if (objShop != null) { if (objPrefferedShop == null) { objPrefferedShop = new UserPreferredShopBL(); } else { //If user has alredy set same preferred shop then return. if (objShop.ID == objPrefferedShop.iShopId) { bPerfromOperation = false; return(false); } MessageBL objMesssage = MessageBL.getDataByUserShopIdAndType(iUserId, objShop.ID, Constants.REGISTRATIONMESSAGTYPE); if (objMesssage != null) { objMesssage.Delete(); } } objPrefferedShop.iShopId = objShop.ID; objPrefferedShop.iUserId = iUserId; if (objPrefferedShop.Save()) { iShopId = objShop.ID; return(true); } else { return(false); } } } return(false); }