Beispiel #1
0
        protected void ReportType_IndexChanged(object sender, EventArgs e)
        {
            CarServicePresentationUtility.ClearNotificationMsgList(this.notificationMsgList);
            CarServicePresentationUtility.HideNotificationMsgList(this.notificationMsgList);
            int    filterType = this.repairCardsFilterType.SelectedIndex;
            string filterBtnValidationGroupName = string.Empty;

            if (filterType == CarServiceConstants.ALL_REPAIR_CARDS_FILTER_TYPE)
            {
                this.allRepairCardsFilter.Visible        = true;
                this.finishedRepairCardsFilter.Visible   = false;
                this.unfinishedRepairCardsFilter.Visible = false;
                filterBtnValidationGroupName             = "AllRepairCardsFilterValidationGroup";
            }
            else if (filterType == CarServiceConstants.FINISHED_REPAIR_CARDS_FILTER_TYPE)
            {
                this.finishedRepairCardsFilter.Visible   = true;
                this.allRepairCardsFilter.Visible        = false;
                this.unfinishedRepairCardsFilter.Visible = false;
                filterBtnValidationGroupName             = "UnfinishedRepairCardsFilterValidationGroup";
            }
            else if (filterType == CarServiceConstants.UNFINISHED_REPAIR_CARDS_FILTER_TYPE)
            {
                this.unfinishedRepairCardsFilter.Visible = true;
                this.finishedRepairCardsFilter.Visible   = false;
                this.allRepairCardsFilter.Visible        = false;
                filterBtnValidationGroupName             = "FinishedRepairCardsFilterValidationGroup";
            }
            this.filterButton.ValidationGroup = filterBtnValidationGroupName;
        }
Beispiel #2
0
        private void GenerateNotificationErrorMsg(bool validVin, bool isVinExists, bool validChassisNumber, bool isChassisExists,
                                                  bool validEngineCub, bool validMakeYear)
        {
            string notificationMsg = string.Empty;

            if (validVin == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Vin is not valid", this.notificationMsgList);
            }
            else if (isVinExists)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Vin is not unique", this.notificationMsgList);
            }
            if (validChassisNumber == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Chassis number is not valid", this.notificationMsgList);
            }
            else if (isChassisExists)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Chassis number is not unique", this.notificationMsgList);
            }
            if (validEngineCub == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Engine cub is not valid number", this.notificationMsgList);
            }
            if (validMakeYear == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Make year is not valid", this.notificationMsgList);
            }
            this.notificationMsgList.CssClass = CarServiceConstants.NEGATIVE_CSS_CLASS_NAME;
        }
