Example #1
0
        private void LoadDefaultValues()
        {
            //Load All Model Name
            VehicleInfoBL viBL = new VehicleInfoBL();

            foreach (var vehicleInfo in viBL.GetAllVehicleInfo())
            {
                ComboboxItem obj = new ComboboxItem();
                obj.Text  = vehicleInfo.ModelName;
                obj.Value = vehicleInfo.VehicleInfoID;
                ddlModelName.Items.Add(obj);
            }

            //Load Default Colors
            ddlColor.DataSource = GlobalSetup.colors;

            //Load Inventory Status
            ddlInvStatus.Items.Clear();
            VehicleInventoryBL obj2 = new VehicleInventoryBL();

            foreach (var status in obj2.GetInventoryStatusType())
            {
                ComboboxItem itemInventoryStatus = new ComboboxItem();
                itemInventoryStatus.Text  = status.Description;
                itemInventoryStatus.Value = status.VehicleInventoryStatusTypeID;
                ddlInvStatus.Items.Add(itemInventoryStatus);
            }
        }
        private void LoadDefaultValues()
        {
            //Load Status
            ddlStatus.Items.Clear();
            VehicleInfoBL v     = new VehicleInfoBL();
            var           slist = v.GetVehicleSalesStatus(string.Empty);

            foreach (var vl in slist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = vl.Description;;
                item.Value = vl.VehicleSalesStatusID;
                ddlStatus.Items.Add(item);
            }

            if (ddlStatus.Items.Count > 0)
            {
                ddlStatus.SelectedIndex = 0;
            }

            CustomerEnquiryFollowupBL ef = new CustomerEnquiryFollowupBL();

            dgFollowup.DataSource = ef.GetCustomerEnquiryFollowup(Convert.ToDateTime(dtStartDate.Text), Convert.ToDateTime(dtEndDate.Text), 1) //default status open
                                    .ToList();
            if (dgFollowup.RowCount > 0)
            {
                btnEDIT.Enabled = true;
            }
            else
            {
                btnEDIT.Enabled = false;
            }
        }
Example #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var vehicleInfoID = Convert.ToInt32(dgCutomerInfo.CurrentRow.Cells["VehicleInfoID"].Value.ToString());

            if (vehicleInfoID == 0)
            {
                MyMessageBox.ShowBox("Please select a value from the Vehicle Info!!!");
            }
            else
            {
                var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Delete??");
                if (retStr == "1")
                {
                    VehicleInfoBL obj  = new VehicleInfoBL();
                    var           flag = obj.DeleteVehicleInfo(vehicleInfoID);
                    LoadDefaultValues();
                    if (flag)
                    {
                        MyMessageBox.ShowBox("Vehicle Information Deleted");
                    }
                    else
                    {
                        MyMessageBox.ShowBox("Vehicle Information Failed to Delete.");
                    }
                }
            }
        }
Example #4
0
        public void AddnewRecordInVehicleStatus(Int32 iVehicleId, Int32 iShopId, ImportData objImportData)
        {
            UserBL objUserBL = null;
            String strShopId = String.Empty;
            //Get Vehicle Info object from current vehicle ID
            VehicleInfoBL objVehicleInfoBL = VehicleInfoBL.getDataId(iVehicleId);

            if (objVehicleInfoBL != null)
            {
                //Create UserBL object from user ID used in Vehicle Info table
                objUserBL = UserBL.getByActivityId(Convert.ToInt32(objVehicleInfoBL.iUserId));
                strShopId = Convert.ToString(iShopId);
            }

            if (objUserBL != null && objVehicleInfoBL != null && !String.IsNullOrEmpty(strShopId))
            {
                SaveVehicleStatus(objVehicleInfoBL, objImportData, objUserBL, strShopId);
                UserVehicleStatusBL objUserVehicleStatusBL = UserVehicleStatusBL.getDataByVehicleId(iVehicleId);
                if (objUserVehicleStatusBL != null)
                {
                    MarketingUsers objMarUser = MarketingUsers.getDataByShopUserAndVehicleId(iShopId, Convert.ToInt32(objVehicleInfoBL.iUserId), iVehicleId);
                    objMarUser.bisShowInProcess = true;
                    objMarUser.Save();
                }
            }
            else
            {
                return;
            }
        }
