예제 #1
0
        protected void EditSparePartventHandler_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int    rowIndex = e.NewEditIndex;
            string partId   = CarServicePresentationUtility.GetGridCellContent(this.sparePartsGrid, rowIndex, 0);

            if (string.IsNullOrEmpty(partId) == false)
            {
                string addSparePartPageUrl = "~/Admin/SpareParts/AddSparePart.aspx?"
                                             + CarServiceConstants.SPARE_PART_ID_REQUEST_PARAM_NAME + "=" + partId;
                Response.Redirect(addSparePartPageUrl, false);
            }
        }
예제 #2
0
        protected void EditAutomobileEventHandler_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int    rowIndex = e.NewEditIndex;
            string autoId   = CarServicePresentationUtility.GetGridCellContent(this.automobilesGrid, rowIndex, 0);

            if (string.IsNullOrEmpty(autoId) == false)
            {
                Session[CarServiceConstants.AUTOMOBILE_ID_REQUEST_PARAM_NAME] = autoId;
                string editAutomobilePageUrl = "~/Members/Cars/AddCar.aspx";
                Response.Redirect(editAutomobilePageUrl);
            }
        }
예제 #3
0
        protected void EditRepairCardEventHandler_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int rowIndex = e.NewEditIndex;

            string repairCardId = CarServicePresentationUtility.GetGridCellContent(this.repairCardsGrid, rowIndex, 0);

            if (string.IsNullOrEmpty(repairCardId) == false)
            {
                Session[CarServiceConstants.REPAIR_CARD_ID_PARAM_NAME] = repairCardId;
                string editRepairCardPageUrl = "~/Members/RepairCards/AddRepairCard.aspx";
                Response.Redirect(editRepairCardPageUrl);
            }
        }
예제 #4
0
        protected void EditUserEventHandler_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int    rowIndex = e.NewEditIndex; int userNameCellIndex = 0;
            string userName = CarServicePresentationUtility.GetGridCellContent(this.carServiceUsers, rowIndex, userNameCellIndex);

            if (string.IsNullOrEmpty(userName) == false)
            {
                MembershipUser user            = Membership.GetUser(userName);
                string         editUserPageUrl = "~/Admin/Users/EditUser.aspx?"
                                                 + CarServiceConstants.USER_ID_REQUEST_PARAM_NAME + "=" + user.ProviderUserKey.ToString();
                Response.Redirect(editUserPageUrl, false);
            }
        }
예제 #5
0
        protected void DeactivateUserEventHandler_RowDeliting(object sender, GridViewDeleteEventArgs e)
        {
            int    rowIndex          = e.RowIndex;
            int    userNameCellIndex = 0;
            string userName          = CarServicePresentationUtility.GetGridCellContent(this.carServiceUsers, rowIndex, userNameCellIndex);

            if (string.IsNullOrEmpty(userName) == false)
            {
                MembershipUser user = Membership.GetUser(userName);
                if (user != null && user.IsApproved == true)
                {
                    user.IsApproved = false;
                    Membership.UpdateUser(user);
                }
            }
            BindUsersGrid();
        }
예제 #6
0
        protected void DeactivateSparePartEventHandler_RowDeliting(object sender, GridViewDeleteEventArgs e)
        {
            int    rowIndex = e.RowIndex;
            string partId   = CarServicePresentationUtility.GetGridCellContent(this.sparePartsGrid, rowIndex, 0);

            if (string.IsNullOrEmpty(partId) == false)
            {
                int partIdNum;
                if (Int32.TryParse(partId, out partIdNum) == true)
                {
                    SparePart sparePart = this.persister.GetSparePartById(partIdNum);
                    if (sparePart != null && sparePart.IsActive)
                    {
                        sparePart.IsActive = false;
                        this.persister.SaveChanges();
                    }
                }
            }
            BindSparePartsGrid();
        }