public async Task <IActionResult> Edit(int id, [Bind("EnterpriceId,Name,Tel,Address,Observations")] Enterprice enterprice)
        {
            if (id != enterprice.EnterpriceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enterprice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnterpriceExists(enterprice.EnterpriceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(enterprice));
        }
Exemple #2
0
        public int UpdateEnterpriceInfo0(Enterprice enterprice)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update Enterprice set Enterprice_FullName=@fullName,Enterprice_ShortName=@shortName,Enterprice_Url=@url,Enterprice_Introduction=@introduction,Enterprice_Location=@location,Enterprice_LocationCity=@locationCity,Enterprice_Scale=@scale where Enterprice_Email like @email");
            SqlParameter[] par =
            {
                new SqlParameter("@fullName",     SqlDbType.Text),
                new SqlParameter("@shortName",    SqlDbType.Text),
                new SqlParameter("@url",          SqlDbType.Text),
                new SqlParameter("@introduction", SqlDbType.Text),
                new SqlParameter("@location",     SqlDbType.Text),
                new SqlParameter("@locationCity", SqlDbType.Text),
                new SqlParameter("@scale",        SqlDbType.Text),
                new SqlParameter("@email",        SqlDbType.Text)
            };
            par[0].Value = enterprice.Enterprice_FullName;
            par[1].Value = enterprice.Enterprice_ShortName;
            par[2].Value = enterprice.Enterprice_Url;
            par[3].Value = enterprice.Enterprice_Introduction;
            par[4].Value = enterprice.Enterprice_Location;
            par[5].Value = enterprice.Enterprice_LocationCity;
            par[6].Value = enterprice.Enterprice_Scale;
            par[7].Value = enterprice.Enterprice_Email;
            return(Common.DbHelperSQL.ExecuteSql(sql.ToString(), par));
        }
Exemple #3
0
        public Enterprice GetEnterpriceID(string email)
        {
            OxcoderIFactory.IFactory       factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.EnterpriseInfoIDAL en      = factory.getEnterpriseInstance();
            Enterprice enterprice = en.GetEnterpriceID(email);

            return(enterprice);
        }
Exemple #4
0
        public override string ToString()
        {
            string info = Enterprice.GetInfo(UserName);

            if (info == null || info.Count() == 0)
            {
                return("Инофрмации о вас не обнаружено.");
            }
            return(Status + " " + info);
        }
        public async Task <IActionResult> Create([Bind("EnterpriceId,Name,Tel,Address,Observations")] Enterprice enterprice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enterprice);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(enterprice));
        }
Exemple #6
0
        public Enterprice GetEnterpriceID(string email)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("select Enterprice_ID,Enterprice_FullName from [Enterprice] where Enterprice_Email like @email");
            SqlParameter[] par =
            {
                new SqlParameter("@email", SqlDbType.Text)
            };
            par[0].Value = email;
            SqlDataReader rd         = Common.DbHelperSQL.ExecuteReader(sql.ToString(), par);
            Enterprice    enterprice = new Enterprice();

            if (rd.Read())
            {
                enterprice.Enterprice_ID       = rd["Enterprice_ID"].ToString();
                enterprice.Enterprice_FullName = rd["Enterprice_FullName"].ToString();
            }
            return(enterprice);
        }
Exemple #7
0
        public bool Add(string login, string password, string userName, ClassOfDriver qualification)
        {
            UserDriver driver = new UserDriver(login, password, userName);

            if (connector.Create(driver) != null)
            {
                bool result = Enterprice.AddDriver(userName, qualification);
                if (result)
                {
                    return(true);
                }
                else
                {
                    connector.Delete(driver.Id);
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #8
0
 public List <string> GetWaybills(string UserName)
 {
     return(Enterprice.GetWaybillsByUserName(UserName));
 }
Exemple #9
0
 public bool AddVan(double GasUse, int PassCapacity)
 {
     return(Enterprice.AddVan(GasUse, PassCapacity));
 }
Exemple #10
0
 public bool AddTruck(double GasUse, double Capacity)
 {
     return(Enterprice.AddTruck(GasUse, Capacity));
 }
Exemple #11
0
 public bool AddBus(double GasUse, double Capacity, int PassCapacity)
 {
     return(Enterprice.AddBus(GasUse, PassCapacity, Capacity));
 }
Exemple #12
0
 public bool AddWayBill(double distance, DateTime dateTime, int carid, int driverid)
 {
     return(Enterprice.AddWayBill(distance, dateTime, carid, driverid));
 }
Exemple #13
0
 public int UpdateEnterpriceInfo0(Enterprice enterprice)
 {
     OxcoderIFactory.IFactory       factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.EnterpriseInfoIDAL dalad   = factory.getEnterpriseInstance();
     return(dalad.UpdateEnterpriceInfo0(enterprice));
 }
Exemple #14
0
 public string GetProfit(Waybill wb)
 {
     return(Enterprice.GetProfit(wb).ToString());
 }
Exemple #15
0
 public Waybill Update(Waybill wb)
 {
     return(Enterprice.Update(wb));
 }
Exemple #16
0
 public Drivers.Driver Update(Drivers.Driver driver)
 {
     return(Enterprice.Update(driver));
 }
Exemple #17
0
 public bool Remove(Waybill wb)
 {
     return(Enterprice.Delete(wb));
 }
Exemple #18
0
 public bool Remove(Car car)
 {
     return(Enterprice.Delete(car));
 }
Exemple #19
0
 public string GetFullProfit()
 {
     return(Enterprice.GetFullProfit().ToString());
 }
Exemple #20
0
 public Car Update(Car car)
 {
     return(Enterprice.Update(car));
 }
Exemple #21
0
 public bool Remove(Drivers.Driver driver)
 {
     return(Enterprice.Delete(driver));
 }
Exemple #22
0
 public string GetMostProfitDrivers(DateTime bottom, DateTime up, string carType)
 {
     return(Enterprice.GetMostProfitDriver(bottom, up, carType));
 }