public RndConsumptionType GetConsumptionById(int id)
        {
            RndConsumptionType objConsumptionType = null;

            try
            {
                objConsumptionType = objConsumption.GetConsumptionByID(id);
            }
            catch (Exception e)
            {
                e.ToString();
            }
            return(objConsumptionType);
        }
Example #2
0
        public RndConsumptionType GetConsumptionByID(int?id)
        {
            GenericFactory_EF_Consumption = new ConsumptionFactory_EF();
            RndConsumptionType objConsumption = null;

            try
            {
                objConsumption = GenericFactory_EF_Consumption.FindBy(m => m.ConsumptionTypeID == id).FirstOrDefault();
            }
            catch (Exception e)
            {
                e.ToString();
            }
            return(objConsumption);
        }
        public HttpResponseMessage DeleteConsumption(RndConsumptionType model)
        {
            int result = 0;

            try
            {
                result = objConsumption.DeleteConsumption(model);
            }
            catch (Exception e)
            {
                e.ToString();
                result = -0;
            }

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Example #4
0
        public int UpdateConsumption(RndConsumptionType model)
        {
            GenericFactory_EF_Consumption = new ConsumptionFactory_EF();
            int result = 0;

            try
            {
                model.UpdateOn = DateTime.Today;
                model.UpdatePc = HostService.GetIP();
                GenericFactory_EF_Consumption.Update(model);
                GenericFactory_EF_Consumption.Save();

                result = 1;
            }
            catch (Exception e)
            {
                e.ToString();
                result = 0;
            }
            return(result);
        }
Example #5
0
        public int SaveConsumption(RndConsumptionType model)
        {
            GenericFactory_EF_Consumption = new ConsumptionFactory_EF();
            int result = 0;

            try
            {
                int NextId = GenericFactory_EF_Consumption.getMaxVal_int("ConsumptionTypeID", "RndConsumptionType");
                model.ConsumptionTypeID = NextId;
                model.CreateOn          = DateTime.Today;
                model.CreatePc          = HostService.GetIP();
                GenericFactory_EF_Consumption.Insert(model);
                GenericFactory_EF_Consumption.Save();
                result = 1;
            }
            catch (Exception ex)
            {
                ex.ToString();
                result = 0;
            }
            return(result);
        }
Example #6
0
        public int DeleteConsumption(RndConsumptionType model)
        {
            GenericFactory_EF_Consumption = new ConsumptionFactory_EF();
            int result = 0;

            try
            {
                model.DeleteOn  = DateTime.Today;
                model.DeleteBy  = model.DeleteBy;
                model.IsDeleted = true;
                GenericFactory_EF_Consumption.Update(model);
                GenericFactory_EF_Consumption.Save();

                result = 1;
            }
            catch (Exception e)
            {
                e.ToString();
                result = 0;
            }
            return(result);
        }