Example #5
0
        public void LoadDefaultValues()
        {
            //Load employees
            EmployeeBL e            = new EmployeeBL();
            var        employeelist = e.GetEmployeelist();

            foreach (var elist in employeelist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = elist.FirstName;
                item.Value = elist.EmployeeID;
                ddlEmployees.Items.Add(item);
            }

            //Load Vehicle Model Name
            VehicleInfoBL v     = new VehicleInfoBL();
            var           vlist = v.GetAllVehicleInfo();

            foreach (var vl in vlist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = vl.ModelName;;
                item.Value = vl.VehicleInfoID;
                ddlModel.Items.Add(item);
            }

            //Load Colors
            ddlColor1.DataSource = GlobalSetup.colors;
            ddlColor2.DataSource = GlobalSetup.colors2;
            ddlColor3.DataSource = GlobalSetup.colors3;

            //Load Status
            string searchMode = "";

            if (_mode != "" && _mode != "EDIT")
            {
                searchMode = "ALL";
            }
            var slist = v.GetVehicleSalesStatus(searchMode);

            foreach (var vl in slist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = vl.Description;;
                item.Value = vl.VehicleSalesStatusID;
                ddlStatus.Items.Add(item);
            }

            //Load finance
            FinanceInfoBL fBL = new FinanceInfoBL();

            foreach (var vl in fBL.GetAllFinanceInfo())
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = vl.Name;
                item.Value = vl.FinanceInfoID;
                ddlFinance.Items.Add(item);
            }
        }
Example #6
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            var           modelCode    = txtContactNo.Text;
            var           modelName    = txtName.Text;
            VehicleInfoBL obj          = new VehicleInfoBL();
            var           filterefInfo = obj.GetAllVehicleInfo().Where(i => i.ModelCode.ToUpper().Contains(modelCode.ToUpper()) && i.ModelName.ToUpper().Contains(modelName.ToUpper())).ToList();

            dgCutomerInfo.DataSource = filterefInfo;
        }
Example #7
0
        public void SaveMarketingUser(VehicleInfoBL objVehicleInfo, UserBL objUser, String strShopId)
        {
            MarketingUsers objMarUser = new MarketingUsers();

            objMarUser.iShopId          = Convert.ToInt32(strShopId);
            objMarUser.iUserId          = objUser.ID;
            objMarUser.iVehicleId       = objVehicleInfo.ID;
            objMarUser.bisShowInProcess = true;
            objMarUser.iVehicleId       = objVehicleInfo.ID;
            objMarUser.Save();
        }
Example #8
0
        private void LoadDefaultValue()
        {
            VehicleInfoBL viBL = new VehicleInfoBL();

            foreach (var vehicletypes in viBL.GetVehicleTypes())
            {
                ComboboxItem obj = new ComboboxItem();
                obj.Text  = vehicletypes.Description;
                obj.Value = vehicletypes.VehicleTypeID;
                ddlVehicleType.Items.Add(obj);
            }
        }
Example #9
0
        private void LoadDefaultValues()
        {
            VehicleInventoryBL obj = new VehicleInventoryBL();
            var lst = obj.GetAllVehicleInventory();


            if (_mode == "ADD")
            {
                lst = lst.Where(i => i.VehicleInventoryStatusTypeID == 1).ToList();
            }
            dgVehicleInventory.DataSource = lst;
            //Get All Model Name
            VehicleInfoBL obj1       = new VehicleInfoBL();
            var           allVehInfo = obj1.GetAllVehicleInfo();

            ddlModelName.Items.Clear();
            ddlModelCode.Items.Clear();
            foreach (var vehInfo in allVehInfo)
            {
                //Load Model Name
                ComboboxItem itemModelName = new ComboboxItem();
                itemModelName.Text  = vehInfo.ModelName;
                itemModelName.Value = vehInfo.VehicleInfoID;
                ddlModelName.Items.Add(itemModelName);

                //Load Model Code
                ComboboxItem itemModelcode = new ComboboxItem();
                itemModelcode.Text  = vehInfo.ModelCode;
                itemModelcode.Value = vehInfo.VehicleInfoID;
                ddlModelCode.Items.Add(itemModelcode);
            }


            //Load Inventory Status
            ddlInventoryStatus.Items.Clear();
            VehicleInventoryBL obj2 = new VehicleInventoryBL();

            foreach (var status in obj2.GetInventoryStatusType())
            {
                ComboboxItem itemInventoryStatus = new ComboboxItem();
                itemInventoryStatus.Text  = status.Description;
                itemInventoryStatus.Value = status.VehicleInventoryStatusTypeID;
                ddlInventoryStatus.Items.Add(itemInventoryStatus);
            }

            //Load Colors
            ddlColor.DataSource    = GlobalSetup.colors;
            ddlColor.SelectedIndex = -1;
        }
Example #10
0
        /// <summary>
        /// Insert data in appropriate tables
        /// </summary>
        /// <param name="strShopId"></param>
        /// <param name="objImportData"></param>
        /// <param name="objUser"></param>
        public void InsertData(String strShopId, ImportData objImportData, UserBL objUser)
        {
            SummitShopApp.Utility.CommonFunctions.LoggingForImportStatus(Constants.INSERTING_DATA + strShopId);
            VehicleInfoBL objVehicleInfo = new VehicleInfoBL();

            //Add values to Vehicle Info
            objVehicleInfo = SaveVehicleinfo(objVehicleInfo, objImportData, objUser);
            //Save MArketing User
            SaveMarketingUser(objVehicleInfo, objUser, strShopId);

            //Save Vehicle Status Information
            SaveVehicleStatus(objVehicleInfo, objImportData, objUser, strShopId);
            //Save Insurance Info
            SaveInsuranceInfo(objImportData, objUser);
        }