Beispiel #3
0
        protected void RepairCardsGridView_PageIndexChanging(Object sender, GridViewPageEventArgs e)
        {
            this.repairCardsGrid.PageIndex = e.NewPageIndex;
            object repairCardsFilterObject = Session[CarServiceConstants.REPAIR_CARDS_FILTER_SESSION_ATTR_NAME];
            IQueryable <RepairCard> repairCards;

            if (repairCardsFilterObject != null)
            {
                RepairCardFilter filter = (RepairCardFilter)repairCardsFilterObject;
                repairCards = FilterRepairCards(filter);
            }
            else
            {
                repairCards = this.persister.GetRepairCards();
            }
            object sortDirectionObj  = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR];
            object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR];

            if (sortDirectionObj != null && sortExpressionObj != null)
            {
                repairCards = SortingUtility.SortRepairCards(repairCards,
                                                             sortExpressionObj.ToString(), (SortDirection)sortDirectionObj);
            }
            BindRepairCardsGrid(repairCards);
            CarServicePresentationUtility.ClearNotificationMsgList(this.notificationMsgList);
            CarServicePresentationUtility.HideNotificationMsgList(this.notificationMsgList);
        }
        protected void AddPart_OnClick(object sender, EventArgs e)
        {
            string partIdTxt = this.PartId.Text;
            int    partId;
            bool   validIdValue = Int32.TryParse(partIdTxt, out partId);

            this.notificationMsgList.CssClass = CarServiceConstants.NEGATIVE_CSS_CLASS_NAME;
            if (validIdValue == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("ID is not valid", this.notificationMsgList);
            }
            string  partPriceTxt = this.PartPrice.Text;
            decimal partPrice;
            bool    validPriceValue = Decimal.TryParse(partPriceTxt, out partPrice);

            if (validPriceValue == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Price is not valid", this.notificationMsgList);
            }
            int isPartActiveNum;

            if (validIdValue && validPriceValue &&
                Int32.TryParse(this.PartActive.SelectedValue, out isPartActiveNum) == true)
            {
                bool   isPartActive = (isPartActiveNum == 1);
                string partName     = this.PartName.Text;
                SaveSparePart(partId, partName, partPrice, isPartActive);
                CarServicePresentationUtility.AppendNotificationMsg("Part is saved successfully", this.notificationMsgList);
                this.notificationMsgList.CssClass = CarServiceConstants.POSITIVE_CSS_CLASS_NAME;
            }
            CarServicePresentationUtility.ShowNotificationMsgList(this.notificationMsgList);
        }
        protected void SaveRepairCard_OnClick(object sender, EventArgs e)
        {
            CarServicePresentationUtility.ClearNotificationMsgList(this.notificationMsgList);
            CarServicePresentationUtility.HideNotificationMsgList(this.notificationMsgList);
            this.notificationMsgList.CssClass = CarServiceConstants.NEGATIVE_CSS_CLASS_NAME;

            DateTime?startRepairDate      = null;
            string   startRepairDateTxt   = this.startRepairDate.SelectedDate;
            bool     validStartRepairDate = CarServicePresentationUtility.ProcessStartRepairDate(startRepairDateTxt,
                                                                                                 this.notificationMsgList, out startRepairDate);

            decimal sparePartsPrice    = 0M;
            decimal repairPrice        = 0M;
            string  repairPriceTxt     = this.repairPrice.Text;
            string  sparePartsPriceTxt = this.sparePartsPrice.Text;
            bool    validPrices        = CarServicePresentationUtility.ProcessRepairPrices(sparePartsPriceTxt, repairPriceTxt,
                                                                                           this.notificationMsgList, out sparePartsPrice, out repairPrice);

            string     automobileIdTxt   = this.automobileDropDown.SelectedValue;
            Automobile automobile        = CarServiceUtility.GetAutomobile(automobileIdTxt, this.persister);
            bool       validAutomobileId = (automobile != null);

            ListItemCollection selectedSparePartItems = this.selectedSpareParts.Items;
            bool validSpareParts = CarServicePresentationUtility.IsSparePartItemsValid(selectedSparePartItems, this.notificationMsgList);

            if (validAutomobileId && validPrices && validSpareParts &&
                (validStartRepairDate && startRepairDate.HasValue))
            {
                string description        = this.repairCardDescription.Text;
                object repairCardIdObject = Session[CarServiceConstants.REPAIR_CARD_ID_PARAM_NAME];
                if (repairCardIdObject != null)
                {
                    int repairCardId;
                    if (Int32.TryParse(repairCardIdObject.ToString(), out repairCardId))
                    {
                        DateTime?finishRepairDate      = null;
                        string   finishRepairDateTxt   = this.finishRepairDate.SelectedDate;
                        bool     validFinishRepairDate = CarServicePresentationUtility.ProcessFinishRepairDate(finishRepairDateTxt,
                                                                                                               this.notificationMsgList, out finishRepairDate);
                        if (validFinishRepairDate == true)
                        {
                            RepairCard repairCard = this.persister.GetRepairCardById(repairCardId);
                            UpdateRepairCard(repairCard, automobile, finishRepairDate, description,
                                             sparePartsPrice, repairPrice, selectedSparePartItems);
                            CarServicePresentationUtility.AppendNotificationMsg("Repair card is updated successfully", this.notificationMsgList);
                            this.notificationMsgList.CssClass = CarServiceConstants.POSITIVE_CSS_CLASS_NAME;
                        }
                    }
                }
                else
                {
                    SaveRepairCard(automobile, startRepairDate.Value, description,
                                   sparePartsPrice, repairPrice, selectedSparePartItems);
                    CarServicePresentationUtility.AppendNotificationMsg("Repair card is saved successfully", this.notificationMsgList);
                    this.notificationMsgList.CssClass = CarServiceConstants.POSITIVE_CSS_CLASS_NAME;
                }
            }
            CarServicePresentationUtility.ShowNotificationMsgList(this.notificationMsgList);
        }
        protected void UnselectSpareParts_OnClick(object sender, EventArgs e)
        {
            decimal partsPrice = 0M;

            CarServicePresentationUtility.MoveListItems(this.selectedSpareParts, this.unselectedSpareParts, true, this.persister, out partsPrice);
            this.sparePartsPrice.Text = partsPrice.ToString();
            this.repairPrice.Text     = partsPrice.ToString();
        }
 private void UpdateRepairCard(RepairCard repairCard, Automobile automobile, DateTime?finishRepairDate,
                               string description, decimal sparePartsPrice, decimal repairPrice, ListItemCollection sparePartItems)
 {
     repairCard.Automobile   = automobile;
     repairCard.Description  = (string.IsNullOrEmpty(description) ? null : description);
     repairCard.FinishRepair = finishRepairDate;
     repairCard.PartPrice    = sparePartsPrice;
     repairCard.CardPrice    = repairPrice;
     CarServicePresentationUtility.AddSpareParts(repairCard, sparePartItems, this.persister);
     this.persister.SaveChanges();
 }
        private void LoadRepairCardInfo(RepairCard repairCard)
        {
            this.repairCardIdLbl.Text = repairCard.CardId.ToString();
            this.operatorLbl.Text     = repairCard.aspnet_Users.UserName;
            List <Automobile> automobiles = new List <Automobile>();

            automobiles.Add(repairCard.Automobile);
            var customAutomobileFormat =
                from auto in automobiles
                select new
            {
                AutomobileId             = auto.AutomobileId,
                AutomobileRepresentation = auto.Vin + " / " + auto.ChassisNumber
            };

            this.automobileDropDown.DataSource = customAutomobileFormat;
            this.automobileDropDown.DataBind();

            this.sparePartsPrice.Text = repairCard.PartPrice.ToString();
            this.repairPrice.Text     = repairCard.CardPrice.ToString();

            CultureInfo englishCultureInfo = new CultureInfo(CarServiceConstants.ENGLISH_CULTURE_INFO);

            this.startRepairDate.SelectedDate = repairCard.StartRepair.ToString(CarServiceConstants.DATE_FORMAT, englishCultureInfo);
            DateTime?finishRepairDate = repairCard.FinishRepair;

            if (finishRepairDate.HasValue)
            {
                this.finishRepairDate.SelectedDate = finishRepairDate.Value.ToString(CarServiceConstants.DATE_FORMAT, englishCultureInfo);
                DisableAllInputControls();
            }
            else
            {
                this.finishRepairDate.Enabled = true;
            }
            EntityCollection <SparePart> selectedParts    = repairCard.SpareParts;
            List <SparePart>             unselectedParts  = new List <SparePart>();
            IQueryable <SparePart>       activeSpareParts = this.persister.GetActiveSpareParts();

            foreach (SparePart part in activeSpareParts)
            {
                if (selectedParts.Contains(part) == false)
                {
                    unselectedParts.Add(part);
                }
            }
            object customUnselectedSpareParts = CarServicePresentationUtility.GetSparePartsFormatForListBox(unselectedParts);
            object customSelectedSpareParts   = CarServicePresentationUtility.GetSparePartsFormatForListBox(selectedParts);

            CarServicePresentationUtility.BindListBox(this.unselectedSpareParts, customUnselectedSpareParts);
            CarServicePresentationUtility.BindListBox(this.selectedSpareParts, customSelectedSpareParts);
            this.repairCardDescription.Text = repairCard.Description;
        }
