Ejemplo n.º 1
0
        public int Insert(LendingCarsModel model)
        {
            int Id = 0;

            DataLayer.AtsTotalNewDataContext context = new DataLayer.AtsTotalNewDataContext();
            string sal       = (Core.StaticData.DateNow.Date.Split('/')[0]).Substring(2);
            string DateA     = model.DateA;
            int    F_AgnID   = (int)model.F_AgnID;
            int?   FlgTaahod = (model.FlgTaahod == true) ? 1 : 0;
            string sql       = @"DECLARE		@Out int
                        EXEC	  [sale].[STP_T00050061];1
		                @sal ={0},
	                    @DateA ={1},
	                    @F_AgnID= {2},
	                    @FlgTaahod ={3},
	                    @Out = @Out OUTPUT
                        SELECT	@Out as N'@Out'";

            Id = context.ExecuteQuery <int>(sql,
                                            sal,
                                            DateA,
                                            F_AgnID,
                                            FlgTaahod).FirstOrDefault();
            return(Id);
        }
Ejemplo n.º 2
0
        public LendingCarsModel GetById(int id)
        {
            DataLayer.AtsTotalNewDataContext context = new DataLayer.AtsTotalNewDataContext();
            LendingCarsModel model = new LendingCarsModel();
            var query = (from t in context.T00050061s
                         where (t.IDrequstAmani == id)
                         select t).FirstOrDefault();

            model.code      = query.code;
            model.DateA     = query.DateA;
            model.F_AgnID   = query.F_AgnID;
            model.FlgTaahod = Convert.ToBoolean(query.FlgTaahod);
            model.TrackID   = (int?)query.TrackID;
            return(model);
        }
Ejemplo n.º 3
0
        public Boolean Update(LendingCarsModel model)
        {
            Boolean Result = false;

            DataLayer.AtsTotalNewDataContext context = new DataLayer.AtsTotalNewDataContext();
            string DateA         = model.DateA;
            int    F_AgnID       = (int)model.F_AgnID;
            int?   FlgTaahod     = (model.FlgTaahod == true) ? 1 : 0;
            int    IDrequstAmani = model.IDrequstAmani;
            string sql           = @"EXEC	  [sale].[STP_T00050061];2
		                @IDrequstAmani ={0},
	                    @DateA ={1},
	                    @F_AgnID= {2},
	                    @FlgTaahod ={3}"    ;

            context.ExecuteCommand(sql,
                                   IDrequstAmani,
                                   DateA,
                                   F_AgnID,
                                   FlgTaahod);
            return(Result);
        }