<file_sep>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Epam.Task6.BACKUP_SYSTEM
{
    public partial class BACKUPSYSTEM : Form
    {
        private string pathforwatch;
        private string subpath = @"BACKUP";
        private DirectoryInfo dirInfo;
        private FileSystemWatcher fileWatcher;
        
        public BACKUPSYSTEM()
        {
            this.InitializeComponent();
            this.dirInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);

            if (!this.dirInfo.Exists)
            {
                this.dirInfo.Create();
            }

            this.dirInfo.CreateSubdirectory(this.subpath);
        }

        private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs)
        {
            DirectoryInfo dir = new DirectoryInfo(sourceDirName);

            if (!dir.Exists)
            {
                throw new DirectoryNotFoundException(
                    "Source directory does not exist or could not be found: "
                    + sourceDirName);
            }

            DirectoryInfo[] dirs = dir.GetDirectories();
            if (!Directory.Exists(destDirName))
            {
                Directory.CreateDirectory(destDirName);
            }

            FileInfo[] files = dir.GetFiles();
            foreach (FileInfo file in files)
            {
                string temppath = Path.Combine(destDirName, file.Name);
                file.CopyTo(temppath, true);
            }

            if (copySubDirs)
            {
                foreach (DirectoryInfo subdir in dirs)
                {
                    string temppath = Path.Combine(destDirName, subdir.Name);
                    DirectoryCopy(subdir.FullName, temppath, copySubDirs);
                }
            }
        }

        private void RadioButton1_CheckedChanged(object sender, EventArgs e)
        {
            button1.Enabled = false;
            this.fileWatcher.EnableRaisingEvents = true;
        }

        private void RadioButton2_CheckedChanged(object sender, EventArgs e)
        {
            button1.Enabled = true;
            this.fileWatcher.EnableRaisingEvents = false;
        }

        private void Button2_Click(object sender, EventArgs e)
        {
            this.folderBrowserDialog1.ShowDialog();
            this.pathforwatch = this.folderBrowserDialog1.SelectedPath;
            if (!this.pathforwatch.Equals(string.Empty))
            {
                radioButton1.Enabled = true;
                radioButton2.Enabled = true;
                dateTimePicker1.Enabled = true;
                this.fileWatcher = new FileSystemWatcher(this.pathforwatch);
                this.fileWatcher.Changed += new FileSystemEventHandler(this.Savechanges);
                this.fileWatcher.Created += new FileSystemEventHandler(this.Savechanges);
                this.fileWatcher.Deleted += new FileSystemEventHandler(this.Savechanges);
                this.fileWatcher.Renamed += new RenamedEventHandler(this.Savechanges);
                this.fileWatcher.EnableRaisingEvents = true;
            }
        }

        private void Savechanges(object sender, FileSystemEventArgs fileSystemEventArgs)
        {
            DirectoryCopy(this.pathforwatch, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this.subpath, DateTime.Now.ToString("dd.MMMM.yyyy.HH.mm.ss")), true);
        }
 
        private void Button1_Click(object sender, EventArgs e)
        {
            int twoday = 172800;
            DateTimePicker d = dateTimePicker1;
            this.dirInfo = new DirectoryInfo(this.pathforwatch);
            TimeSpan onesec = new TimeSpan(0, 0, 0, 1);

            for (int i = 0; i < twoday; i++)
            {
                this.dateTimePicker1 = d;
                if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this.subpath, dateTimePicker1.Text)))
                {
                    foreach (FileInfo f in this.dirInfo.GetFiles())
                    {
                        f.Delete();
                    }

                    foreach (DirectoryInfo dir in this.dirInfo.GetDirectories())
                    {
                        dir.Delete(true);
                    }

                    DirectoryCopy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this.subpath, dateTimePicker1.Text), this.pathforwatch, true);
                    break;
                }
               
                if (i == twoday - 1)
                {
                    MessageBox.Show("at that time  and 2 days ago there were no changes");
                }
            }
        }

        private void BACKUPSYSTEM_Load(object sender, EventArgs e)
        {
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.USER
{
    public class USER
    {
        private string lastName;
        private string firstName;
        private string patronymic;
        private DateTime dateofBirth;
        private int age;

        public USER(string lastName, string firstName, string patronymic, DateTime dateofBirth, int age)
        {
            if ((int)(DateTime.Now.Year - dateofBirth.Year) != age)
            {
                throw new Exception("such age cannot with such date of birth");
            }

            this.lastName = lastName;
            this.firstName = firstName;
            this.patronymic = patronymic;
            this.dateofBirth = dateofBirth;
            this.age = age;
        }

        public string Getfullinf()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(this.lastName).Append(" ");
            sb.Append(this.firstName).Append(" ");
            sb.Append(this.patronymic).Append(" ");
            sb.Append(this.dateofBirth.ToString("dd.MM.yyyy")).Append(" ");
            sb.Append(this.age).Append(" ");
            return sb.ToString();
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task5.NUMBER_ARRAY_SUM
{
   public static class Program
    {
        public static int NUMBERARRAYSUM(this int[] array)
        {
            int sum = 0;

            foreach (var item in array)
            {
                sum += item;
            }

            return sum;
        }

        public static void Main(string[] args)
        {
            int[] array = { 15, 7, -5, 6, 4 };
            int sum;

            Console.WriteLine("enter an array");

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("apply our widening method and output a sum");
            sum = NUMBERARRAYSUM(array);
            Console.WriteLine(sum);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task2.NON_NEGATIVE_SUM
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = new int[10];
            Random ran = new Random();
            int sum = 0;

            Console.WriteLine("Random array");
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = ran.Next(-100, 100);
                Console.WriteLine(array[i]);
                if (array[i] > 0)
                {
                    sum += array[i];
                }
            }
            Console.WriteLine($"sum of non-negative elements = {sum}");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task2.NO_POSITIVE
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,,] array = new int[3,3,3];
            Random ran = new Random();
            for (int i = 0; i < array.GetUpperBound(0)+1; i++)
            {
                for (int j = 0; j < array.GetUpperBound(1)+1; j++)
                {
                    for (int z = 0; z < array.GetUpperBound(2)+1; z++)
                    {
                        array[i,j,z] = ran.Next(-100, 100);
                        Console.Write($"array element before conversion = {array[i, j, z]} ");
                        if (array[i, j, z] > 0)
                        {
                            array[i, j, z] = 0;
                        }
                        Console.WriteLine($" after = {array[i, j, z]}");
                    }
                }
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.CUSTOMSORTDEMO
{
    public class Program
    {
        public delegate int Comparison<T>(T first, T second);

        public static void Sort<T>(T[] a, Comparison<T> compare)
        {
            for (int i = 0; i < a.Length; i++)
            {
                for (int j = i + 1; j < a.Length; j++)
                {
                    if (compare(a[i], a[j]) > 0)
                    {
                        var temp = a[i];
                        a[i] = a[j];
                        a[j] = temp;
                    }
                }
            }
        }

        public static int Comparestring(string first, string second)
        {
            if (first.Length == second.Length)
            {
                for (int i = 0; i < first.Length; i++)
                {
                    if ((int)first[i] > (int)second[i])
                    {
                        return 1;
                    }

                    if ((int)first[i] < (int)second[i])
                    {
                        return -1;
                    }
                }

                return 0;
            }

            if (first.Length > second.Length)
            {
                return 1;
            }
            else
            {
                return -1;
            }
        }

        public static void Main(string[] args)
        {
            string[] array = { "vova", "ekaterina", "vafelnica", "kica", "ribalovIvan" };
            Console.WriteLine("enter an unsorted array");

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("apply our method and output an array");
            Sort(array, Comparestring);

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task2.AVERAGE_STRING_LENGTH
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str_array;
            int sum = 0;

            Console.WriteLine("enter the string");
            StringBuilder sb = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < sb.Length; i++)
            {
                if (Char.IsPunctuation(sb[i]))
                {
                    sb.Remove(i, 1);
                    i--;
                }
            }
            str_array = sb.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < str_array.Length; i++)
            {
                sum += str_array[i].Length;
            }
            Console.WriteLine($"average word length = {(double)sum / str_array.Length}");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.DAL.Interface;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.DAL
{
    public class UserDao : IUserDao
    {
        private static string path = System.IO.Path.GetTempPath() + "users.txt";

        public void Add(User user)
        {
            int k = 0;
            StreamWriter output = new StreamWriter(path, true);
            output.Close();

            StreamReader input = new StreamReader(path);
            string str = input.ReadToEnd();

            for (int i = 0; i < str.Length; i++)
            {
                if (str[0].Equals('1') & i == 0)
                {
                    k++;
                }

                if (i == str.Length - 1)
                {
                    break;
                }

                if (str[i].Equals((char)13) & str[i + 1].Equals((char)10))
                {
                    k++;
                }
            }

            input.Close();
            output = new StreamWriter(path, true);
            user.Id = k;
            output.WriteLine(user.ToString());
            output.Close();
        }

        public void Delete(int id)
        {
            StreamWriter output = new StreamWriter(path, true);
            output.Close();
            StreamReader input = new StreamReader(path);
            
            string str = input.ReadToEnd();
            input.Close();
            int k = 0;
            int firstchar = -1;

            for (int i = 0; i < str.Length; i++)
            {
                if (i == str.Length - 1)
                {
                    break;
                }

                if (str[i].Equals((char)13) & str[i + 1].Equals((char)10))
                {
                    if (id == 0)
                    {
                        str = str.Remove(0, i);
                        str = str.Insert(0, "delete");
                        break;
                    }

                    k++;
                    if (firstchar >= 0)
                    {
                        str = str.Remove(firstchar, i - firstchar);
                        str = str.Insert(firstchar, "\r" + "\n" + "delete");
                        break;
                    }

                    if (k == id)
                    {
                        firstchar = i;
                    }
                }
            }

            output = new StreamWriter(path, false);
            output.Write(str);
            output.Close();
        }
        
        public string GetAll()
        {
            StreamWriter output = new StreamWriter(path, true);
            output.Close();
            StreamReader input = new StreamReader(path);

            string str = input.ReadToEnd();
            input.Close();
            return str;
        }

        public string ShowAwards(int id)
        {
            string pathusersandawards = System.IO.Path.GetTempPath() + "usersandawards.txt";
            StreamWriter output = new StreamWriter(pathusersandawards, true);
            output.Close();
            StreamReader input = new StreamReader(pathusersandawards);
            string str = input.ReadToEnd();
            string idfromfile = string.Empty;
            input.Close();
            string awards = string.Empty;
            AwardDao awarddao = new AwardDao();

            for (int i = 0; i < str.Length; i++)
            {
                if ((str[0] + string.Empty).Equals(id.ToString()) & i == 0)
                {
                    awards = awarddao.GetById(int.Parse(str[i + 2] + string.Empty)) + " ";
                }

                if (i == str.Length - 2)
                {
                    break;
                }

                if (str[i].Equals((char)13) & str[i + 1].Equals((char)10))
                {
                    idfromfile = str[i + 2] + string.Empty;
                    if (idfromfile.Equals(id.ToString()))
                    {
                        awards += awarddao.GetById(int.Parse(str[i + 4] + string.Empty)) + " ";
                    }
                }
            }

            return awards;
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.VECTOR_GRAPHICS_EDITOR
{
    public class Program
    {
       public static void Main(string[] args)
        {
            LINE line;
            CIRCUMFERENCE circumference;
            double radiusforcircumference;
            double radius2forcircumference;
            RECTANGLE rectangle;
            double asideforrectangle;
            double bsideforrectangle;
            ROUND.ROUND round;
            double radiusforround;
            RING.RING ring;
            double radiusforring;
            double outerradiusforring;
            Random rnd = new Random();

            Console.WriteLine("create a line with an random parameter \"x\" and \"y\"");
            line = new LINE(rnd.NextDouble(), rnd.NextDouble());
            Console.WriteLine("the object we created has the following parameters");
            Console.WriteLine(line.ToString());
            Console.WriteLine($"x = {line.X}");
            Console.WriteLine($"y = {line.Y}" + Environment.NewLine);

            Console.WriteLine("create a circumference with an random parameter \"x\" and \"y\"");
            Console.WriteLine("enter a first radius more than or equal to 0");
            if (double.TryParse(Console.ReadLine(), out radiusforcircumference) & radiusforcircumference >= 0)
            {
                Console.WriteLine("enter a second radius more than or equal to 0");
                if (double.TryParse(Console.ReadLine(), out radius2forcircumference) & radius2forcircumference >= 0)
                {
                    circumference = new CIRCUMFERENCE(radiusforcircumference, rnd.NextDouble(), rnd.NextDouble(), radius2forcircumference);
                    Console.WriteLine("the object we created has the following parameters");
                    Console.WriteLine(circumference.ToString());
                    Console.WriteLine($"first radius = {circumference.Radius}");
                    Console.WriteLine($"second radius= {circumference.Radiustwo}");
                    Console.WriteLine($"x = {circumference.X}");
                    Console.WriteLine($"y = {circumference.Y}" + Environment.NewLine);
                }
                else
                {
                    Console.WriteLine("error in second entering radius" + Environment.NewLine);
                }
            }
            else
            {
                Console.WriteLine("error in first entering radius" + Environment.NewLine);
            }

            Console.WriteLine("create a rectangle with an random parameter\"x\" and \"y\"");
            Console.WriteLine("enter a first side \"a\" more than  0");
            if (double.TryParse(Console.ReadLine(), out asideforrectangle) & asideforrectangle > 0)
            {
                Console.WriteLine("enter a second side \"b\" more than  0");
                if (double.TryParse(Console.ReadLine(), out bsideforrectangle) & bsideforrectangle > 0)
                {
                    rectangle = new RECTANGLE(asideforrectangle, bsideforrectangle, rnd.NextDouble(), rnd.NextDouble());
                    Console.WriteLine("the object we created has the following parameters");
                    Console.WriteLine(rectangle.ToString());
                    Console.WriteLine($"first side \"a\" = {rectangle.A}");
                    Console.WriteLine($"second side \"b\"= {rectangle.B}");
                    Console.WriteLine($"x = {rectangle.X}");
                    Console.WriteLine($"y = {rectangle.Y}" + Environment.NewLine);
                }
                else
                {
                    Console.WriteLine("error in second entering side \"b\"" + Environment.NewLine);
                }
            }
            else
            {
                Console.WriteLine("error in first entering side \"a\"" + Environment.NewLine);
            }

            Console.WriteLine("create a round with an random parameter \"x\" and \"y\"");
            if (double.TryParse(Console.ReadLine(), out radiusforround) & radiusforround >= 0)
            {
                Console.WriteLine("enter a radius more than or equal to 0");
                round = new ROUND.ROUND(radiusforround, rnd.NextDouble(), rnd.NextDouble());
                Console.WriteLine("the object we created has the following parameters");
                Console.WriteLine(round.ToString());
                Console.WriteLine($"radius = {round.Radius}");
                Console.WriteLine($"x = {round.X}");
                Console.WriteLine($"y = {round.Y}" + Environment.NewLine);
            }
            else
            {
                Console.WriteLine("error in entering radius" + Environment.NewLine);
            }

            Console.WriteLine("create a ring with an random parameter \"x\" and \"y\"");
            Console.WriteLine("enter a radius more than or equal to 0");
            if (double.TryParse(Console.ReadLine(), out radiusforring) & radiusforring >= 0)
            {
                Console.WriteLine("enter a outer radius more than or equal to 0");
                if (double.TryParse(Console.ReadLine(), out outerradiusforring) & outerradiusforring >= 0)
                {
                    if (outerradiusforring > radiusforring)
                    {
                        ring = new RING.RING(radiusforring, rnd.NextDouble(), rnd.NextDouble(), outerradiusforring);
                        Console.WriteLine("the object we created has the following parameters");
                        Console.WriteLine(ring.ToString());
                        Console.WriteLine($"radius = {ring.Radius}");
                        Console.WriteLine($"outer radius = {ring.Outer_radius}");
                        Console.WriteLine($"x = {ring.X}");
                        Console.WriteLine($"y = {ring.Y}");
                    }
                    else
                    {
                        Console.WriteLine("outer radius cannot be less or equal to radius");
                    }
                }
                else
                {
                    Console.WriteLine("error in outer entering radius");
                }
            }
            else
            {
                Console.WriteLine("error in entering radius");
            }
        }
    }
}
<file_sep>function deleteChars(){
var str = document.getElementById("text1").value;
var spl;
var letters = ["?", "!", ":", ";", ",", ".", " ", "\t"];
for(let i = 1; i<str.length; i++)
{
    for(let j = 0; j<letters.length; j++)
    {
        if(str[i] == letters[j])
        {
           str = str.replace(str[i], " ");           
        }
    }   
}
spl = str.split(" ");
for(var i=0;i<spl.length;i++)
{
    for(var j=0;j<spl[i].length;j++)
    {
        var current_char = spl[i].charAt(j);
        
        for(var z=j;z<spl[i].length-1;z++)
        {
            if(current_char==spl[i].charAt(z+1))
            {
              str = str.split(current_char).join("");
            }
        }
    }
}
document.getElementById("text2").value = str;
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.BLL.Interface
{
    public interface IAwardLogic
    {
        void AddAward(Award award);

        string GetAll();

        void AddAwardForUser(int idaward, int iduser);
    }
}
<file_sep>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task4.DYNAMIC_ARRAY
{
    public class DYNAMICARRAY<T> : IEnumerable<object>, IEnumerable
    {
        private object[] obj;
        
        public DYNAMICARRAY()
        {
            this.obj = new object[8];
            this.Capacity = this.obj.Length;
        }

        public DYNAMICARRAY(int n)
        {
            this.obj = new object[n];
            this.Capacity = this.obj.Length;
        }

        public DYNAMICARRAY(IEnumerable<T> n)
        {
            this.obj = new object[n.Count()];

            for (int i = 0; i < n.Count(); i++)
            {
                this.obj[i] = n.ElementAt(i);
            }

            this.Capacity = this.obj.Length;
        }

        public int Capacity { get; private set; }

        public int Length { get; private set; }

        public void Add(T obj)
        {
            if (this.Length != this.obj.Length)
            {
                this.obj[this.Length] = obj;
            }
            else
            {
                int length = this.obj.Length;
                object[] objcopy = this.obj;
                this.obj = new object[length * 2];
                this.Capacity = this.obj.Length;

                for (int i = 0; i < objcopy.Length; i++)
                {
                    this.obj[i] = objcopy[i];
                }

                this.obj[this.Length] = obj;
            }

            this.СountLength();
        }

        public void AddRange(IEnumerable<T> n)
        {
            for (int i = this.obj.Length - 1; i > 0; i--)
            {
                if (this.obj[i] != null)
                {
                    object[] objcopy = this.obj;
                    this.obj = new object[i + n.Count() + 1];
                    for (int j = 0; j <= i; j++)
                    {
                        this.obj[j] = objcopy[j];
                    }

                    for (int j = 0; j < n.Count(); j++)
                    {
                        this.obj[i + j + 1] = n.ElementAt(j);
                    }

                    break;
                }
            }
        }

        public bool Remove(int index)
        {
            if (index < this.obj.Length)
            {
                this.obj[index] = default(T);
                this.СountLength();
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool Insert(int index, T obj)
        {
            if (index <= this.obj.Length - 1)
            {
                if (this.obj[index] == null)
                {
                    this.obj[index] = obj;
                    this.СountLength();
                    return true;
                }
                else
                {
                    object[] objcopy = this.obj;
                    this.obj = new object[this.obj.Length * 2];
                    this.Capacity = this.obj.Length;
                    int newelement = 0;

                    for (int i = 0; i < objcopy.Length; i++)
                    {
                        if (i != index)
                        {
                            this.obj[i] = objcopy[i - newelement];
                        }
                        else
                        {
                            this.obj[i] = obj;
                            newelement++;
                        }
                    }

                    this.СountLength();
                    return true;
                }
            }
            else
            {
                throw new System.ArgumentOutOfRangeException("argument outside array border");
            }
        }

        public object Indexer(int index)
        {
            if (index <= this.obj.Length)
            {
                return this.obj[index];
            }
            else
            {
                throw new System.ArgumentOutOfRangeException("argument outside array border");
            }
        }

        public IEnumerator<object> GetEnumerator()
        {
            return ((IEnumerable<object>)this.obj).GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return ((IEnumerable<object>)this.obj).GetEnumerator();
        }

        private void СountLength()
        {
            int k = 0;

            for (int i = 0; i < this.Capacity; i++)
            {
                if (!(this.obj[i] == null))
                {
                    k++;
                }
            }

            this.Length = k;
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.GAME
{
    public abstract class ENEMY : MOVINGOBJECT
    {
        private Random rnd;

        public ENEMY(int x, int y, int speed)
            : base(x, y, speed)
        {
        }
        
        public new int X { get; set; }

        public new int Y { get; set; }

        public new int Speed { get; set; }

        public void ArtificialIntelligence(BARRIER barrier)
        {
            while (true)
            {
                try
                {
                    this.rnd = new Random();
                    this.Move(this.rnd.Next(-1, 1), this.rnd.Next(-1, 1), barrier);
                }
                catch
                {
                    Console.WriteLine("there can not move");
                }

                break;
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task5.TOINTORNOTTOINT
{
    public static class Program
    {
        public static bool TOINTORNOTTOINT(this string str)
        {
            if (str[0].Equals('-'))
            {
                str = str.Remove(0, 1);
            }

            var pointcounter = str.Where(i => i == '.');
            if (str[0].Equals('.') | str[str.Length - 1].Equals('.') | pointcounter.Count() >= 2)
            {
                return false;
            }

            var ecounter = str.Where(i => i == 'e' | i == 'E');
            if (str[0].Equals('e') | str[str.Length - 1].Equals('e') | str[0].Equals('E') | str[str.Length - 1].Equals('E') | ecounter.Count() >= 2)
            {
                return false;
            }

            for (int i = 1; i < str.Length; i++)
            {
                if (str[i].Equals('e') | str[i].Equals('E'))
                {
                    if (str[i - 1].Equals('.') | str[i + 1].Equals('.'))
                    {
                        return false;
                    }

                    str = str.Remove(i, 1);
                    if (str[i].Equals('+'))
                    {
                        str = str.Remove(i, 1);
                        if (i == str.Length)
                        {
                            return false;
                        }
                    }
                }
            }

            bool result = str.All(char.IsDigit) | str.Any(i => i == '.');
            return result;
        }

        public static void Main(string[] args)
        {
            Console.WriteLine("enter a string to check for a number using a dot and not a comma for example 3.14E+06");
            string str = Console.ReadLine();
            Console.WriteLine("is string digit? " + str.TOINTORNOTTOINT());
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.BLL;
using Epam.Task7.USERS.BLL.Interface;
using Epam.Task7.USERS.Common;
using Epam.Task7.USERS.DAL;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.ConsolePL
{
    public class Program
    {
        public static void Main(string[] args)
        {
           
            var award = new Award
            {
                Title = "oscar"
            };
            string input;
            var userLogic = DependencyResolver.UserLogic;
            var awardlogic = DependencyResolver.Awardlogic;

            while (true)
            {
                Console.WriteLine("write \"addu\" or \"delu\" or \"showu\" to add or delete or show a user");
                Console.WriteLine("write \"adda\" or \"showa\"  to add or show a award/s");
                Console.WriteLine("write \"addau\" or \"showau\"  to add award to user or show a user awards");
                input = Console.ReadLine();
                if (input.Equals("addu"))
                {
                    AddUser(userLogic);
                }
                else if (input.Equals("delu"))
                {
                    DeleteUser(userLogic);
                }
                else if (input.Equals("showu"))
                {
                    Console.WriteLine("Id | Name | Date Of Birth | Age");
                    Console.WriteLine(userLogic.GetAll());
                }
                else if (input.Equals("adda"))
                {
                    AddAward(awardlogic);
                }
                else if (input.Equals("showa"))
                {
                    Console.WriteLine("current awards");
                    Console.WriteLine(awardlogic.GetAll());
                }
                else if (input.Equals("addau"))
                {
                    AddAwardForUser(awardlogic);
                }
                else if (input.Equals("showau"))
                {
                    ShowUserAwards(userLogic);
                }
                else
                {
                    Console.WriteLine("error in the entered string, enter \"add\" or \"del\"");
                }
            }
        }

        private static void AddUser(IUserLogic userlogic)
        {
        string name;
        int age;
            Console.WriteLine("Enter a name");
            name = Console.ReadLine();
            Console.WriteLine("Enter a age more 4");
            if (!(int.TryParse(Console.ReadLine(), out age) & age > 4))
            {
                Console.WriteLine("date entry error");
                return;
            }

            Console.WriteLine("the date will be selected current");
            var user = new User
            {
                Name = name,
                DateOfBirth = DateTime.Now,
                Age = age,
            };
            userlogic.Add(user);
        }

        private static void DeleteUser(IUserLogic userlogic)
        {
            int id;

            Console.WriteLine("enter the ID of the user you want to delete");
            if (!int.TryParse(Console.ReadLine(), out id))
            {
                Console.WriteLine("id entry error");
            }

            userlogic.Delete(id);
        }

        private static void AddAward(IAwardLogic awardlogic)
        {
            string name;
            Console.WriteLine("Enter a name of award");
            name = Console.ReadLine();
            var award = new Award
            {
                Title = name
            };
            awardlogic.AddAward(award);
        }

        private static void AddAwardForUser(IAwardLogic awardlogic)
        {
            int iduser;
            int idaward;
            Console.WriteLine("enter the user ID to which you want to add a award");
            if (!int.TryParse(Console.ReadLine(), out iduser))
            {
                Console.WriteLine("date entry user ID");
                return;
            }

            Console.WriteLine("enter the award ID to which you want to add");
            if (!int.TryParse(Console.ReadLine(), out idaward))
            {
                Console.WriteLine("date entry award ID");
                return;
            }

            awardlogic.AddAwardForUser(iduser, idaward);
        }

        private static void ShowUserAwards(IUserLogic userlogic)
        {
            int id;

            Console.WriteLine("enter the ID of the user you want to show awards");

            if (!int.TryParse(Console.ReadLine(), out id))
            {
                Console.WriteLine("id entry error");
            }

            Console.WriteLine("This user has the following awards.");
            Console.WriteLine(userlogic.ShowAwards(id));
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FONT_ADJUSTMENT
{
    class Program
    {
        [Flags]
        enum text_formatting : byte
        {
            none = 0,
            bold = 1,
            italic = 2,
            underline = 4,
        }
        static text_formatting curecurrent_text_status = text_formatting.none;

        public static void current_state()
        {
            Console.Write("label parameters: ");
            Console.Write(curecurrent_text_status + Environment.NewLine);
            Console.WriteLine("1: " + text_formatting.bold + Environment.NewLine + "2: " + text_formatting.italic + Environment.NewLine + "3: " + text_formatting.underline);
        }

        public static void change_state(int n)
        {
            n = Convert.ToInt32(Math.Pow(2, n - 1));
            if (curecurrent_text_status.HasFlag((text_formatting)n))
            {
                curecurrent_text_status &= ~(text_formatting)n;
            }
            else
            {
                curecurrent_text_status |= (text_formatting)n;
            }
        }
        static void Main(string[] args)
        {
            int n;
            while (true)
            {
                current_state();
                Console.WriteLine("enter the number of the label which you want to add or delete");
                if (Int32.TryParse(Console.ReadLine(), out n) & n <= 3 & n > 0)
                {
                    change_state(n);
                }
                else
                {
                    Console.WriteLine("error in entering number of label");
                }
            }
        }
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.BLL.Interface;
using Epam.Task7.USERS.DAL.Interface;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.BLL
{
    public class AwardLogic : IAwardLogic
    {
        private readonly IAwardDao awarddao;

        public AwardLogic(IAwardDao awardDao)
        {
            this.awarddao = awardDao;
        }

        public void AddAward(Award award)
        {
            this.awarddao.AddAward(award);
        }

        public string GetAll()
        {
            return this.awarddao.GetAll();
        }

        public void AddAwardForUser(int idaward, int iduser)
        {
            this.awarddao.AddAwardForUser(idaward, iduser);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.EMPLOYEE
{
    public class EMPLOYEE : USER.USER
    {
        private int workexperience;
        private string position;

        public EMPLOYEE(string lastName, string firstName, string patronymic, DateTime dateofBirth, int age, int workexperience, string position)
        
            : base(lastName, firstName, patronymic, dateofBirth, age)
        {
            if (workexperience < 0)
            {
                throw new Exception("experience can not be negative");
            }

            this.workexperience = workexperience;
            this.position = position;
        }

        public new string Getfullinf()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(base.Getfullinf());
            sb.Append(this.workexperience).Append(" ");
            sb.Append(this.position);
            return sb.ToString();
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.ROUND
{
    public class ROUND
    {
        private double radius;
        private double x;
        private double y;
        private double circlelength;
        private double areacircle;

        public ROUND(double radius, double x, double y)
        {
            if (radius < 0)
            {
                throw new Exception("Radius should be positive");
            }

            this.radius = radius;
            this.x = x;
            this.y = y;
            this.Circle_Length();
            this.Area_Circle();
        }

        public double Circle_length
        {
            get
            {
                return this.circlelength;
            }
        }

        public double Area_circle
        {
            get
            {
                return this.areacircle;
            }
        }

        public double Radius 
        {
            get
            {
                return this.radius;
            }
        }

        public double X
        {
            get
            {
                return this.x;
            }
        }

        public double Y
        {
            get
            {
                return this.y;
            }
        }

        private void Circle_Length()
        {
            this.circlelength = 2 * Math.PI * this.radius;
        }

        private void Area_Circle()
        {
            this.areacircle = Math.PI * Math.Pow(this.radius, 2);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Epam.Task8.REGULAREXPRESSIONS.NUMBERVALIDATOR
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("enter a number");
            string text = Console.ReadLine();
            string regstrusual = @"^[-]?[0-9]*\.?,?[0-9]+$";
            string regstrscience = @"-?[\d.]+(?:e-?\d+)?";
            var regexusual = new Regex(regstrusual, RegexOptions.IgnoreCase);
            var regexuscience = new Regex(regstrscience, RegexOptions.IgnoreCase);
            if (regexusual.IsMatch(text))
            {
                Console.WriteLine("this number is in usual notation.");
            }
            else if (regexuscience.IsMatch(text))
            {
                Console.WriteLine("this number is in scientific notation.");
            }
            else
            {
                Console.WriteLine("this is not number");
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task4.LOST
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int n;
            bool chek = false;
            List<int> people = new List<int>();

            while (true)
            {
                Console.WriteLine("enter a number more than 0");
                if (int.TryParse(Console.ReadLine(), out n) & n > 0)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering number");
                }
            }

            for (int i = 1; i <= n; i++)
            {
                people.Add(i);
                Console.Write(people[i - 1] + " ");
            }

            Console.WriteLine();

            while (people.Count > 1)
            {
                for (int i = 0; i < people.Count; i++)
                {
                    if (chek)
                    {
                        people.RemoveAt(i);
                        i--;
                    }

                    chek = !chek;
                }

                for (int j = 0; j < people.Count; j++)
                {
                    Console.Write(people[j] + " ");
                }

                Console.WriteLine();
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.EMPLOYEE
{
    public class Program
    {
        public static void Main(string[] args)
        {
            EMPLOYEE employee;
            string lastName;
            string firstName;
            string patronymic;
            DateTime dateofBirth;
            int age;
            int workexperience;
            string position;

            Console.WriteLine("enter a last Name");
            lastName = Console.ReadLine();
            Console.WriteLine("enter a first Name");
            firstName = Console.ReadLine();
            Console.WriteLine("enter a patronymic");
            patronymic = Console.ReadLine();
            Console.WriteLine("enter a work position");
            position = Console.ReadLine();

            while (true)
            {
                Console.WriteLine("enter date as in example 21.05.2015");
                if (DateTime.TryParse(Console.ReadLine(), out dateofBirth))
                {
                    Console.WriteLine("enter a age");
                    if (int.TryParse(Console.ReadLine(), out age))
                    {
                        if ((int)(DateTime.Now.Year - dateofBirth.Year) == age)
                        {
                            break;
                        }
                        else
                        {
                            Console.WriteLine("such age cannot with such date of birth");
                        }
                    }
                    else
                    {
                        Console.WriteLine("error in entering age");
                    }
                }
                else
                {
                    Console.WriteLine("error in entering date");
                }
            }

            while (true)
            {
                Console.WriteLine("enter a work experience");
                if (int.TryParse(Console.ReadLine(), out workexperience) & workexperience > 0)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering work experience");
                }
            }

            employee = new EMPLOYEE(lastName, firstName, patronymic, dateofBirth, age, workexperience, position);
            Console.WriteLine(employee.Getfullinf());
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task5.ISEEKYOU
{
   public class Program
    {
        public delegate bool Sumelement(int element);

        public static int Sumnonegativeelement(int[] array)
        {
            int sum = 0;

            foreach (var item in array)
            {
                if (item >= 0)
                {
                    sum += item;
                }
            }

            return sum;
        }

        public static int Sumnonegativeelement(int[] array, Sumelement compare)
        {
            int sum = 0;
            foreach (var item in array)
            {
                if (compare(item))
                {
                    sum += item;
                }
            }  

            return sum;
        }

        public static bool Nonegativeelement(int element)
        {
            if (element >= 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

       public static void Main(string[] args)
        {
            int step = 100;
            List<long> time = new List<long>();
            Stopwatch sw = new Stopwatch();
            Random rnd = new Random();
            int[] array = new int[500];
            
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = rnd.Next(-100, 100);
            }

            for (int i = 0; i < step; i++)
            {
                sw.Start();
                Sumnonegativeelement(array);
                time.Add(sw.ElapsedTicks);
                sw.Reset();
            }

            Console.WriteLine("Time method 1 = " + time.Average());
            time.Clear();

            for (int i = 0; i < step; i++)
            {
                sw.Start();
                Sumnonegativeelement(array, Nonegativeelement);
                time.Add(sw.ElapsedTicks);
                sw.Reset();
            }

            Console.WriteLine("Time method 2 = " + time.Average());
            time.Clear();

            for (int i = 0; i < step; i++)
            {
                sw.Start();
                var result = Sumnonegativeelement(
                    array, 
                    delegate(int element)
                {
                    if (element >= 0)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                });
                time.Add(sw.ElapsedTicks);
                sw.Reset();
            }

            Console.WriteLine("Time method 3 = " + time.Average());
            time.Clear();

            for (int i = 0; i < step; i++)
            {
                sw.Start();
                Sumnonegativeelement(array, element => element > -1);
                time.Add(sw.ElapsedTicks);
                sw.Reset();
            }

            Console.WriteLine("Time method 4 = " + time.Average());
            time.Clear();

            for (int i = 0; i < step; i++)
            {
                sw.Start();
                int result = array.Where(j => j > -1).Sum();
                time.Add(sw.ElapsedTicks);
                sw.Reset();
            }

            Console.WriteLine("Time method 5 = " + time.Average());
            time.Clear();
        }
    }
}
<file_sep>function mathCalc() {
    var pattern = /-?\d+(\.\d+)?|[\/\+\-\=\*]{1}/g;
    var numb = document.getElementById("text1").value;
    var arr = numb.match(pattern);
    var result;
    if (+arr[0] !== "NaN") {
        result = +arr[0];
    }
    for (let i = 0; i < arr.length; i++) {
        switch (arr[i]) {
            case '+':
                result += +arr[i + 1];
                break;

            case '*':
                result *= arr[i + 1];
                break;

            case '/':
                result /= arr[i + 1];
                break;
            case '=':
                document.getElementById('text2').value = result.toFixed(2);
                break;
        }
        if (arr[i] < 0 && arr[i - 1] != '*' && arr[i - 1] != '/' && arr[i - 1] != null) {
            result += +arr[i];
        }
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.VECTOR_GRAPHICS_EDITOR
{
    public class RECTANGLE
    {
        private double a;
        private double b;
        private double x;
        private double y;

        public RECTANGLE(double a, double b, double x, double y)
        {
            if (a <= 0)
            {
                throw new Exception("Side \"a\" should be positive");
            }

            if (b <= 0)
            {
                throw new Exception("Side \"b\" should be positive");
            }

            this.a = a;
            this.b = b;
            this.x = x;
            this.y = y;
        }

        public double X
        {
            get
            {
                return this.x;
            }
        }

        public double Y
        {
            get
            {
                return this.y;
            }
        }

        public double A
        {
            get
            {
                return this.a;
            }
        }

        public double B
        {
            get
            {
                return this.b;
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.GAME
{
    public abstract class TERRITORY
    {
        public TERRITORY()
        {
            this.X = 25;
            this.Y = 25;
        }

        public int X { get; }

        public int Y { get; }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task2.CHAR_DOUBLER
{
    class Program
    {
        static void Main(string[] args)
        {
            bool chek_doubl = false;

            Console.WriteLine("Enter the first line:");
            StringBuilder sb = new StringBuilder(Console.ReadLine());
            Console.WriteLine("Enter the second line:");
            StringBuilder sb1 = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < sb1.Length; i++)
            {
                chek_doubl = false;
                for (int j = 0; j < sb.Length; j++)
                {
                    if (sb1[i].ToString().ToUpper().Equals(sb[j].ToString().ToUpper()))
                    {
                        sb.Insert(j, sb1[i]);
                        j++;
                        chek_doubl = true;
                    }
                }
                if (chek_doubl)
                {
                    sb1.Replace(sb1[i].ToString(), "");
                    i = -1;
                }
            }
            Console.WriteLine(sb.ToString());
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.GAME
{
    public class PLAYER : MOVINGOBJECT
    {
        public PLAYER(int x, int y, int speed, int effecttime)
            : base(x, y, speed)
        {
            this.Effecttime = effecttime;
        }

        public new int X { get; set; }

        public new int Y { get; set; }

        public new int Speed { get; set; }

        public int Effecttime { get; set; }

        public void Changeeffecttime(int speed, int effecttime)
        {
            if (this.Speed + speed > 0 & this.Effecttime + effecttime > 0)
            {
                this.Speed += speed;
                this.Effecttime += effecttime;
            }
        }

        public void Move(int x, int y, BARRIER barrier, BONUS bonus)
        {
            if (!(barrier.X == this.X + x) & !(barrier.Y == this.Y + y))
            {
                if (x >= base.X & x <= 0)
                {
                    throw new Exception("player can not be located abroad, error x");
                }

                if (y >= base.Y & y <= 0)
                {
                    throw new Exception("player can not be located abroad, error y");
                }

                this.X = x;
                this.Y = y;
            }

            if (bonus.X == this.X + x & bonus.Y == this.Y + y)
            {
                this.Speed += bonus.Speedincrease;
                this.Effecttime += bonus.Effecttime;
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task4.DYNAMIC_ARRAY
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("create an instance of DYNAMICARRAY with a size of 1");
            DYNAMICARRAY<object> array = new DYNAMICARRAY<object>(1);
            Console.WriteLine("test \"add\" add objects of different types larger than the size of the array");
            array.Add("somestring");
            array.Add(15);
            array.Add(true);
            Console.WriteLine(array.Remove(2));
            Console.WriteLine(array.Remove(1));
            Console.WriteLine(array.Insert(0, "newstring"));
            Console.WriteLine(array.Insert(5, 44444));
            Console.WriteLine(array.Length);
            Console.WriteLine(array.Capacity);
            var testindexer = array.Indexer(4);

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }


            DYNAMICARRAY<object> array1 = new DYNAMICARRAY<object>(array);

            array.AddRange(array1);
            int sdfsd = 5;

        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task2._2D_ARRAY
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] array = new int[5, 5];
            Random ran = new Random();
            int sum = 0;

            Console.WriteLine("Random array");
            for (int i = 0; i < array.GetUpperBound(0)+1; i++)
            {
                for (int j = 0; j < array.GetUpperBound(1)+1; j++)
                {
                    array[i, j] = ran.Next(-100, 100);
                    Console.Write(array[i, j] + " ");
                    if ((i + j) % 2 == 0)
                    {
                        sum += array[i, j];
                    }
                }
                Console.Write(Environment.NewLine);
            }
            Console.WriteLine($"the sum of the position numbers of the array in both even dimensions = {sum}");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task1._1
{ 
    class Program
    {
        public static void SEQUENCE(int n)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 1; i <= n; i++)
            {
                if (i != n)
                {
                    Console.Write(i + ", ");
                }
                else
                {
                    Console.WriteLine(i);
                }
            }
        }

        static void Main(string[] args)
        {
            Console.WriteLine("enter a number more than 0");

            while (true)
            {
                try
                {
                    int n = int.Parse(Console.ReadLine());
                    if (n > 0)
                    {
                        SEQUENCE(n);
                        break;
                    }
                    else
                    {
                        throw new Exception("Not this, enter a number more than 0");
                    }
                }
                catch
                {
                    Console.WriteLine("Not this, enter a number more than 0");
                }
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.RING
{
    public class RING : ROUND.ROUND
    {
        private double outerradius;
        private double arearing;
        private double ringlength;

        public RING(double radius, double x, double y, double outerradius)
            : base(radius,  x,  y)
        {
            if (outerradius < 0)
            {
                throw new Exception("Insideradius should be positive");
            }

            if (radius  >= outerradius)
            {
                throw new Exception("Insideradius should be more radius");
            }

            this.outerradius = outerradius;
            this.Area_Ring();
            this.Ring_Length();
        }

        public double Outer_radius
        {
            get
            {
                return this.outerradius;
            }
        }

        public double Ring_length
        {
            get
            {
                return this.ringlength;
            }
        }

        public double Area_ring
        {
            get
            {
                return this.arearing;
            }
        }

        private void Area_Ring()
        {
            this.arearing = Math.PI * (Math.Pow(this.outerradius, 2) - Math.Pow(this.Radius, 2));
        }

        private void Ring_Length()
        {
            this.ringlength = (2 * Math.PI * this.outerradius) + this.Circle_length;
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Epam.Task8.REGULAREXPRESSIONS.HTMLREPLACER
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("enter a string with HTML tegs");
            string text = Console.ReadLine();
            string regstr = @"<[^>]*>";
            var regex = new Regex(regstr, RegexOptions.IgnoreCase);
            Console.WriteLine("The result of the replacement:" + regex.Replace(text, "_"));
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.RING
{
    public class Program
    {
        public static void Main(string[] args)
        {
            double radius;
            double outerradius;
            double x;
            double y;
            RING ring;

            while (true)
            {
                Console.WriteLine("enter a radius more than or equal to 0");
                if (double.TryParse(Console.ReadLine(), out radius) & radius >= 0)
                {
                    Console.WriteLine("enter a outer radius more than or equal to 0");
                    if (double.TryParse(Console.ReadLine(), out outerradius) & outerradius >= 0)
                    {
                        if (outerradius > radius)
                        {
                            break;
                        }
                        else
                        {
                            Console.WriteLine("outer radius cannot be less or equal to radius");
                        }
                    }
                    else
                    {
                        Console.WriteLine("error in outer entering radius");
                    }
                }
                else
                {
                    Console.WriteLine("error in entering radius");
                }
            }

            while (true)
            {
                Console.WriteLine("enter x coordinate");
                if (double.TryParse(Console.ReadLine(), out x))
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering x");
                }
            }

            while (true)
            {
                Console.WriteLine("enter y coordinate");
                if (double.TryParse(Console.ReadLine(), out y))
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering y");
                }
            }

            ring = new RING(radius, x, y, outerradius);
            Console.WriteLine($"Ring length = {ring.Ring_length}");
            Console.WriteLine($"Area ring = {ring.Area_ring}");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.MY_STRING
{
    public class Program
    {
        public static void Main(string[] args)
        {
            MYSTRING str = new MYSTRING("hello");
            char chr;
            char chrtwo;
            int index;
            int indextwo;
            string[] array;

            Console.WriteLine("create an instance of the MYSTRING class with the \"hello\" parameter");
            Console.WriteLine("enter the words with which to compare it");
            Console.WriteLine(str.Mycompare(Console.ReadLine()));

            Console.WriteLine("enter the words that you want to add to our class");
            Console.WriteLine(str.Myconcat(Console.ReadLine()));

            Console.WriteLine("enter the character the number of the first entry of which you want to see if such a character in \"hello\" is not displayed on the screen -1");
            if (char.TryParse(Console.ReadLine(), out chr))
            {
                Console.WriteLine(str.Myindexof(chr));
            }
            else
            {
                Console.WriteLine("character is incorrect");
            }

            Console.WriteLine("enter the character the number of the last entry of which you want to see if such a character in \"hello\" is not displayed on the screen -1");
            if (char.TryParse(Console.ReadLine(), out chr))
            {
                Console.WriteLine(str.Mylastindexof(chr));
            }
            else
            {
                Console.WriteLine("character is incorrect");
            }

            Console.WriteLine("enter the number of the character you want to remove from \"hello\"");
            if (int.TryParse(Console.ReadLine(), out index))
            {
                Console.WriteLine(str.Myremove(index));
            }
            else
            {
                Console.WriteLine("number is incorrect");
            }

            Console.WriteLine("enter the number of character from which you want to remove from \"hello\"");
            if (int.TryParse(Console.ReadLine(), out index) & index >= 0)
            {
                Console.WriteLine("enter the number of character to which you want to remove from \"hello\"");
                if (int.TryParse(Console.ReadLine(), out indextwo) & indextwo > index)
                {
                    Console.WriteLine(str.Myremove(index, indextwo));
                }
                else
                {
                    Console.WriteLine("number is incorrect");
                }
            }
            else
            {
                Console.WriteLine("number is incorrect");
            }

            Console.WriteLine("create an instance of the MYSTRING class with the \"say hello to my little friend\" parameter");
            str = new MYSTRING("say hello to my little friend");
            Console.WriteLine("enter the character you want to share the phrase \"say hello to my little friend\"");
            if (char.TryParse(Console.ReadLine(), out chr))
            {
                array = str.Mysplit(chr);
                foreach (var item in array)
                {
                    Console.WriteLine(item);
                }
            }
            else
            {
                Console.WriteLine("character is incorrect");
            }

            Console.WriteLine("create an instance of the MYSTRING class with the \" hello world \" parameter");
            str = new MYSTRING(" hello world ");
            Console.WriteLine("use the trim function without parameters");
            Console.WriteLine(str.Mytrim());

            Console.WriteLine("create an instance of the MYSTRING class with the \"hello world\" parameter");
            str = new MYSTRING("hello world");
            Console.WriteLine("enter the first character that you do not want to see on the edges of \"hello world\"");
            if (char.TryParse(Console.ReadLine(), out chr))
            {
                Console.WriteLine("enter the second character that you do not want to see on the edges of \"hello world\"");
                if (char.TryParse(Console.ReadLine(), out chrtwo))
                {
                    Console.WriteLine(str.Mytrim(chr, chrtwo));
                }
                else
                {
                    Console.WriteLine("character is incorrect");
                }
            }
            else
            {
                Console.WriteLine("character is incorrect");
            }

            Console.WriteLine("create an instance of the MYSTRING class with the \"hello world\" parameter");
            Console.WriteLine("enter the number from which you want to cut the string \"hello world\"");
            if (int.TryParse(Console.ReadLine(), out index) & index >= 0)
            {
                Console.WriteLine(str.Mysubstring(index));
            }
            else
            {
                Console.WriteLine("number is incorrect");
            }

            Console.WriteLine("enter the number of the character from which you want to insert the string in \"hello world\"");
            if (int.TryParse(Console.ReadLine(), out index) & index >= 0)
            {
                Console.WriteLine("enter the string you want to insert in \"hello world\"");
                Console.WriteLine(str.Myinsert(index, Console.ReadLine()));
            }
            else
            {
                Console.WriteLine("number is incorrect");
            }
        }
    }
}
<file_sep>var list1 = document.getElementById("left");
var list2 = document.getElementById("right");
function one_move(name)
{
var my_element = document.getElementById(name);
var my_index = my_element.selectedIndex;	

		if(name=="left")
		{
			if(my_index==-1)
			{
				alert("element isn't choosen!!!!!")
			}
			else
			{
				var newElement = my_element[my_index].cloneNode(true);
				list1.removeChild(my_element[my_index]);
				list2.append(newElement);
			}
		}
		if(name=="right")
		{
			if(my_index==-1)
			{
				alert("element isn't choosen!!!!!")
			}
				else
				{
						var newElement = my_element[my_index].cloneNode(true);
						list2.removeChild(my_element[my_index]);
						list1.append(newElement);
				}
		}
	}
	function all_move(name)
	{
		my_element = document.getElementById(name);
		if(name == "left")
		{
			while(my_element.length > 0)
			{
				var newElement = my_element[0].cloneNode(true);
				list1.removeChild(my_element[0]);
				list2.append(newElement);
			}
			
		}
		else if(name == "right")
		{
		while(my_element.length > 0)
			{
				var newElement = my_element[0].cloneNode(true);
				list2.removeChild(my_element[0]);
				list1.append(newElement);
			}
		}
	}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.TRIANGLE
{
    public class Program
    {
        public static void Main(string[] args)
        {
            TRIANGLE triangle;
            double a;
            double b;
            double c;

            while (true)
            {
                Console.WriteLine("enter the first side of the triangle");
                if (double.TryParse(Console.ReadLine(), out a) & a >= 0)
                {
                    Console.WriteLine("enter the second side of the triangle");
                    if (double.TryParse(Console.ReadLine(), out b) & b >= 0)
                    {
                        Console.WriteLine("enter the  third side of the triangle");
                        if (double.TryParse(Console.ReadLine(), out c) & c >= 0)
                        {
                            if (a + b > c & a + c > b & b + c > a)
                            {
                                triangle = new TRIANGLE(a, b, c);
                                Console.WriteLine($" triangle area = {triangle.CalcArea()}");
                                Console.WriteLine($" triangle perimeter = {triangle.CalcPerimeter()}");
                                break;
                            }
                            else
                            {
                                Console.WriteLine("such a triangle does not exist");
                            }
                        }
                        else
                        {
                            Console.WriteLine("error in entering third side");
                        }
                    }
                    else
                    {
                        Console.WriteLine("error in entering second side");
                    }
                }
                else
                {
                    Console.WriteLine("error in entering first side");
                }
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task2.ARRAY_PROCESSING
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = new int[10];
            Random ran = new Random();
            int variable;

            for (int i = 0; i < array.Length; i++)
            {
                array[i] = ran.Next(0,100);
            }

            for (int i = 0; i < array.Length - 1; i++)
            {
                for (int j = i + 1; j < array.Length; j++)
                {
                    if (array[i] > array[j])
                    {
                        variable = array[i];
                        array[i] = array[j];
                        array[j] = variable;
                    }
                }
            }
            Console.WriteLine("random sorted array");
            foreach (int i in array)
            {
                Console.WriteLine(i);
            }
            Console.WriteLine($"minimal array element = {array[0]}");
            Console.WriteLine($"minimal array element = { array[9]}");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.DAL.Interface
{
    public interface IAwardDao
    {
        void AddAward(Award award);

        string GetAll();

        void AddAwardForUser(int idaward, int iduser);
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.MY_STRING
{
    public class MYSTRING
    {
        private char[] chr;

        public MYSTRING(string str)
        {
            this.chr = new char[str.Length];

            for (int i = 0; i < str.Length; i++)
            {
                this.chr[i] = str[i];
            }
        }

        public bool Mycompare(string str)
        {
            if (this.chr.Length == str.Length)
            {
                for (int i = 0; i < str.Length; i++)
                {
                    if (this.chr[i] != str[i])
                    {
                        return false;
                    }
                }

                return true;
            }
            else
            {
                return false;
            }
        }

        public string Myconcat(string str)
        {
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                sb.Append(this.chr[i]);
            }

            sb.Append(str);
            return sb.ToString();
        }

        public int Myindexof(char chr)
        {
            for (int i = 0; i < this.chr.Length; i++)
            {
                if (this.chr[i] == chr)
                {
                    return i;
                }
            }

            return -1;
        }

        public int Mylastindexof(char chr)
        {
            for (int i = this.chr.Length - 1; i >= 0; i--)
            {
                if (this.chr[i] == chr)
                {
                    return i;
                }
            }

            return -1;
        }

        public string Myremove(int index)
        {
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                if (i != index)
                {
                    sb.Append(this.chr[i]);
                }
            }

            return sb.ToString();
        }

        public string Myremove(int firstindex, int lastindex)
        {
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                if (i < firstindex | i >= lastindex)
                {
                    sb.Append(this.chr[i]);
                }
            }

            return sb.ToString();
        }

        public string[] Mysplit(char chr)
        {
            string[] array;
            int index = 0;
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                if (this.chr[i] == chr)
                {
                    index++;
                }
            }

            array = new string[index + 1];
            index = 0;

            for (int i = 0; i < this.chr.Length; i++)
            {
                if (this.chr[i] != chr)
                {
                    sb.Append(this.chr[i]);
                }
                else
                {
                    array[index] = sb.ToString();
                    sb.Remove(0, sb.Length);
                    index++;
                }
            }

            array[index] = sb.ToString();
            return array;
        }

        public string Mytrim()
        {
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                if (!(this.chr[i] == ' ' & i == 0) & !(this.chr[i] == ' ' & i == this.chr.Length - 1))
                {
                    sb.Append(this.chr[i]);
                }
            }

            return sb.ToString();
        }

        public string Mytrim(char one, char two)
        {
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                if (!(((this.chr[i] == one) | (this.chr[i] == two)) & ((i == 0) | (i == this.chr.Length - 1))))
                {
                    sb.Append(this.chr[i]);
                }
            }

            return sb.ToString();
        }

        public string Mysubstring(int index)
        {
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                if (i >= index)
                {
                    sb.Append(this.chr[i]);
                }
            }

            return sb.ToString();
        }

        public string Myinsert(int index, string str)
        {
            StringBuilder sb = new StringBuilder(string.Empty);

            for (int i = 0; i < this.chr.Length; i++)
            {
                sb.Append(this.chr[i]);
                if (i == index - 1)
                {
                    sb.Append(str);
                }
            }

            return sb.ToString();
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task5.CUSTOM_SORT
{
    public class Program
    {
        public delegate int Comparison<T>(T first, T second);

        public static void Sort<T>(T[] a, Comparison<T> compare)
        {
            for (int i = 0; i < a.Length; i++)
            {
                for (int j = i + 1; j < a.Length; j++)
                {
                    if (compare(a[i], a[j]) > 0)
                    {
                        var temp = a[i];
                        a[i] = a[j];
                        a[j] = temp;
                    }
                }
            }
        }

        public static int Compareint(int first, int second)
        {
            if (first > second)
            {
                return 1;
            }

            if (first == second)
            {
                return 0;
            }

            return -1;
        }

        public static void Main(string[] args)
        {
            int[] array = { 15, 7, -5, 6, 4 };
            Console.WriteLine("enter an unsorted array");

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("apply our method and output an array");
            Sort(array, Compareint);

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Epam.Task5.SORTING_UNIT
{
    public class SORTINGUNIT
    {
        public delegate string SortFinished();
        
        public delegate int Comparison<T>(T first, T second);

        public event SortFinished Already;

        public Thread Th { get; private set; }

        public void Sort<T>(T[] a, Comparison<T> compare)
        {
            if (compare == null)
            {
                throw new ArgumentNullException();
            }

            for (int i = 0; i < a.Length; i++)
            {
                for (int j = i + 1; j < a.Length; j++)
                {
                    if (compare(a[i], a[j]) > 0)
                    {
                        var temp = a[i];
                        a[i] = a[j];
                        a[j] = temp;
                    }
                }
            }

            this.Already?.Invoke();
        }

        public int Compareint(int first, int second)
        {
            if (first > second)
            {
                return 1;
            }

            if (first == second)
            {
                return 0;
            }

            return -1;
        }

        public void Sortflow<T>(T[] a, Comparison<T> compare)
        {
            ThreadStart thstart = new ThreadStart(() => this.Sort(a, compare));
            this.Th = new Thread(thstart);
            this.Th.Start();
        }

        public string Conclusion()
        {
            Console.WriteLine("array is ready");
            return "array is ready";
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task4.WORD_FREQUENCY
{
    public class Program
    {
        public static void Main(string[] args)
        {
            string str;
            string[] strarray;
            char[] separator = { ' ', '.' };
            int k = 0;
            List<string> words = new List<string>();

            Console.WriteLine("enter text in English");
            str = Console.ReadLine().ToLower();
            strarray = str.Split(separator);

            foreach (var item in strarray)
            {
                if (!item.Equals(string.Empty))
                {
                    words.Add(item);
                }
            }

            for (int i = 0; i < words.Count; i++)
            {
                for (int j = i; j < words.Count; j++)
                {
                    if (words[i].Equals(words[j]))
                    {
                        k++;
                    }

                    if (k > 1 & words[i].Equals(words[j]))
                    {
                        words.RemoveAt(j);
                        j--;
                    }
                }

                Console.WriteLine(words[i] + " = " + k);
                k = 0;
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task2.RECTANGLE
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            int b;

            while (true)
            {
                Console.WriteLine("enter a width more than 0 using the number");
                if (Int32.TryParse(Console.ReadLine(), out a) & a>0)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering width");
                }
            }

            while (true)
            {
                Console.WriteLine("enter a length more than 0 using the number");
                if (Int32.TryParse(Console.ReadLine(), out b) & b > 0)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering length");
                }
            }
            Console.WriteLine($"rectangle area = {a * b}");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.BLL.Interface;
using Epam.Task7.USERS.DAL;
using Epam.Task7.USERS.DAL.Interface;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.BLL
{
    public class UserLogic : IUserLogic
    {
        private readonly IUserDao userdao;

        public UserLogic(IUserDao userDao)
        {
            this.userdao = userDao;
        }

        public void Add(User user)
        {
            this.userdao.Add(user);
        }

        public void Delete(int id)
        {
            this.userdao.Delete(id);
        }

        public string GetAll()
        {
            return this.userdao.GetAll();
        }

        public string ShowAwards(int id)
        {
            return this.userdao.ShowAwards(id);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.ROUND
{
    public class Program
    {
        public static void Main(string[] args)
        {
            double radius;
            double x;
            double y;
            ROUND сircle;

            while (true)
            {
                Console.WriteLine("enter a radius more than or equal to 0");
                if (double.TryParse(Console.ReadLine(), out radius) & radius >= 0)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering radius");
                }
            }

            while (true)
            {
                Console.WriteLine("enter x coordinate");
                if (double.TryParse(Console.ReadLine(), out x))
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering x");
                }
            }

            while (true)
            {
                Console.WriteLine("enter y coordinate");
                if (double.TryParse(Console.ReadLine(), out y))
                {
                    break;
                }
                else
                {
                    Console.WriteLine("error in entering y");
                }
            }

            сircle = new ROUND(radius, x, y);
            Console.WriteLine($"Circle length = {сircle.Circle_length}");
            Console.WriteLine($"Area circle = {сircle.Area_circle}");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.GAME
{
    public abstract class BONUS : TERRITORY
    {
        public BONUS(int x, int y, int speedincrease)
        {
            if (x >= base.X & x <= 0)
            {
                throw new Exception("bonus can not be located abroad, error x");
            }

            if (y >= base.Y & y <= 0)
            {
                throw new Exception("bonus can not be located abroad, error y");
            }

            if (speedincrease > 0)
            {
                throw new Exception("speed bonus can not be negative");
            }

            if (this.Effecttime > 0)
            {
                throw new Exception("time bonus can not be negative");
            }

            this.X = x;
            this.Y = y;
            this.Speedincrease = speedincrease;
        }

        public new int X { get; set; }

        public new int Y { get; set; }

        public int Speedincrease { get; set; }

        public int Effecttime { get; set; }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Epam.Task8.REGULAREXPRESSIONS.EMAILFINDER
{
    public class Program
    {
       public static void Main(string[] args)
        {
            Console.WriteLine("enter a string with email addresses");
            string text = Console.ReadLine();
            string regstr = @"\b[\w\.-]+@[\w\.-]+\.\w{2,6}\b";
            var regex = new Regex(regstr);
            var match = regex.Matches(text);

            if (match.Count > 0)
            {
                Console.WriteLine("managed to find the following addresses");
                foreach (var item in match)
                {
                    Console.WriteLine(item);
                }
            }
            else
            {
                Console.WriteLine("email addresses not found");
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task1._2
{
    class Program
    {
        public static void SIMPLE(int n)
        {
            for (int i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                {
                    Console.WriteLine("the number is not simple");
                    return;
                }
            }
            Console.WriteLine("the number is simple");

        }
        static void Main(string[] args)
        {
            Console.WriteLine("enter a number more than 0");

            while (true)
            {
                try
                {
                    int n = int.Parse(Console.ReadLine());
                    if (n > 0)
                    {
                        SIMPLE(n);
                        break;
                    }
                    else
                    {
                        throw new Exception("Not this, enter a number more than 0");
                    }
                }
                catch
                {
                    Console.WriteLine("Not this, enter a number more than 0");
                }
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Epam.Task8.REGULAREXPRESSIONS.TIMECOUNTER
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("enter a string with time");
            string text = Console.ReadLine();
            string regstr = @"\s+([01]?[0-9]|2[0-3]):[0-5][0-9]";
            var regex = new Regex(regstr, RegexOptions.IgnoreCase);
            Console.WriteLine($"time met in the text {regex.Matches(text).Count} times");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Epam.Task8.REGULAREXPRESSIONS.DATEEXISTANCE
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("enter a string with date");
            string text = Console.ReadLine();
            string regstr = "(0[1-9]|[12][0-9]|3[01])[-](0[1-9]|1[012])[-](19|20)[0-9]{2}";
            var regex = new Regex(regstr, RegexOptions.IgnoreCase);
            Console.WriteLine("in a string there is a date. " + regex.IsMatch(text));
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.TRIANGLE
{
    public class TRIANGLE
    {
        private double a;
        private double b;
        private double c;

        public TRIANGLE(double a, double b, double c)
        {
            if (a <= 0 || b <= 0 || c <= 0)
            {
                throw new Exception("the side of the triangle cannot be less than or equal to 0");
            }

            if (a + b <= c || a + c <= b || b + c <= a)
            {
                throw new Exception("the sum of the two sides cannot be more or equal than the other");
            }

             this.a = a;
             this.b = b;
             this.c = c;
        }

        public double CalcPerimeter()
        {
            return this.a + this.b + this.c;
        }

        public double CalcArea()
        {
            double p = (this.a + this.b + this.c) / 2;
            return Math.Sqrt(p * (p - this.a) * (p - this.b) * (p - this.c));
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.GAME
{
    public abstract class MOVINGOBJECT : TERRITORY
    {
        public MOVINGOBJECT(int x, int y, int speed)
        {
            if (x >= base.X & x <= 0)
            {
                throw new Exception("object can not be located abroad, error x");
            }

            if (y >= base.Y & y <= 0)
            {
                throw new Exception("object can not be located abroad, error y");
            }

            if (speed > 0)
            {
                throw new Exception("object can not be negative");
            }

            this.X = x;
            this.Y = y;
            this.Speed = speed;
        }

        public new int X { get; set; }

        public new int Y { get; set; }

        public int Speed { get; set; }

        public void Move(int x, int y, BARRIER barrier)
        {
            if (!(barrier.X == this.X + x) & !(barrier.Y == this.Y + y))
            {
                if (x >= base.X & x <= 0)
                {
                    throw new Exception("object can not be located abroad, error x");
                }

                if (y >= base.Y & y <= 0)
                {
                    throw new Exception("object can not be located abroad, error y");
                }

                this.X = x;
                this.Y = y;
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Epam.Task5.SORTING_UNIT
{
    public class Program
    {
        public static void Main(string[] args)
        {
            SORTINGUNIT ty = new SORTINGUNIT();
            int[] array = { 15, 7, -5, 6, 4 };
            Console.WriteLine("enter an unsorted array");

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("apply our method and output an array");

            ty.Already += ty.Conclusion;
            ty.Sortflow(array, ty.Compareint);
            while (true)
            {
                if (!ty.Th.IsAlive)
                {
                    break;
                }

                Console.WriteLine("wait another flow...");
            }

            foreach (var item in array)
            {
                Console.WriteLine(item);
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.VECTOR_GRAPHICS_EDITOR
{
    public class CIRCUMFERENCE : ROUND.ROUND
    {
        private double radiustwo;

        public CIRCUMFERENCE(double radius, double x, double y, double radiustwo)
            : base(radius, x, y)
        {
            if (radiustwo < 0)
            {
                throw new Exception("radius two should be positive");
            }

            this.radiustwo = radiustwo;
        }

        public double Radiustwo
        {
            get
            {
                return this.radiustwo;
            }
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Epam.Task3.GAME
{
    public abstract class BARRIER : TERRITORY 
    {
        public BARRIER(int x, int y, string color)
        {
            if (x >= base.X & x <= 0)
            {
                throw new Exception("barrier can not be located abroad, error x");
            }

            if (y >= base.Y & y <= 0)
            {
                throw new Exception("barrier can not be located abroad, error y");
            }

            this.X = x;
            this.Y = y;
            this.Color = color;
        }

        public new int X { get; set; }

        public new int Y { get; set; }

        public string Color { get; set; }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.BLL.Interface
{
    public interface IUserLogic
    {
        void Add(User user);

        void Delete(int id);

        string GetAll();

        string ShowAwards(int id);
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.DAL.Interface
{
    public interface IUserDao
    {
        void Add(User user);

        void Delete(int id);

        string GetAll();

        string ShowAwards(int id);
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.Task7.USERS.DAL.Interface;
using Epam.Task7.USERS.Entities;

namespace Epam.Task7.USERS.DAL
{
    public class AwardDao : IAwardDao
    {
        private static string path = System.IO.Path.GetTempPath() + "awards.txt";
        private static string pathusersandawards = System.IO.Path.GetTempPath() + "usersandawards.txt";

        public void AddAward(Award award)
        {
            int k = 0;
            StreamWriter output = new StreamWriter(path, true);
            output.Close();

            StreamReader input = new StreamReader(path);
            string str = input.ReadToEnd();

            for (int i = 0; i < str.Length; i++)
            {
                if (str[0].Equals('1') & i == 0)
                {
                    k++;
                }

                if (i == str.Length - 1)
                {
                    break;
                }

                if (str[i].Equals((char)13) & str[i + 1].Equals((char)10))
                {
                    k++;
                }
            }

            input.Close();
            output = new StreamWriter(path, true);
            award.Id = k;
            output.WriteLine(award.ToString());
            output.Close();
        }

        public void Delete(int id)
        {
            StreamReader input = new StreamReader(path);

            string str = input.ReadToEnd();
            input.Close();
            int k = 0;
            int firstchar = -1;

            for (int i = 0; i < str.Length; i++)
            {
                if (i == str.Length - 1)
                {
                    break;
                }

                if (str[i].Equals((char)13) & str[i + 1].Equals((char)10))
                {
                    if (id == 0)
                    {
                        str = str.Remove(0, i);
                        str = str.Insert(0, "delete");
                        break;
                    }

                    k++;
                    if (firstchar >= 0)
                    {
                        str = str.Remove(firstchar, i - firstchar);
                        str = str.Insert(firstchar, "\r" + "\n" + "delete");
                        break;
                    }

                    if (k == id)
                    {
                        firstchar = i;
                    }
                }
            }

            StreamWriter output = new StreamWriter(path, false);
            output.Write(str);
            output.Close();
        }

        public string GetAll()
        {
            StreamWriter output = new StreamWriter(path, true);
            output.Close();
            StreamReader input = new StreamReader(path);

            string str = input.ReadToEnd();
            input.Close();
            return str;
        }

        public void AddAwardForUser(int iduser, int idaward)
        {
            StreamWriter output = new StreamWriter(pathusersandawards, true);

            output.WriteLine(iduser + " " + idaward);
            output.Close();
        }

        public string GetById(int id)
        {
            StreamWriter output = new StreamWriter(path, true);
            output.Close();
            StreamReader input = new StreamReader(path);
            string str = input.ReadToEnd();
            string[] delid;
            input.Close();

            for (int i = 0; i < str.Length; i++)
            {
                if ((str[0] + string.Empty).Equals(id.ToString()) & i == 0)
                {
                    for (int j = 0; j < str.Length; j++)
                    {
                        if (str[j].Equals((char)13) & str[j + 1].Equals((char)10))
                        {
                            str = str.Remove(j, str.Length - j);
                            delid = str.Split(' ');
                            str = delid[1];
                            return str;
                        }
                    }
                }

                if (i == str.Length - 2)
                {
                    break;
                }

                string idfromfile = str[i + 2] + string.Empty;

                if (str[i].Equals((char)13) & str[i + 1].Equals((char)10))
                {
                    if (idfromfile.Equals(id.ToString()))
                    {
                        for (int j = i + 2; j < str.Length; j++)
                        {
                            if (str[j].Equals((char)13) & str[j + 1].Equals((char)10))
                            {
                                str = str.Remove(j, str.Length - j);
                                delid = str.Split(' ');
                                str = delid[delid.Length - 1];
                                return str;
                            }
                        }
                    }
                }
            }

            return null;
        }
        public void AddImage(int id)
        {
            Directory.CreateDirectory(System.IO.Path.GetTempPath() + "imageaward\\");

        }
    }
}
