Пример #1
0
 public void InsertGraphStats(List <APISuccessResponses> apiresponse)
 {
     try
     {
         var plantDayList = dapper.Execute <bool>(StoredProcedures.PopulateAPISuccessResponses, apiresponse, null, true, null, CommandType.StoredProcedure);
     }
     catch (Exception ex)
     {
         ex.Data["MethodAndClass"] = "InsertGraphStats() in GraphRepository";
         throw ex;
     }
 }
Пример #2
0
        public void FinalRanking(IEnumerable <Ranking> ranking)
        {
            string query = $"delete from RankingTable where PlantId in ({string.Join(",",ranking.Select(x => x.PlantId).ToList())}) and Convert(nvarchar(20),CreatedOn,112) Like '%{DateTime.Now.ToString("yyyyMM")}%'";


            try
            {
                dapper.Execute <bool>(query, null, null, true, null, System.Data.CommandType.Text);
                dapper.Execute <bool>(StoredProcedures.CalculateRanking, ranking, null, true, null, System.Data.CommandType.StoredProcedure);
                Console.WriteLine("Ranks Calculated");
            }
            catch (Exception ex)
            {
                ex.Data["MethodAndClass"] = "FinalRanking() in MiscRepository";
                throw ex;
            }
        }
Пример #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            int result = DapperManager.Execute(
                "MVC5TemplateServer",
                "DELETE FROM [dbo].[User] WHERE UserID = @UserID", new { UserID = id });

            return(RedirectToAction("Index"));
        }
Пример #4
0
 public ActionResult Edit([Bind(Include = "UserID,Password,FamilyName,FirstName,Birthday,Sex,MobilePhone,PostalCode,Prefectures,City,Address1,Address2,Apartment")] User user)
 {
     if (ModelState.IsValid)
     {
         int result = DapperManager.Execute("MVC5TemplateServer", "UPDATE [dbo].[User] SET Password = @Password, FamilyName = @FamilyName, FirstName = @FirstName, Birthday = @Birthday, Sex = @Sex, MobilePhone = @MobilePhone, PostalCode = @PostalCode, Prefectures = @Prefectures, City = @City, Address1 = @Address1, Address2 = @Address2, Apartment = @Apartment WHERE UserID = @UserID", user);
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
Пример #5
0
 public void MarkPlantHistoric(string PlantId)
 {
     try
     {
         string query = $"update PlantInformation set IsHistoric=1 where PlantId= {PlantId}";
         dapper.Execute <int>(query, null, null, true, null, System.Data.CommandType.Text);
     }
     catch (Exception ex) {
         ex.Data["MethodAndClass"] = "MarkPlantHistoric() in GoodWeeRepository";
         throw ex;
     }
 }
Пример #6
0
 public void UpdateGrowWattDevicesInformation(IEnumerable <GrowWattDevice> devices)
 {
     try
     {
         if (devices.Any())
         {
             Console.WriteLine("Updating GrowWatt Devices Information");
             dapper.Execute <int>(StoredProcedures.AddOrUpdateGrowWattDeviceInformation, devices, null, true, null, System.Data.CommandType.StoredProcedure);
             Console.WriteLine("GrowWatt Devices Information Updated");
         }
         else
         {
             Console.WriteLine("GrowWatt Devices Information Not Found");
         }
     }
     catch (Exception ex)
     {
         ex.Data["MethodAndClass"] = "UpdateGrowWattDevicesInformation() in GrowWattRepository";
         throw ex;
     }
 }
Пример #7
0
        public ActionResult Create([Bind(Include = "UserID,Password,FamilyName,FirstName,Birthday,Sex,MobilePhone,PostalCode,Prefectures,City,Address1,Address2,Apartment")] User user)
        {
            if (ModelState.IsValid)
            {
                int result = DapperManager.Execute(
                    "MVC5TemplateServer",
                    "INSERT [dbo].[User] (UserID, Password, FamilyName, FirstName, Birthday, Sex, MobilePhone, PostalCode, Prefectures, City, Address1, Address2, Apartment) VALUES (@UserID, @Password, @FamilyName, @FirstName, @Birthday, @Sex, @MobilePhone, @PostalCode, @Prefectures, @City, @Address1, @Address2, @Apartment)", user);

                return(RedirectToAction("Index"));
            }
            return(View(user));
        }