Beispiel #9
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);
            }
        }
Beispiel #10
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);
            }
        }
Beispiel #11
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);
            }
        }
Beispiel #12
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);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.persister == null)
            {
                this.persister = new CarServicePersister();
            }
            if (IsPostBack == false)
            {
                this.finishRepairDate.Enabled = false;
                object repairCardIdObject = Session[CarServiceConstants.REPAIR_CARD_ID_PARAM_NAME];
                if (repairCardIdObject != null)
                {
                    int repairCardId;
                    if (Int32.TryParse(repairCardIdObject.ToString(), out repairCardId))
                    {
                        RepairCard repairCard = this.persister.GetRepairCardById(repairCardId);
                        LoadRepairCardInfo(repairCard);

                        Guid           creatorUserId = repairCard.UserId;
                        MembershipUser currentUser   = Membership.GetUser();
                        Guid           currentUserId = (Guid)currentUser.ProviderUserKey;
                        if (currentUserId.Equals(creatorUserId) == false)
                        {
                            DisableAllInputControls();
                        }
                        else
                        {
                            this.startRepairDate.Enabled = false;
                        }
                    }
                }
                else
                {
                    IQueryable <SparePart> spareParts = this.persister.GetActiveSpareParts();
                    object customSpareParts           = CarServicePresentationUtility.GetSparePartsFormatForListBox(spareParts);
                    CarServicePresentationUtility.BindListBox(this.unselectedSpareParts, customSpareParts);
                    this.startRepairDate.SelectedDate =
                        DateTime.Now.ToString(CarServiceConstants.DATE_FORMAT, new CultureInfo(CarServiceConstants.ENGLISH_CULTURE_INFO));
                    this.finishRepairDate.Enabled = false;
                    this.operatorLbl.Text         = this.User.Identity.Name;
                }
            }
            CarServicePresentationUtility.ClearNotificationMsgList(this.notificationMsgList);
            CarServicePresentationUtility.HideNotificationMsgList(this.notificationMsgList);
            Session[CarServiceConstants.AUTOMOBILE_ID_REQUEST_PARAM_NAME] = null;
        }