Example #11
0
        /// <summary>
        /// Update Vehicle Information
        /// </summary>
        /// <param name="iVehicleId"></param>
        /// <param name="objImportData"></param>
        /// <returns></returns>
        private Boolean updateVehicleData(Int32 iVehicleId, ImportData objImportData)
        {
            try
            {
                //Get Vehicle object from database using vehicle_id
                VehicleInfoBL objVehicleInfo = VehicleInfoBL.getDataId(iVehicleId);
                if (objVehicleInfo != null)
                {
                    if (!String.IsNullOrEmpty(objImportData.Style))
                    {
                        objVehicleInfo.strStyle = objImportData.Style;
                    }

                    if (!String.IsNullOrEmpty(objImportData.Color))
                    {
                        objVehicleInfo.strColor = objImportData.Color;
                    }

                    if (!String.IsNullOrEmpty(objImportData.Paint_Code))
                    {
                        objVehicleInfo.strPaintCode = objImportData.Paint_Code;
                    }

                    if (!String.IsNullOrEmpty(objImportData.VIN))
                    {
                        objVehicleInfo.strVIN = objImportData.VIN;
                    }

                    if (!String.IsNullOrEmpty(objImportData.EstimatorName.Trim()))
                    {
                        objVehicleInfo.strEstimatorName = objImportData.EstimatorName;
                    }

                    if (!String.IsNullOrEmpty(objImportData.License))
                    {
                        objVehicleInfo.strLicense = objImportData.License;
                    }

                    return(objVehicleInfo.Save());
                }
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex, SummitShopApp.Utility.Constants.ExceptionPolicy);
            }
            return(false);
        }
Example #12
0
        public VehicleInfoBL SaveVehicleinfo(VehicleInfoBL objVehicleInfo, ImportData objImportData, UserBL objUser)
        {
            objVehicleInfo.iUserId          = objUser.ID;
            objVehicleInfo.strYear          = objImportData.Year;
            objVehicleInfo.strMake          = objImportData.Make;
            objVehicleInfo.strModel         = objImportData.Model;
            objVehicleInfo.strStyle         = objImportData.Style;
            objVehicleInfo.strColor         = objImportData.Color;
            objVehicleInfo.strPaintCode     = objImportData.Paint_Code;
            objVehicleInfo.strVIN           = objImportData.VIN;
            objVehicleInfo.strEstimatorName = objImportData.EstimatorName.Trim();
            objVehicleInfo.strLicense       = objImportData.License;
            DateTime dtProductionDate;

            objVehicleInfo.dtProductionDate = DateTime.TryParse("", out dtProductionDate) ? dtProductionDate : (Nullable <DateTime>)null;
            objVehicleInfo.bIsUsing         = true;
            objVehicleInfo.Save();
            return(objVehicleInfo);
        }
Example #13
0
        public void LoadDefaultValues()
        {
            //Load employees
            EmployeeBL e            = new EmployeeBL();
            var        employeelist = e.GetEmployeelist();

            foreach (var elist in employeelist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = elist.FirstName;
                item.Value = elist.EmployeeID;
                ddlEmployees.Items.Add(item);
            }

            //Load Vehicle Model Name
            VehicleInfoBL v     = new VehicleInfoBL();
            var           vlist = v.GetAllVehicleInfo();

            foreach (var vl in vlist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = vl.ModelName;;
                item.Value = vl.VehicleInfoID;
                ddlModel1.Items.Add(item);
                ddlModel2.Items.Add(item);
                ddlModel3.Items.Add(item);
            }

            //Load Colors
            ddlColor.DataSource = GlobalSetup.colors;

            //Load Status
            var slist = v.GetVehicleSalesStatus(string.Empty);

            foreach (var vl in slist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = vl.Description;;
                item.Value = vl.VehicleSalesStatusID;
                ddlStatus.Items.Add(item);
            }
        }
Example #14
0
 private void ddlModelName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlModelName.SelectedIndex != -1)
     {
         VehicleInfoBL bl   = new VehicleInfoBL();
         ComboboxItem  item = (ComboboxItem)ddlModelName.SelectedItem;
         if (item != null)
         {
             var vehicleinfo = bl.GetVehicleInfo(Convert.ToInt32(item.Value));
             txtShowRoomPrice.Text  = vehicleinfo.ExShowRoomPrice.ToString();
             txtLTRTOtherExp.Text   = vehicleinfo.LT_RT_OtherExp.ToString();
             txtInsurancePrice.Text = vehicleinfo.InsurancePrice.ToString();
             txtMarginPrice.Text    = vehicleinfo.MarginPrice.ToString();
             txt50Margin.Text       = vehicleinfo.Margin50.ToString();
             txt70Margin.Text       = vehicleinfo.Margin70.ToString();
             txtWarranty.Text       = vehicleinfo.WarrantyPrice.ToString();
             txtOnRoadPrice.Text    = vehicleinfo.OnRoadPrice.ToString();
         }
     }
 }
