Exemplo n.º 1
0
        /// <summary>
        /// Verify Truck Make Exists or not by truckMakeId and truckMakeName
        /// </summary>
        /// <param name="truckMakeId">Int32:truckMakeId</param>
        /// <param name="truckMakeName">string:truckMakeName</param>
        /// <returns></returns>
        public bool TruckMakeExists(int truckMakeId, string truckMakeName)
        {
            TruckMakeDTO objTruckMakeDTO = new TruckMakeDTO();
            if (truckMakeId == 0)
            {
                AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<IGenericRepository<truckmake>>()
                    .GetSingle(item => item.TruckMake_Name == truckMakeName
                        && item.TruckMake_IsDeleted == false), objTruckMakeDTO);
            }
            else
            {
                AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<IGenericRepository<truckmake>>()
                    .GetSingle(item => item.TruckMake_Name == truckMakeName
                        && item.TruckMake_IsDeleted == false && item.TruckMake_Id != truckMakeId), objTruckMakeDTO);
            }

            if (objTruckMakeDTO.TruckMake_Id == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get Truck Make By truckMakeId
        /// </summary>
        /// <param name="truckMakeId">Int32:truckMakeId</param>
        /// <returns></returns>
        public TruckMakeDTO GetTruckMakeById(int truckMakeId)
        {
            TruckMakeDTO objTruckMakeDTO = new TruckMakeDTO();
            AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<IGenericRepository<truckmake>>()
                .GetSingle(item => item.TruckMake_Id == truckMakeId), objTruckMakeDTO);

            //return value
            return objTruckMakeDTO;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Save And Update Truck Make
        /// </summary>
        /// <param name="truckMakeDetail"></param>
        /// <returns></returns>
        public int SaveAndUpdateTruckMake(TruckMakeDTO truckMakeDetail)
        {
            truckmake truckmakeEntity = new truckmake();
            AutoMapper.Mapper.Map(truckMakeDetail, truckmakeEntity);

            if (truckMakeDetail.TruckMake_Id == 0)
            {
                ESalesUnityContainer.Container.Resolve<IGenericRepository<truckmake>>().Save(truckmakeEntity);
            }
            else
            {
                ESalesUnityContainer.Container.Resolve<IGenericRepository<truckmake>>().Update(truckmakeEntity);
            }

            //return the value
            return truckmakeEntity.TruckMake_Id;
        }
    protected void grdTruckMake_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals(Globals.GridCommandEvents.ADDNEW))
        {
            if (Page.IsValid)
            {
                GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                TruckMakeDTO truckMakeDetails = new TruckMakeDTO();

                truckMakeDetails.TruckMake_Name = ((TextBox)row.FindControl("txtNewTruckMakeName")).Text;
                truckMakeDetails.TruckMake_TruckWheeler_Id = Convert.ToInt32(((DropDownList)row.FindControl("ddlNewTruckWheeler")).SelectedValue);
                truckMakeDetails.TruckMake_TruckCC_Id = Convert.ToInt32(((DropDownList)row.FindControl("ddlNewTruckCarryCapacity")).SelectedValue);
                truckMakeDetails.TruckMake_CreatedDate = DateTime.Now;
                truckMakeDetails.TruckMake_CreatedBy = GetCurrentUserId();
                truckMakeDetails.TruckMake_LastUpdatedDate = DateTime.Now;

                int truckId = ESalesUnityContainer.Container.Resolve<ITruckMakeService>().SaveAndUpdateTruckMake(truckMakeDetails);
				ucMessageBoxForGrid.ShowMessage(Messages.TruckMakeSavedSuccessfully);
            }
        }
    }
Exemplo n.º 5
0
 /// <summary>
 /// Get Truck Make details by truck make id
 /// </summary>
 /// <param name="truckMakeId">Int32: truck make id</param>
 /// <returns>returns truck make details if exists, else blank datatype</returns>
 public static TruckMakeDTO GetTruckMakeById(int truckMakeId)
 {
     TruckMakeDTO truckMakeDetails = new TruckMakeDTO();
     truckMakeDetails = ESalesUnityContainer.Container.Resolve<ITruckMakeService>().GetTruckMakeById(truckMakeId);
     return truckMakeDetails;
 }