Example #1
0
        public int Add(t_ES_ElecPrice model)
        {
            string sql = string.Format(@"INSERT INTO [dbo].[t_ES_ElecPrice]
           ([IndID]
           ,[BigIndTypeID]
           ,[VID]
           ,[FDRID]
           ,[PVFID]
           ,[ElecPrice]
           ,[WaterConstr]
           ,[FarmNet]
           ,[renewable]
           ,[reservoir]
           ,[Demand]
           ,[capacity]
           ,[UID])
     VALUES
           ({0}
           ,{1}
           ,{2}
           ,{3}
           ,{4}
           ,{5}
           ,{6}
           ,{7}
           ,{8}
           ,{9}
           ,{10}
           ,{11}
           ,{12})", model.indID, model.BigIndTypeID == null ? 0 : model.BigIndTypeID, model.VID, model.FDRID, model.PVFID, model.ElecPrice, model.WaterConstr == null ? 0 : model.WaterConstr, model.FarmNet == null ? 0 : model.FarmNet, model.renewable == null ? 0 : model.renewable, model.reservoir == null ? 0 : model.reservoir, model.Demand == null ? 0 : model.Demand, model.capacity == null ? 0 : model.capacity, model.UID == null ? 0 : model.UID);

            return(ExecuteSqlCommand(sql));
        }
Example #2
0
        public int Update(t_ES_ElecPrice model)
        {
            int n = 0;

            try
            {
                n = _dbFactory.elecPrice.Update(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(n);
        }
Example #3
0
        public int Update(t_ES_ElecPrice model)
        {
            string sql = $@"UPDATE [dbo].[t_ES_ElecPrice]
   SET [IndID] = {model.indID}
      ,[BigIndTypeID] = {(model.BigIndTypeID == null ? 0 : model.BigIndTypeID)}
      ,[VID] = {model.VID}
      ,[FDRID] = {model.FDRID}
      ,[PVFID] = {model.PVFID}
      ,[ElecPrice] = {model.ElecPrice}
      ,[WaterConstr] = {(model.WaterConstr == null ? 0 : model.WaterConstr)}
      ,[FarmNet] = {(model.FarmNet == null ? 0 : model.FarmNet)}
      ,[renewable] = {(model.renewable == null ? 0 : model.renewable)}
      ,[reservoir] = {(model.reservoir == null ? 0 : model.reservoir)}
      ,[Demand] = {(model.Demand == null ? 0 : model.Demand)}
      ,[capacity] = {(model.capacity == null ? 0 : model.capacity)}
      ,[UID]={(model.UID == null ? 0 : model.UID)}
 WHERE id={model.id}";

            return(ExecuteSqlCommand(sql));
        }