Example #15
0
        private void PopulateVehicletype(int VehicleInfoID)
        {
            VehicleInfoBL obj         = new VehicleInfoBL();
            var           vehicleInfo = obj.GetVehicleInfo(VehicleInfoID);
            var           vehicleType = obj.GetVehicleTypes().Where(vt => vt.VehicleTypeID == vehicleInfo.VehicleTypeID).FirstOrDefault();
            ComboboxItem  selitem     = new ComboboxItem();

            selitem.Text           = vehicleType.Description;
            selitem.Value          = vehicleType.VehicleTypeID;
            ddlVehicleType.Text    = selitem.Text;
            txtModelCode.Text      = vehicleInfo.ModelCode;
            txtModelName.Text      = vehicleInfo.ModelName;
            txtShowRoomPrice.Text  = vehicleInfo.ExShowRoomPrice.ToString();
            txtLTRTOtherExp.Text   = vehicleInfo.LT_RT_OtherExp.ToString();
            txtInsurancePrice.Text = vehicleInfo.InsurancePrice.ToString();
            txtOnRoadPrice.Text    = vehicleInfo.OnRoadPrice.ToString();
            txtMarginPrice.Text    = vehicleInfo.MarginPrice.ToString();
            txt50Margin.Text       = vehicleInfo.Margin50.ToString();
            txt70Margin.Text       = vehicleInfo.Margin70.ToString();
            txtWarranty.Text       = vehicleInfo.WarrantyPrice.ToString();
        }
Example #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ddlVehicleType.SelectedIndex == -1 || txtModelName.Text == "" || txtLTRTOtherExp.Text == "" || txtMarginPrice.Text == "" || txt70Margin.Text == "" || txtModelCode.Text == "" || txtShowRoomPrice.Text == "" || txtOnRoadPrice.Text == "" || txt50Margin.Text == "" || txtInsurancePrice.Text == "" || txtWarranty.Text == "")
            {
                MyMessageBox.ShowBox("Please Enter All Mandatory Fields!!!");
                return;
            }
            VehicleInfoDTO info    = new VehicleInfoDTO();
            var            selItem = (ComboboxItem)ddlVehicleType.SelectedItem;

            info.VehicleInfoID   = _vehicleInfoID;
            info.VehicleTypeID   = Convert.ToInt32(selItem.Value);
            info.ModelCode       = txtModelCode.Text;
            info.ModelName       = txtModelName.Text;
            info.ExShowRoomPrice = Convert.ToInt32(txtShowRoomPrice.Text);
            info.LT_RT_OtherExp  = Convert.ToInt32(txtLTRTOtherExp.Text);
            info.InsurancePrice  = Convert.ToInt32(txtInsurancePrice.Text);
            info.OnRoadPrice     = Convert.ToInt32(txtOnRoadPrice.Text);
            info.MarginPrice     = Convert.ToInt32(txtMarginPrice.Text);
            info.Margin50        = Convert.ToInt32(txt50Margin.Text);
            info.Margin70        = Convert.ToInt32(txt70Margin.Text);
            info.CreatedDate     = System.DateTime.Now;
            info.CreatedBy       = GlobalSetup.Userid;
            info.ModifiedDate    = System.DateTime.Now;
            info.WarrantyPrice   = Convert.ToInt32(txtWarranty.Text);
            VehicleInfoBL viBL = new VehicleInfoBL();
            var           flag = viBL.SaveVehicleInfo(info, _mode);

            if (flag)
            {
                MyMessageBox.ShowBox("Vehicle Information Saved", "Vehicle Info");
                Clear();
            }
            else
            {
                MyMessageBox.ShowBox("Vehicle Information Failed to Save", "Vehicle Info");
            }
        }
