Beispiel #1
0
        protected void btnModifica_Click(object sender, ImageClickEventArgs e)
        {
            if (ModificaButtonClicked != null)
            {
                DealerBusiness dealerBusiness = new DealerBusiness();

                int    idDealer       = Convert.ToInt32(IDDealerBusiness);
                string codiceDealer   = txtCodiceDealer.Text;
                string ragioneSociale = txtRagioneSociale.Text;
                string indirizzo      = txtIndirizzo.Text;

                ModificheDealerBusinessEventArgs args = new ModificheDealerBusinessEventArgs(idDealer, codiceDealer, ragioneSociale, indirizzo);

                ModificaButtonClicked(sender, args);
            }
        }
Beispiel #2
0
        internal string UpdateDealerBusiness(DealerBusiness obj)
        {
            sqlop = new SqlOperations();
            sqlop.databaseConnection = ConfigurationManager.ConnectionStrings["cs"].ToString();

            DbParameter[] dbp = new DbParameter[4];

            dbp[0] = new SqlParameter();
            dbp[0].ParameterName = "IDDealerBusiness";
            dbp[0].DbType        = DbType.Int32;
            dbp[0].Direction     = ParameterDirection.Input;
            dbp[0].Value         = obj.IDDealerBusiness;

            dbp[1] = new SqlParameter();
            dbp[1].ParameterName = "Codice";
            dbp[1].DbType        = DbType.String;
            dbp[1].Direction     = ParameterDirection.Input;
            dbp[1].Value         = obj.Codice;

            dbp[2] = new SqlParameter();
            dbp[2].ParameterName = "Nome";
            dbp[2].DbType        = DbType.String;
            dbp[2].Direction     = ParameterDirection.Input;
            dbp[2].Value         = obj.Nome;

            dbp[3] = new SqlParameter();
            dbp[3].ParameterName = "Indirizzo";
            dbp[3].DbType        = DbType.String;
            dbp[3].Direction     = ParameterDirection.Input;
            dbp[3].Value         = obj.Indirizzo;

            SqlCommandObject sco = new SqlCommandObject();

            sco.SPName   = "Dealer.SP_DealerBusiness_Update";
            sco.SPParams = dbp;

            DataTable dt;
            string    proc = sqlop.ExecuteProcedure(sco, out dt);

            if (proc != string.Empty)
            {
                return(proc);
            }

            return("");
        }
Beispiel #3
0
        public Dealer Add(Dealer dealer)
        {
            try
            {
                var bd = new DealerBusiness();
                return(bd.Add(dealer));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
Beispiel #4
0
        public void Remove(int id)
        {
            try
            {
                var bc = new DealerBusiness();
                bc.Remove(id);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
Beispiel #5
0
        public void Edit(Dealer category)
        {
            try
            {
                var bc = new DealerBusiness();
                bc.Edit(category);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
Beispiel #6
0
        public void Edit(Dealer dealer)
        {
            try
            {
                var dc = new DealerBusiness();
                dealer.ChangedOn = System.DateTime.Now;
                dc.Edit(dealer);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
        public Dealer Add(Dealer Dealer)
        {
            try
            {
                //instancia de la business
                var bc = new DealerBusiness();
                return(bc.Add(Dealer));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
Beispiel #8
0
        public FindDealerResponse Find(int id)
        {
            try
            {
                var response = new FindDealerResponse();
                var dc       = new DealerBusiness();
                response.Result = dc.Find(id);
                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
Beispiel #9
0
        public AllDealerResponse All()
        {
            try
            {
                var response = new AllDealerResponse();
                var bd       = new DealerBusiness();
                response.Result = bd.All();
                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
Beispiel #10
0
        protected void btnAggiungiImageButton_Click(object sender, ImageClickEventArgs e)
        {
            DealerBusiness cr = (DealerBusiness)Parent.Page;

            cr.showAggiungiPopup();
        }
        internal string UpdateDealerBusiness(DealerBusiness obj)
        {
            sqlop = new SqlOperations();
            sqlop.databaseConnection = ConfigurationManager.ConnectionStrings["cs"].ToString();

            DbParameter[] dbp = new DbParameter[4];

            dbp[0] = new SqlParameter();
            dbp[0].ParameterName = "IDDealerBusiness";
            dbp[0].DbType = DbType.Int32;
            dbp[0].Direction = ParameterDirection.Input;
            dbp[0].Value = obj.IDDealerBusiness;

            dbp[1] = new SqlParameter();
            dbp[1].ParameterName = "Codice";
            dbp[1].DbType = DbType.String;
            dbp[1].Direction = ParameterDirection.Input;
            dbp[1].Value = obj.Codice;

            dbp[2] = new SqlParameter();
            dbp[2].ParameterName = "Nome";
            dbp[2].DbType = DbType.String;
            dbp[2].Direction = ParameterDirection.Input;
            dbp[2].Value = obj.Nome;

            dbp[3] = new SqlParameter();
            dbp[3].ParameterName = "Indirizzo";
            dbp[3].DbType = DbType.String;
            dbp[3].Direction = ParameterDirection.Input;
            dbp[3].Value = obj.Indirizzo;

            SqlCommandObject sco = new SqlCommandObject();
            sco.SPName = "Dealer.SP_DealerBusiness_Update";
            sco.SPParams = dbp;

            DataTable dt;
            string proc = sqlop.ExecuteProcedure(sco, out dt);

            if (proc != string.Empty)
                return proc;

            return "";
        }