Beispiel #14
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();
        }
        private void SaveRepairCard(Automobile automobile, DateTime startRepairDate, string description,
                                    decimal sparePartsPrice, decimal repairPrice, ListItemCollection sparePartItems)
        {
            MembershipUser currentUser   = Membership.GetUser();
            RepairCard     newRepairCard = new RepairCard()
            {
                Automobile  = automobile,
                UserId      = ((System.Guid)currentUser.ProviderUserKey),
                StartRepair = startRepairDate,
                Description = (string.IsNullOrEmpty(description) ? null : description),
                PartPrice   = sparePartsPrice,
                CardPrice   = repairPrice
            };

            CarServicePresentationUtility.AddSpareParts(newRepairCard, sparePartItems, this.persister);
            this.persister.CreateRepairCard(newRepairCard);
            this.persister.SaveChanges();
        }
Beispiel #16
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();
        }
Beispiel #17
0
        private void HandleAutomobileInformation(string vin, string chassisNumber, string engineNumberTxt,
                                                 string engineCubTxt, string make, string model, string makeYearTxt, string owner,
                                                 string phoneNumber, string colour, string description)
        {
            CarServicePresentationUtility.ClearNotificationMsgList(this.notificationMsgList);
            CarServicePresentationUtility.HideNotificationMsgList(this.notificationMsgList);
            bool       validVin           = false;
            bool       validChassisNumber = false;
            Automobile auto         = null;
            object     autoIdObject = Session[CarServiceConstants.AUTOMOBILE_ID_REQUEST_PARAM_NAME];

            // Updating existing automobile
            if (autoIdObject != null)
            {
                int autoId;
                if (Int32.TryParse(autoIdObject.ToString(), out autoId))
                {
                    auto = this.persister.GetAutomobilById(autoId);
                    string currentVin   = auto.Vin;
                    bool   isVinChanged = string.IsNullOrEmpty(currentVin) ||
                                          currentVin.Equals(vin) == false;
                    if (isVinChanged)
                    {
                        validVin = IsVinValid(vin);
                    }
                    else
                    {
                        validVin = true;
                    }
                    string currentChassisNumber   = auto.ChassisNumber;
                    bool   isChassisNumberChanged = string.IsNullOrEmpty(currentChassisNumber) ||
                                                    currentChassisNumber.Equals(chassisNumber) == false;
                    if (isChassisNumberChanged)
                    {
                        validChassisNumber = IsChassisNumberValid(chassisNumber);
                    }
                    else
                    {
                        validChassisNumber = true;
                    }
                }
            }
            else //Creates new automobile
            {
                validVin           = IsVinValid(vin);
                validChassisNumber = IsChassisNumberValid(chassisNumber);
            }
            bool     isVinExists     = this.persister.IsVinExists(vin);
            bool     isChassisExists = this.persister.IsChassisNumberExists(chassisNumber);
            int      engineCubValue  = -1;
            bool     emptyEngineCub  = string.IsNullOrEmpty(engineCubTxt);
            bool     validEngineCub  = emptyEngineCub || Int32.TryParse(engineCubTxt, out engineCubValue);
            DateTime makeYearValue   = DateTime.Now;
            bool     emptyMakeYear   = string.IsNullOrEmpty(makeYearTxt);
            bool     validMakeYear   = emptyMakeYear ||
                                       DateTime.TryParseExact(makeYearTxt, CarServiceConstants.DATE_FORMAT,
                                                              new CultureInfo(CarServiceConstants.ENGLISH_CULTURE_INFO), DateTimeStyles.None, out makeYearValue);

            GenerateNotificationErrorMsg(validVin, isVinExists, validChassisNumber, isChassisExists, validEngineCub, validMakeYear);
            if (validVin && validChassisNumber && validEngineCub && validMakeYear &&
                (isVinExists == false) && (isChassisExists == false))
            {
                DateTime?makeYear = null;
                if (emptyMakeYear == false)
                {
                    makeYear = makeYearValue;
                }
                int?engineCub = null;
                if (emptyEngineCub == false)
                {
                    engineCub = engineCubValue;
                }
                bool successfullySaved = SaveAutomobile(auto, vin, chassisNumber, engineNumberTxt,
                                                        engineCub, make, model, makeYear, owner, phoneNumber, colour, description);
                if (successfullySaved)
                {
                    CarServicePresentationUtility.AppendNotificationMsg("Car is saved successfully", this.notificationMsgList);
                    this.notificationMsgList.CssClass = CarServiceConstants.POSITIVE_CSS_CLASS_NAME;
                }
            }
            CarServicePresentationUtility.ShowNotificationMsgList(this.notificationMsgList);
        }