Example #17
0
        private void LoadDefaultValues()
        {
            //Load Status
            VehicleInfoBL v          = new VehicleInfoBL();
            string        searchMode = "";

            if (_mode != "")
            {
                searchMode = "ALL";
            }
            var slist = v.GetVehicleSalesStatus(searchMode);

            ddlStatus.Items.Clear();
            foreach (var vl in slist)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = vl.Description;;
                item.Value = vl.VehicleSalesStatusID;
                ddlStatus.Items.Add(item);
            }
            if (ddlStatus.Items.Count > 0)
            {
                ddlStatus.SelectedIndex = 0;
            }

            VehicleBookingFollowUpBL ef = new VehicleBookingFollowUpBL();

            dgFollowup.DataSource = ef.GetVehicleBookingFollowUp(Convert.ToDateTime(dtStartDate.Text), Convert.ToDateTime(dtEndDate.Text), 1) //default status open
                                    .ToList();

            if (dgFollowup.RowCount > 0)
            {
                btnEDIT.Enabled = true;
            }
            else
            {
                btnEDIT.Enabled = false;
            }

            if (_mode == "REPORTDELIVERY" || _mode == "REPORTBOOKING" || _mode == "INVOICE" || _mode == "MARGIN")
            {
                if (_mode == "REPORTDELIVERY" || _mode == "INVOICE" || _mode == "MARGIN")
                {
                    ddlStatus.SelectedIndex = 4; //Delivery
                }
                else if (_mode == "REPORTBOOKING")
                {
                    ddlStatus.SelectedIndex = 0; //OPen - Booking Status
                }
                label5.Visible    = false;
                ddlStatus.Visible = false;
                SearchEvent();
                btnEDIT.Visible     = false;
                btnDownload.Visible = true;

                if (_mode == "MARGIN")
                {
                    btnEDIT.Visible        = true;
                    lblInvoiceType.Visible = true;
                    ddlInvoiceType.Visible = true;
                }
            }
        }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Boolean       bResult        = false;
            VehicleInfoBL objVehicleInfo = new VehicleInfoBL();

            try
            {
                String strPhoneId  = String.Empty;
                String strPhoneId1 = String.Empty;

                if (!String.IsNullOrEmpty(Request.QueryString["ShopID"]))
                {
                    if (Request.QueryString["User_ID"] != null)
                    {
                        strPhoneId1 = Request.QueryString["User_ID"];
                    }
                    else if (Request.Form["User_ID"] != null)
                    {
                        strPhoneId1 = Request.Form["User_ID"];
                    }
                    if (!Int32.TryParse(Security.DecodeNumbers(Request.QueryString["ShopID"]), out iShopID))
                    {
                        return;
                    }
                }
                else
                {
                    if (Request.QueryString["User_ID"] != null)
                    {
                        strPhoneId = Request.QueryString["User_ID"];
                    }
                    else if (Request.Form["User_ID"] != null)
                    {
                        strPhoneId = Request.Form["User_ID"];
                    }
                }
                UserBL objUser = null;
                if (!String.IsNullOrEmpty(strPhoneId))
                {
                    //if phone user id is found
                    objUser = UserBL.getDataByPhoneId(strPhoneId);
                }
                else
                {
                    MyCustomerBL objMyCustomer = MyCustomerBL.getDataByShopIdNPhone(iShopID, strPhoneId1);
                    if (objMyCustomer != null)
                    {
                        objUser = UserBL.getByActivityId(objMyCustomer.iUserId.Value);
                    }
                }
                if (objUser != null)
                {
                    String strUserName = String.Empty;
                    String strPhone    = String.Empty;

                    if (string.IsNullOrEmpty(objUser.strUserName))
                    {
                        if (Request.QueryString["Phone_Owner_Name"] != null)
                        {
                            objUser.strUserName = Request.QueryString["Phone_Owner_Name"];
                        }
                        else if (Request.Form["Phone_Owner_Name"] != null && !string.IsNullOrEmpty(Request.Form["Phone_Owner_Name"].ToString()))
                        {
                            objUser.strUserName = Request.Form["Phone_Owner_Name"];
                        }
                    }

                    if (Request.QueryString["Current_Phone_Number"] != null)
                    {
                        strPhone = Request.QueryString["Current_Phone_Number"];
                    }
                    else if (Request.Form["Current_Phone_Number"] != null)
                    {
                        strPhone = Request.Form["Current_Phone_Number"];
                    }

                    String        strPhoneNumber = strPhone;
                    StringBuilder strNewNumber   = new StringBuilder();
                    foreach (char c in strPhoneNumber)
                    {
                        if (Char.IsNumber(c))
                        {
                            strNewNumber.Append(c);
                        }
                    }


                    objUser.strPhone = String.IsNullOrEmpty(strPhone) ? objUser.strPhone : strPhone;

                    //if (!String.IsNullOrEmpty(strUserName) && objUser.strFirstName != strUserName)
                    //{
                    //    objUser.strFirstName = strUserName;
                    //}
                    objUser.Save();

                    objVehicleInfo.iUserId = objUser.ID;

                    if (Request.QueryString["Model"] != null && Request.QueryString["Model"] != "undefined")
                    {
                        objVehicleInfo.strModel = Request.QueryString["Model"].ToString();
                    }
                    else if (Request.Form["Model"] != null && Request.Form["Model"] != "undefined")
                    {
                        objVehicleInfo.strModel = Request.Form["Model"].ToString();
                    }

                    if (Request.QueryString["Make"] != null && Request.QueryString["Make"] != "undefined")
                    {
                        objVehicleInfo.strMake = Request.QueryString["Make"].ToString();
                    }
                    else if (Request.Form["Make"] != null && Request.Form["Make"] != "undefined")
                    {
                        objVehicleInfo.strMake = Request.Form["Make"].ToString();
                    }

                    if (Request.QueryString["Year"] != null && Request.QueryString["Year"] != "undefined")
                    {
                        objVehicleInfo.strYear = Request.QueryString["Year"].ToString();
                    }
                    else if (Request.Form["Year"] != null && Request.Form["Year"] != "undefined")
                    {
                        objVehicleInfo.strYear = Request.Form["Year"].ToString();
                    }

                    if (Request.QueryString["OtherInfo"] != null && Request.QueryString["OtherInfo"] != "undefined")
                    {
                        objVehicleInfo.strOtherInfo = Request.QueryString["OtherInfo"].ToString();
                    }
                    else if (Request.Form["OtherInfo"] != null && Request.Form["OtherInfo"] != "undefined")
                    {
                        objVehicleInfo.strOtherInfo = Request.Form["OtherInfo"].ToString();
                    }

                    if (Request.QueryString["IsUsing"] != null && Request.QueryString["IsUsing"] != "undefined")
                    {
                        objVehicleInfo.bIsUsing = Convert.ToBoolean(Request.QueryString["IsUsing"]);
                    }
                    else if (Request.Form["IsUsing"] != null && Request.Form["IsUsing"] != "undefined")
                    {
                        objVehicleInfo.bIsUsing = Convert.ToBoolean(Request.Form["IsUsing"]);
                    }

                    if (objVehicleInfo.bIsUsing != null)
                    {
                        if (Convert.ToBoolean(objVehicleInfo.bIsUsing))
                        {
                            List <VehicleInfoBL> objUserVehicles = VehicleInfoBL.getDataByUserId(objUser.ID);
                            if (objUserVehicles != null)
                            {
                                foreach (VehicleInfoBL objTemp in objUserVehicles)
                                {
                                    if (objTemp.strMake.Equals(objVehicleInfo.strMake) && objTemp.strModel.Equals(objVehicleInfo.strModel) && objTemp.strYear.Equals(objVehicleInfo.strYear))
                                    {
                                        objVehicleInfo          = objTemp;
                                        objVehicleInfo.bIsUsing = true;
                                    }
                                    else
                                    {
                                        objTemp.bIsUsing = false;
                                        objTemp.Save();
                                    }
                                }
                            }
                        }
                    }
                    if (objVehicleInfo.Save())
                    {
                        if (Cache["CommunicationList"] != null)
                        {
                            Cache.Remove("CommunicationList");
                        }
                        if (Cache["OpportunityList"] != null)
                        {
                            Cache.Remove("OpportunityList");
                        }
                        if (Cache["RepairProspect"] != null)
                        {
                            Cache.Remove("RepairProspect");
                        }
                        if (Cache["EmailMarketing"] != null)
                        {
                            Cache.Remove("EmailMarketing");
                        }
                        if (Cache["TextMarketing"] != null)
                        {
                            Cache.Remove("TextMarketing");
                        }
                        bResult = true;
                    }
                }
            }
            catch (Exception ex)
            {
                bResult = true;
            }

            XmlDocument  xmlDoc = new XmlDocument();
            MemoryStream stream = new MemoryStream();
            //XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII);
            XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.UTF8);

            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement("VehicleInformation");
            xmlWriter.WriteElementString("Status", bResult ? "Success" : "Fail");
            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            byte[] byteArray = stream.ToArray();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "filename=MyExportedFile.xml");
            HttpContext.Current.Response.AppendHeader("Content-Length", byteArray.Length.ToString());
            HttpContext.Current.Response.ContentType = "text/xml";
            HttpContext.Current.Response.BinaryWrite(byteArray);
        }
Example #19
0
        private void LoadDefaultValues()
        {
            VehicleInfoBL obj = new VehicleInfoBL();

            dgCutomerInfo.DataSource = obj.GetAllVehicleInfo();
        }
Example #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                String strPhoneId = String.Empty;
                String strImage   = String.Empty;
                String strNewApp  = String.Empty;

                if (!String.IsNullOrEmpty(Request.QueryString["ShopID"]))
                {
                    if (!Int32.TryParse(Security.DecodeNumbers(Request.QueryString["ShopID"]), out iShopID))
                    {
                        return;
                    }
                }
                //else
                //{
                //    Int32.TryParse(strNewApp, out iShopID);
                //}


                if (Request.QueryString["User_Id"] != null)
                {
                    strPhoneId = Request.QueryString["User_Id"];
                    strNewApp  = Request.QueryString["N"];
                }
                else if (Request.Form["User_Id"] != null)
                {
                    strPhoneId = Request.Form["User_Id"];
                    strNewApp  = Request.Form["N"];
                }

                //Check phone no is not empty/null
                if (!String.IsNullOrEmpty(strPhoneId))
                {
                    List <MyCustomerBL> lstMyCustomer = null;
                    UserBL objUser = null;
                    if (iShopID != 0)
                    {
                        MyCustomerBL objMyCustomer = null;
                        lstMyCustomer = MyCustomerBL.getDataByShopIDandMobileList(iShopID, strPhoneId);

                        if (lstMyCustomer != null && lstMyCustomer.Count > 0)
                        {
                            objMyCustomer = lstMyCustomer.Find(t => t.strStatusOfVehicle.ToLower().Trim() != Constants.VEHICLE_STATUS_DELIVERED.ToLower().Trim());
                        }

                        if (objMyCustomer != null)
                        {
                            if (!String.IsNullOrEmpty(objMyCustomer.strStatusOfVehicle))
                            {
                                //If status is delivered then dont show details for this customer
                                if (objMyCustomer.strStatusOfVehicle.ToLower().Trim() == Constants.VEHICLE_STATUS_DELIVERED.ToLower().Trim())
                                {
                                    return;
                                }
                            }



                            objUser = UserBL.getByActivityId(objMyCustomer.iUserId.Value);
                            //remove diffrent name customers, there should be only same name customers
                            lstMyCustomer.RemoveAll(p1 => p1.strUserName != objMyCustomer.strUserName);
                        }

                        ////Find User using phone no & shopID
                        //MyCustomerBL objMyCustomer = MyCustomerBL.getDataByShopIdNPhone(iShopID, strPhoneId);
                        //if (objMyCustomer != null)
                        //{
                        //    objUser = UserBL.getByActivityId(objMyCustomer.iUserId.Value);

                        //}
                    }
                    else
                    {
                        string[] strPhones = strPhoneId.Split('_');

                        //find user using phoneID for private label
                        if (strPhones.Length == 3)
                        {
                            objUser = UserBL.getDataByPhoneId(strPhoneId);
                        }
                        else
                        {
                            objUser = UserBL.GetDataByPhoneNumber(strPhones[0]);
                        }
                    }
                    if (objUser != null)
                    {
                        List <VehicleInfoBL> lstVehicleInfo = null;
                        if (lstMyCustomer != null)
                        {
                            lstVehicleInfo = new List <VehicleInfoBL>();
                            foreach (MyCustomerBL objMyCustomerBL in lstMyCustomer)
                            {
                                //get Customer's Vehicle Details
                                lstVehicleInfo.AddRange(VehicleInfoBL.getDataByUserId(objMyCustomerBL.iUserId.Value));
                            }
                        }
                        else
                        {
                            //if user found get vehicle info
                            lstVehicleInfo = VehicleInfoBL.getDataByUserId(objUser.ID);
                        }
                        if (lstVehicleInfo != null)
                        {
                            foreach (var objVehicleInfo in lstVehicleInfo)
                            {
                                //get count of vehicle media links newly uploaded
                                iCount += VehicleMediaLinkBL.getNewLinkCountByVehicleID(objVehicleInfo.ID);
                                //get Vehicle status Changed
                                UserVehicleStatusBL objUserVehicleStatusBL = UserVehicleStatusBL.getDataByVehicleId(objVehicleInfo.ID);
                                if (objUserVehicleStatusBL != null && objUserVehicleStatusBL.bIsRead.HasValue && objUserVehicleStatusBL.bIsRead.Value == 1)
                                {
                                    strVehicleStatus = "true";
                                }
                            }
                            ////Find current vehicle info
                            //VehicleInfoBL objVehicleInfo = lstVehicleInfo.Find(p => p.bIsUsing == true || p.bIsUsing == null);
                            //if (objVehicleInfo != null)
                            //{
                            //    //get count of vehicle media links newly uploaded
                            //    iCount = VehicleMediaLinkBL.getNewLinkCountByVehicleID(objVehicleInfo.ID);
                            //    //get Vehicle status Changed
                            //    UserVehicleStatusBL objUserVehicleStatusBL = UserVehicleStatusBL.getDataByVehicleId(objVehicleInfo.ID);
                            //    if (objUserVehicleStatusBL != null && objUserVehicleStatusBL.bIsRead.HasValue && objUserVehicleStatusBL.bIsRead.Value == 1)
                            //        strVehicleStatus = "true";
                            //}
                        }
                    }
                    //for sending info to html5 app using xml
                    XmlDocument  xmlDoc = new XmlDocument();
                    MemoryStream stream = new MemoryStream();
                    //XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII);
                    XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.UTF8);
                    xmlWriter.WriteStartDocument();
                    xmlWriter.WriteStartElement("VehicleMediaCount");
                    //count for newly uploaded vehiclemedia links
                    xmlWriter.WriteElementString("Count", String.IsNullOrEmpty(iCount.ToString()) ? "" : iCount.ToString());
                    //check vehicleStatus
                    xmlWriter.WriteElementString("VehicleStatus", String.IsNullOrEmpty(strVehicleStatus) ? "" : strVehicleStatus);


                    xmlWriter.WriteEndElement();
                    xmlWriter.WriteEndDocument();
                    xmlWriter.Flush();
                    byte[] byteArray = stream.ToArray();
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.AppendHeader("Content-Disposition", "filename=MyExportedFile.xml");
                    HttpContext.Current.Response.AppendHeader("Content-Length", byteArray.Length.ToString());
                    HttpContext.Current.Response.ContentType = "text/xml";
                    HttpContext.Current.Response.BinaryWrite(byteArray);
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #21
0
        public void SaveVehicleStatus(VehicleInfoBL objVehicleInfo, ImportData objImportData, UserBL objUser, String strShopId)
        {
            String              strStatus                = String.Empty;
            VehicleStatusBL     objTemp                  = null;
            Boolean             bIsStatusChanged         = false;
            int                 iVehicleStatusId         = 0;
            UserVehicleStatusBL objCustomerVehicleStatus = new UserVehicleStatusBL();
            DateTime            dtOut;

            objCustomerVehicleStatus.iUserId                = objUser.ID;
            objCustomerVehicleStatus.iVehicleId             = objVehicleInfo.ID;
            objCustomerVehicleStatus.dtDateIn               = DateTime.TryParse(objImportData.Scheduled_In_Date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            objCustomerVehicleStatus.dtDateOut              = DateTime.TryParse(objImportData.Target_Delivery_Date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            objCustomerVehicleStatus.dtActual_Delivery_Date = DateTime.TryParse(objImportData.Actual_Delivery_Date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            objCustomerVehicleStatus.dtFile_Import_Date     = DateTime.TryParse(objImportData.File_Import_date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            objCustomerVehicleStatus.dtFile_Import_Time     = DateTime.TryParse(objImportData.File_Import_Time, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            objCustomerVehicleStatus.dtRepair_Start_Date    = DateTime.TryParse(objImportData.Repair_Start_Date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            objCustomerVehicleStatus.dtDeliveryDate         = DateTime.TryParse(objImportData.Actual_Delivery_Date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            objCustomerVehicleStatus.iETA_Hours             = Convert.ToInt32(objImportData.ETA_Hours);
            objCustomerVehicleStatus.iRO_Hours              = Convert.ToInt32(objImportData.RO_Hours);
            objCustomerVehicleStatus.strFile_Status         = objImportData.File_Status;

            System.Collections.Generic.List <SummitShopApp.BL.VehicleStatusBL> lstVehicleStatus = new List <SummitShopApp.BL.VehicleStatusBL>();
            lstVehicleStatus = VehicleStatusBL.getDataByShopId(Convert.ToInt32(strShopId));

            DateTime?dtImportDate         = DateTime.TryParse(objImportData.File_Import_date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            DateTime?dtRepairStartDate    = DateTime.TryParse(objImportData.Repair_Start_Date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            DateTime?dtActualDeliveryDate = DateTime.TryParse(objImportData.Actual_Delivery_Date, out dtOut) ? dtOut : (Nullable <DateTime>)null;
            DateTime dtToday = DateTime.Today;

            //Update Vehicle Status depending Matching Date

            if (dtToday.Date.Equals(dtImportDate))
            {
                strStatus        = Constants.IMPORTED_ESTIMATE;
                bIsStatusChanged = true;
            }
            if (dtToday.Date.Equals(dtRepairStartDate))
            {
                strStatus        = Constants.INPROCESS_REPAIR;
                bIsStatusChanged = true;
            }
            if (dtToday.Date.Equals(dtActualDeliveryDate))
            {
                strStatus        = Constants.DELIVERED;
                bIsStatusChanged = true;
            }

            if (!bIsStatusChanged)
            {
                strStatus = Constants.UNSOLD_ESTIMATE;
            }

            if (lstVehicleStatus.Count > 0)
            {
                objTemp = lstVehicleStatus.Find(vs => vs.strVehicleStatus == strStatus);
            }
            if (objTemp != null)
            {
                objTemp          = lstVehicleStatus.Find(vs => vs.strVehicleStatus == strStatus);
                iVehicleStatusId = objTemp.ID;
                objCustomerVehicleStatus.iVehicleStatusId        = iVehicleStatusId;
                objCustomerVehicleStatus.dtLastUpdatedStatusDate = DateTime.Now;
                if (String.Equals(strStatus, Constants.DELIVERED))
                {
                    objCustomerVehicleStatus.dtDeliveryDate = DateTime.Now;
                }
                if (strStatus == Constants.UNSOLD_ESTIMATE || strStatus == Constants.DELIVERED)
                {
                    objUser.bIsShowEmailMarketing = true;
                    objUser.bIsShowTextMarketing  = true;
                    objUser.Save();
                    MarketingUsers objMarUser = MarketingUsers.getDataByShopAndUserId(Convert.ToInt32(strShopId), Convert.ToInt32(objUser.ID));
                    if (objMarUser != null)
                    {
                        objMarUser.bisShowInProcess = false;
                        objMarUser.Save();
                    }
                }
            }
            else
            {
                VehicleStatusBL _objVehicleStatus = new VehicleStatusBL();
                _objVehicleStatus.strVehicleStatus = strStatus;
                _objVehicleStatus.strMessage       = String.Empty;
                _objVehicleStatus.iShopId          = Convert.ToInt32(strShopId);
                _objVehicleStatus.bSMS             = false;
                _objVehicleStatus.bIsActive        = false;
                _objVehicleStatus.bEmail           = false;
                if (_objVehicleStatus.Save())
                {
                    objCustomerVehicleStatus.iVehicleStatusId        = _objVehicleStatus.ID;
                    objCustomerVehicleStatus.dtLastUpdatedStatusDate = DateTime.Now;
                }
            }
            objCustomerVehicleStatus.Save();
        }