Beispiel #18
0
        protected void FilterRepairCards_OnClick(object sender, EventArgs e)
        {
            CarServicePresentationUtility.ClearNotificationMsgList(this.notificationMsgList);
            CarServicePresentationUtility.HideNotificationMsgList(this.notificationMsgList);
            int filterType          = this.repairCardsFilterType.SelectedIndex;
            RepairCardFilter filter = new RepairCardFilter(filterType);

            if (filterType == CarServiceConstants.ALL_REPAIR_CARDS_FILTER_TYPE)
            {
                filter.VinChassis = this.VinChassisAllRepairCardsTxt.Text;
            }
            else if (filterType == CarServiceConstants.FINISHED_REPAIR_CARDS_FILTER_TYPE)
            {
                DateTime?fromFinishRepairDate      = null;
                bool     validFromFinishRepairDate = false;
                string   fromFinishDateTxt         = this.fromFinishRepairDate.SelectedDate;
                if (string.IsNullOrEmpty(fromFinishDateTxt) == false)
                {
                    DateTime fromFinishRepairDateValue = DateTime.Now;
                    validFromFinishRepairDate = CarServiceUtility.IsValidDate(fromFinishDateTxt, out fromFinishRepairDateValue);
                    if (validFromFinishRepairDate == true)
                    {
                        fromFinishRepairDate = fromFinishRepairDateValue;
                    }
                }
                DateTime?toFinishRepairDate      = null;
                bool     validToFinishRepairDate = false;
                string   toFinishRepairDateTxt   = this.toFinishRepairDate.SelectedDate;
                if (string.IsNullOrEmpty(toFinishRepairDateTxt) == false)
                {
                    DateTime toFinishRepairDateValue = DateTime.Now;
                    validToFinishRepairDate = CarServiceUtility.IsValidDate(toFinishRepairDateTxt, out toFinishRepairDateValue);
                    if (validToFinishRepairDate == true)
                    {
                        toFinishRepairDate = toFinishRepairDateValue;
                    }
                }
                if (validFromFinishRepairDate && validToFinishRepairDate)
                {
                    filter.FromFinishRepair = fromFinishRepairDate.Value;
                    filter.ToFinishRepair   = toFinishRepairDate.Value;
                }
                else
                {
                    if (validFromFinishRepairDate == false)
                    {
                        CarServicePresentationUtility.AppendNotificationMsg("From finish repair date is not valid format", this.notificationMsgList);
                    }
                    if (validToFinishRepairDate == false)
                    {
                        CarServicePresentationUtility.AppendNotificationMsg("To finish repair date is not valid format", this.notificationMsgList);
                    }
                    CarServicePresentationUtility.ShowNotificationMsgList(this.notificationMsgList);
                    return;
                }
            }
            else if (filterType == CarServiceConstants.UNFINISHED_REPAIR_CARDS_FILTER_TYPE)
            {
                bool   validDate          = false;
                string startRepairDateTxt = this.startRepairDate.SelectedDate;
                if (string.IsNullOrEmpty(startRepairDateTxt) == false)
                {
                    DateTime startRepairDateValue = DateTime.Now;
                    validDate = CarServiceUtility.IsValidDate(startRepairDateTxt, out startRepairDateValue);
                    if (validDate == true)
                    {
                        filter.StartRepair = startRepairDateValue;
                    }
                }
                if (validDate == false)
                {
                    CarServicePresentationUtility.AppendNotificationMsg("Start repair date is not valid format", this.notificationMsgList);
                    CarServicePresentationUtility.ShowNotificationMsgList(this.notificationMsgList);
                    return;
                }
                filter.VinChassis = this.VinChassisTxt.Text;
            }
            ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]      = SortDirection.Ascending;
            ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]     = CarServiceConstants.REPAIR_CARD_ID_SORT_EXPRESSION;
            Session[CarServiceConstants.REPAIR_CARDS_FILTER_SESSION_ATTR_NAME] = filter;
            IQueryable <RepairCard> customRepairCards = FilterRepairCards(filter);

            BindRepairCardsGrid(customRepairCards);
        }