protected void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                ShipperServiceClient client = new ShipperServiceClient();
                Label4.Text = "";
                var shipper = new Shipper
                {
                   

                CompanyName = shipperCompanyNameText.Text,
                    Phone = shipperPhoneText.Text,
                    ShipperId = int.Parse(shipperIdTextResult.Text)
                };
                bool flag = client.UpdateShipper(shipper);
                if (flag == true)
                    Label4.Text = "Allting uppdaterades som det skulle!";
                else
                    Label4.Text = "Något gick fel när datan skulle sparas i databasen";
            }
            catch (Exception ex)
            {
                Label5.Text = "Something went wrong " + ex.Message;
                
            }
            
        }
 /// <summary>
 /// FrmAddShipper()
 /// Form Constructor
 /// </summary>
 /// <param name="businessArg"></param>
 public FrmAddShipper(Business businessArg)
 {
     InitializeComponent();
     business = businessArg;
     newShipper = new Shipper();
     updatedShipper = new Shipper();
 }
Ejemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Lbl_Succsess.Text = "";
            try
            {
                ShipperServiceClient client = new ShipperServiceClient();

                var updatedShipper = new Shipper
                {
                    ShipperID = int.Parse(Tbx_Id.Text),
                    CompanyName = Tbx_Name.Text,
                    Phone = Tbx_Phone.Text 
                };

                var result = client.UpdateShipper(updatedShipper);

                if (result == true)
                    Lbl_Succsess.ForeColor = Color.Green;
                Lbl_Succsess.Text = "The shipper has been updated";
            }

            catch (FaultException ex)
            {
                Lbl_Succsess.ForeColor = Color.Red;
                Lbl_Succsess.Text = "FaultException" + ex.Message;
            }

            catch (Exception)
            {
                Lbl_Succsess.ForeColor = Color.Red;
                Lbl_Succsess.Text = "Error!";
            }
          
        }
Ejemplo n.º 4
0
        public void RunTests()
        {
            session = NHSessionHelper.OpenSession();
            transaction = session.BeginTransaction();

            shipper = session.CreateCriteria(typeof(Shipper))
                    .Add(Restrictions.Eq("ShipperID", 2)).UniqueResult<Shipper>();
        }
Ejemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var client = new ShipperServiceClient();
            var shipper = new Shipper
            {
                ShipperId = int.Parse(TxtBoxTwo.Text),
                CompanyName = txtBoxThree.Text,
                Phone = txtBoxFour.Text
            };

            client.SaveShipper(shipper);
        }
Ejemplo n.º 6
0
 public ActionResult SaveShipper(Shipper shipper)
 {
     try
     {
         client.SaveShipper(shipper);
     }
     catch (Exception ex)
     {
         return Content(ex.Message);
     }
     return Content("Successfully updated shipper");
 }
Ejemplo n.º 7
0
        public void UpdateShipper(Shipper info)
        {
            //throw new NotImplementedException();
            //todo: give this to the new guy - i'm on holidays :) :)
            // http://stackoverflow.com/questions/15336248/entity-framework-5-updating-a-record

            using (var context = new NWContext())
            {
                context.Shippers.Attach(info);
                context.Entry(info).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
Ejemplo n.º 8
0
        public async Task UpdateShipper(Shipper shipper)
        {
            try
            {
                HttpContent httpContent = new StringContent(JsonConvert.SerializeObject(shipper), Encoding.UTF8);

                await httpClient.PutAsync($"Shippers/{shipper.ShipperID}", httpContent);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 9
0
        public async Task AddShipper(Shipper shipper)
        {
            try
            {
                HttpContent httpContent = new StringContent(JsonConvert.SerializeObject(shipper), Encoding.UTF8);

                await httpClient.PostAsync("Shippers", httpContent);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 10
0
 public async Task <Shipper> CreateShipper(Shipper shipper)
 {
     try
     {
         context.Shippers.Add(shipper);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         return(null);
     }
     return(shipper);
 }
        Shipper IShipper.UpdateShipper(Shipper model)
        {
            Shipper updateShipper = _context.Shippers.Find(model.Id);

            if (updateShipper != null)
            {
                updateShipper.Name        = model.Name;
                updateShipper.PhoneNumber = model.PhoneNumber;
                _context.Shippers.Update(updateShipper);
                _context.SaveChanges();
            }
            return(updateShipper);
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                MessageBox.Show("Lütfen veri içeriği bulunana hücreleri seçiniz. Kolon ismi seçmeyiniz.");
                return;
            }
            id = (int)dataGridView1.Rows[e.RowIndex].Cells["ShipperID"].Value;
            Shipper bulunanKat = nakliyeciRep.Bul(id);

            txtCompanyName.Text = bulunanKat.CompanyName;
            txtPhone.Text       = bulunanKat.Phone;
        }
Ejemplo n.º 13
0
        public ActionResult Create([Bind(Include = "ShipID,ShipVIA,FIrstName,LastName,Company,Address_1,Address_2,City,Country,StateID,ZipCode,Phone,Residential,Commercial,Notes,BalloonID")] Shipper shipper)
        {
            if (ModelState.IsValid)
            {
                db.Shippers.Add(shipper);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BalloonID = new SelectList(db.Balloons, "BalloonID", "SerialNo", shipper.BalloonID);
            ViewBag.StateID   = new SelectList(db.States, "StateID", "StateName", shipper.StateID);
            return(View(shipper));
        }
Ejemplo n.º 14
0
        public MainPage()
        {
            this.InitializeComponent();

            this.auditor            = new Auditor();
            this.shipper            = new Shipper();
            this.checkoutController = new CheckoutController();
            this.checkoutController.CheckoutProcessing += this.auditor.AuditOrder;
            this.checkoutController.CheckoutProcessing += this.shipper.ShipOrder;

            this.auditor.AuditProcessingComplete += this.displayMessage;
            this.shipper.ShipProcessingComplete  += this.displayMessage;
        }
Ejemplo n.º 15
0
        public MainWindow()
        {
            InitializeComponent();

            _auditor            = new Auditor();
            _shipper            = new Shipper();
            _checkoutController = new CheckoutController();
            _checkoutController.CheckoutProcessing += _auditor.AuditOrder;
            _checkoutController.CheckoutProcessing += _shipper.ShipOrder;

            _auditor.AuditProcessingComplete += DisplayMessage;
            _shipper.ShipProcessingComplete  += DisplayMessage;
        }
Ejemplo n.º 16
0
    static void Main()
    {
        using (var dbCon = new NorthwindTwinEntities())
        {
            var shipper = new Shipper()
            {
                Phone       = "08954654",
                CompanyName = "gosho ood"
            };

            dbCon.Shippers.Add(shipper);
        }
    }
Ejemplo n.º 17
0
 public ActionResult Create(Shipper collection)
 {
     try
     {
         db.Shippers.Add(collection);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Ejemplo n.º 18
0
 public ActionResult Edit(Shipper shipper)
 {
     if (ModelState.IsValid)
     {
         shipperRepository.InsertOrUpdate(shipper);
         shipperRepository.Save();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }
Ejemplo n.º 19
0
 public Shipper ToModel(Shipper shipper = null)
 {
     if (shipper == null)
     {
         shipper    = new Shipper();
         shipper.Id = Guid.NewGuid();
     }
     shipper.IdNavigation.Role = 4;
     shipper.Name  = this.Name;
     shipper.Age   = this.Age;
     shipper.Phone = this.Phone;
     return(shipper);
 }
Ejemplo n.º 20
0
        public void InsertShipper(Shipper shipper)
        {
            DbEntityEntry <Shipper> entityEntry = this.DbContext.Entry(shipper);

            if ((entityEntry.State != EntityState.Detached))
            {
                entityEntry.State = EntityState.Added;
            }
            else
            {
                this.DbContext.Shippers.Add(shipper);
            }
        }
        public async Task<Shipper> Add(Shipper entity)
        {
            if (entity.Id == null) {
                entity.Id = Guid.NewGuid().ToString();
            }

            entity.CreatedDate = DateTime.UtcNow;
            entity.UpdatedDate = DateTime.UtcNow;

            await _context.Shippers.AddAsync(entity);
            await _context.SaveChangesAsync();
            return entity;
        }
Ejemplo n.º 22
0
        public ActionResult CheckOut()
        {
            List <CartProduct> myCart = (List <CartProduct>)Session["cart"];

            if (Session["customer"] != null)
            {
                Customer cus = (Customer)Session["customer"];

                Order newOrder = new Order();
                newOrder.OrderDate     = DateTime.Now;
                newOrder.OrderStatus   = Model.Entities.Enum.OrderStatus.Processing;
                newOrder.CustomerID    = cus.ID;
                newOrder.BillAddressID = cus.BillAddressID;
                newOrder.ShipAddressID = cus.ShipAddressID;

                List <Shipper> shippers = ss.GetActive();
                int            r        = rnd.Next(shippers.Count - 1);
                Shipper        s        = shippers[r];

                newOrder.ShipperID = s.ID;
                os.Add(newOrder);

                ViewBag.OrderID     = newOrder.ID;
                ViewBag.ShipperName = s.CompanyName;

                foreach (CartProduct item in myCart)
                {
                    OrderDetail detail = new OrderDetail();
                    detail.OrderID   = newOrder.ID;
                    detail.BookID    = item.ID;
                    detail.Quantity  = (short?)item.Quantity;
                    detail.UnitPrice = item.Price;

                    Book b = bs.GetByID(item.ID);
                    b.HowManySold += item.Quantity;
                    bs.Update(b);

                    newOrder.OrderDetails.Add(detail);
                }

                os.Update(newOrder);

                Session["cart"] = null;
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }

            return(View(myCart));
        }
Ejemplo n.º 23
0
        // DELETE: odata/Shippers(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            Shipper shipper = await db.Shippers.FindAsync(key);

            if (shipper == null)
            {
                return(NotFound());
            }

            db.Shippers.Remove(shipper);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 24
0
        public ActionResult Save(Shipper data)
        {
            /*return Json(data, JsonRequestBehavior.AllowGet);*/

            if (data.ShipperID == 0)
            {
                DataService.AddShipper(data);
            }
            else
            {
                DataService.UpdateShipper(data);
            }
            return(RedirectToAction("Index", "Shippers"));
        }
Ejemplo n.º 25
0
 public ActionResult Edit([Bind(Include = "ShipperID,CompanyName,Phone")] Shipper shipper)
 {
     if (Session["a"] == null && (int)Session["shid"] == shipper.ShipperID && Session["eid"] == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
     }
     if (ModelState.IsValid)
     {
         db.Entry(shipper).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(shipper));
 }
        /// <summary>
        /// Creator: Dalton Reierson
        /// Created: 2020/04/29
        /// Approver: Brandyn T. Coverdill
        /// Approver:
        ///
        /// fake to create shipper
        /// </summary>
        ///
        /// <remarks>
        /// Updated By:
        /// Updated:
        /// Update:
        /// </remarks>
        public bool createShipper(Shipper shipper)
        {
            bool shipperID  = shipper.ShipperID.Equals("100000");
            bool complaimnt = shipper.Complaint.Equals("no");

            if (shipperID && complaimnt)
            {
                return(true);
            }
            else
            {
                throw new ApplicationException("Cannot add new orderLine.");
            }
        }
Ejemplo n.º 27
0
        public MainWindow()
        {
            this.InitializeComponent();
            Window.Current.SizeChanged += App.WindowSizeChanged;

            this.auditor            = new Auditor();
            this.shipper            = new Shipper();
            this.checkoutController = new CheckoutController();
            this.checkoutController.CheckoutProcessing += this.auditor.AuditOrder;
            this.checkoutController.CheckoutProcessing += this.shipper.ShipOrder;

            this.auditor.AuditProcessingComplete += this.displayMessage;
            this.shipper.ShipProcessingComplete  += this.displayMessage;
        }
Ejemplo n.º 28
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Limit?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Case?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Carrier?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Shipper?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (MailShipper.GetHashCode());
            hashCode = hashCode * -1521134295 + (MailCarrier.GetHashCode());
            hashCode = hashCode * -1521134295 + (CustomMail?.GetHashCode() ?? 0);
            return(hashCode);
        }
Ejemplo n.º 29
0
        // DELETE: odata/Shippers(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            Shipper shipper = db.Shippers.Find(key);

            if (shipper == null)
            {
                return(NotFound());
            }

            db.Shippers.Remove(shipper);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 30
0
        // GET: /Shippers/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipper shipper = db.Shippers.Find(id);

            if (shipper == null)
            {
                return(HttpNotFound());
            }
            return(View(shipper));
        }
Ejemplo n.º 31
0
        public async Task Update(Shipper item)
        {
            var shipper = Shippers.SingleOrDefault(r => r.ShipperID == item.ShipperID);

            if (shipper != null)
            {
                shipper = item;
                await Task.CompletedTask;
            }
            else
            {
                throw new GridException("SHISRV-02", "Error updating the shipper");
            }
        }
Ejemplo n.º 32
0
        public IHttpActionResult DeleteShipper(int id)
        {
            Shipper shipper = db.Shippers.Find(id);

            if (shipper == null)
            {
                return(NotFound());
            }

            db.Shippers.Remove(shipper);
            db.SaveChanges();

            return(Ok(shipper));
        }
Ejemplo n.º 33
0
        public ServiceResponse <Shipper> UpdateShipper(Shipper c)
        {
            Func <Shipper> f = delegate
            {
                var e = _APIContext.Entry(c);
                e.State = EntityState.Modified;

                _APIContext.SaveChanges();

                return(c);
            };

            return(this.Execute(f));
        }
        public ActionResult CreateShipper(Shipper ship)
        {
            if (ModelState.IsValid)
            {
                using (MySqlConnection conn = DBUtils.GetConnection())
                {
                    ShipperRepository repo = new ShipperRepository(conn);
                    repo.Save(ship);
                }

                return(RedirectToAction("Shippers"));
            }
            return(View(ship));
        }
Ejemplo n.º 35
0
 public HttpResponseMessage PostFlight([FromBody] Shipper shp)
 {
     try
     {
         QueryManager.GetInstance().Insert_Shipping(shp);
         var message = Request.CreateResponse(HttpStatusCode.Created, shp);
         message.Headers.Location = new Uri(Request.RequestUri + shp.SHIPPING_ID.ToString());
         return(message);
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Ejemplo n.º 36
0
        public void DeleteShipper(Shipper shipper)
        {
            DbEntityEntry <Shipper> entityEntry = this.DbContext.Entry(shipper);

            if ((entityEntry.State != EntityState.Deleted))
            {
                entityEntry.State = EntityState.Deleted;
            }
            else
            {
                this.DbContext.Shippers.Attach(shipper);
                this.DbContext.Shippers.Remove(shipper);
            }
        }
Ejemplo n.º 37
0
        public void SaveShopper(Shipper shipper)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                var command = connection.CreateCommand();
                command.Parameters.AddWithValue("@CompanyName", shipper.CompanyName);
                command.Parameters.AddWithValue("@Phone", shipper.Phone);
                command.Parameters.AddWithValue("@ID", shipper.ID);

                command.CommandText = @"UPDATE [dbo].[Shippers]
                                        SET [CompanyName] = @CompanyName ,
                                        [Phone] = @Phone
                                        WHERE [ShipperID] = @ID";
                connection.Open();
                command.ExecuteNonQuery();
            }
        }
 public void SaveShipper(Shipper shipper)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append("UPDATE Shippers set phone=@Phone, ");
     sql.Append("companyName=@CompanyName WHERE shipperId = @ShipperId ");
     SqlConnection cnn = new SqlConnection(_cnnString);
     SqlCommand cmd = new SqlCommand(sql.ToString(), cnn);
     cmd.Parameters.Add("Phone", SqlDbType.NVarChar, 24).Value =
     shipper.Phone;
     cmd.Parameters.Add("CompanyName", SqlDbType.NVarChar, 40).Value =
     shipper.CompanyName;
     cmd.Parameters.Add("ShipperId", SqlDbType.Int, 0).Value =
     shipper.ShipperId;
     cnn.Open();
     cmd.ExecuteNonQuery();
     cnn.Close();
 }
 public Shipper GetShipper(int shipperId)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append("SELECT shipperId, companyName, phone ");
     sql.Append("FROM shippers WHERE (shipperId = @ShipperId) ");
     SqlConnection cnn = new SqlConnection(_cnnString);
     SqlCommand cmd = new SqlCommand(sql.ToString(), cnn);
     cmd.Parameters.Add("ShipperId", SqlDbType.Int, 0).Value = shipperId;
     SqlDataAdapter adp = new SqlDataAdapter(cmd);
     DataSet ds = new DataSet();
     adp.Fill(ds);
     Shipper s = new Shipper();
     s.ShipperId = shipperId;
     s.CompanyName = ds.Tables[0].Rows[0]["companyName"].ToString();
     s.Phone = ds.Tables[0].Rows[0]["phone"].ToString();
     return s;
 }
Ejemplo n.º 40
0
        public Shipper GetShipper(string queryString, Shipper shipper)
        {

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                var command = new SqlCommand(queryString, connection);
                connection.Open();
                var reader = command.ExecuteReader();
                while (reader.Read())
                {
                    shipper.ID = reader[0].ToString();
                    shipper.CompanyName = reader[1].ToString();
                    shipper.Phone = reader[2].ToString();
                }
                reader.Close();

                return shipper;
            }
        }
Ejemplo n.º 41
0
        /// <summary>業務処理を実装</summary>
        /// <param name="muParameter">汎用引数クラス</param>
        private void UOC_Select(MuParameterValue muParameter)
        {
            // 戻り値クラスを生成して、事前に戻り地に設定しておく。
            MuReturnValue muReturn = new MuReturnValue();
            this.ReturnValue = muReturn;

            // ↓業務処理-----------------------------------------------------
            DataTable dt = null;
            Shipper shipper = null;

            switch ((muParameter.ActionType.Split('%'))[1])
            {
                case "common": // 共通Daoを使用する。

                    // 共通Daoを生成
                    CmnDao cmnDao = new CmnDao(this.GetDam());

                    switch ((muParameter.ActionType.Split('%'))[2])
                    {
                        case "static":
                            // 静的SQLを指定
                            cmnDao.SQLFileName = "ShipperSelect.sql";
                            break;

                        case "dynamic":
                            // 動的SQLを指定
                            cmnDao.SQLFileName = "ShipperSelect.xml";
                            break;
                    }

                    // パラメタ ライズド クエリのパラメタに対して、動的に値を設定する。
                    cmnDao.SetParameter("P1", muParameter.Bean.ToString());

                    // 戻り値 dt
                    dt = new DataTable("rtn");

                    // 共通Daoを実行
                    cmnDao.ExecSelectFill_DT(dt);

                    // 戻り値を設定
                    shipper = new Shipper();
                    shipper.ShipperID = (int)muParameter.Bean;
                    shipper.CompanyName = (string)dt.Rows[0].ItemArray.GetValue(1);
                    shipper.Phone = (string)dt.Rows[0].ItemArray.GetValue(2);
                    muReturn.Bean = shipper;

                    break;

                case "generate": // 自動生成Daoを使用する。

                    // 自動生成Daoを生成
                    DaoShippers genDao = new DaoShippers(this.GetDam());

                    // パラメタに対して、動的に値を設定する。
                    genDao.PK_ShipperID = muParameter.Bean.ToString();

                    // 戻り値 dt
                    dt = new DataTable("rtn");

                    // 自動生成Daoを実行
                    genDao.S2_Select(dt);

                    // 戻り値を設定
                    shipper = new Shipper();
                    shipper.ShipperID = (int)muParameter.Bean;
                    shipper.CompanyName = (string)dt.Rows[0].ItemArray.GetValue(1);
                    shipper.Phone = (string)dt.Rows[0].ItemArray.GetValue(2);
                    muReturn.Bean = shipper;

                    break;

                default: // 個別Daoを使用する。
                    string companyName;
                    string phone;

                    LayerD myDao = new LayerD(this.GetDam());
                    myDao.Select(muParameter.ActionType,
                        muParameter.Bean.ToString(),
                        out companyName, out phone);

                    // 戻り値を設定
                    shipper = new Shipper();
                    shipper.ShipperID = (int)muParameter.Bean;
                    shipper.CompanyName = companyName;
                    shipper.Phone = phone;
                    muReturn.Bean = shipper;

                    break;
            }

            // ↑業務処理-----------------------------------------------------

            // ロールバックのテスト
            this.TestRollback(muParameter);
        }
Ejemplo n.º 42
0
        /// <summary>業務処理を実装</summary>
        /// <param name="muParameter">汎用引数クラス</param>
        private void UOC_SelectAll_DSQL(MuParameterValue muParameter)
        {
            // 戻り値クラスを生成して、事前に戻り地に設定しておく。
            MuReturnValue muReturn = new MuReturnValue();
            this.ReturnValue = muReturn;

            // ↓業務処理-----------------------------------------------------
            DataTable dt = null;
            Shipper[] shippers = null;

            string orderColumn = ((string[])(muParameter.Bean))[0];
            string orderSequence = ((string[])(muParameter.Bean))[1];

            switch ((muParameter.ActionType.Split('%'))[1])
            {
                case "common": // 共通Daoを使用する。

                    // 共通Daoを生成
                    CmnDao cmnDao = new CmnDao(this.GetDam());

                    switch ((muParameter.ActionType.Split('%'))[2])
                    {
                        case "static":
                            // 静的SQLを指定
                            cmnDao.SQLFileName = "ShipperSelectOrder.sql";
                            break;

                        case "dynamic":
                            // 動的SQLを指定
                            cmnDao.SQLFileName = "ShipperSelectOrder.xml";
                            break;
                    }

                    // ユーザ定義パラメタに対して、動的に値を設定する。
                    if (orderColumn == "c1")
                    {
                        orderColumn = "ShipperID";
                    }
                    else if (orderColumn == "c2")
                    {
                        orderColumn = "CompanyName";
                    }
                    else if (orderColumn == "c3")
                    {
                        orderColumn = "Phone";
                    }
                    else { }

                    if (orderSequence == "A")
                    {
                        orderSequence = "ASC";
                    }
                    else if (orderSequence == "D")
                    {
                        orderSequence = "DESC";
                    }
                    else { }

                    // パラメタ ライズド クエリのパラメタに対して、動的に値を設定する。
                    cmnDao.SetParameter("P1", "test");

                    // ユーザ入力は指定しない。
                    // ※ 動的SQLのVALタグは、前後の空白をつめることが有るので、
                    //    必要であれば、前後の空白を明示的に指定する必要がある。
                    cmnDao.SetUserParameter("COLUMN", " " + orderColumn + " ");
                    cmnDao.SetUserParameter("SEQUENCE", " " + orderSequence + " ");

                    // 戻り値 dt
                    dt = new DataTable("rtn");

                    // 共通Daoを実行
                    cmnDao.ExecSelectFill_DT(dt);

                    // 戻り値を設定
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = (int)dt.Rows[i]["ShipperID"];
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;

                //case "generate": // 自動生成Daoを使用する。
                //    // 当該SQLなし
                //    break;

                default: // 個別Daoを使用する。
                    LayerD myDao = new LayerD(this.GetDam());
                    myDao.SelectAll_DSQL(muParameter.ActionType,
                        orderColumn, orderSequence, out dt);

                    // 戻り値を設定
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = (int)dt.Rows[i]["ShipperID"];
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;
            }

            // ↑業務処理-----------------------------------------------------

            // ロールバックのテスト
            this.TestRollback(muParameter);
        }
Ejemplo n.º 43
0
        /// <summary>業務処理を実装</summary>
        /// <param name="muParameter">汎用引数クラス</param>
        private void UOC_SelectAll_DR(MuParameterValue muParameter)
        {
            // 戻り値クラスを生成して、事前に戻り地に設定しておく。
            MuReturnValue muReturn = new MuReturnValue();
            this.ReturnValue = muReturn;

            // ↓業務処理-----------------------------------------------------
            DataTable dt = null;
            Shipper[] shippers = null;

            switch ((muParameter.ActionType.Split('%'))[1])
            {
                case "common": // 共通Daoを使用する。

                    // 共通Daoを生成
                    CmnDao cmnDao = new CmnDao(this.GetDam());

                    switch ((muParameter.ActionType.Split('%'))[2])
                    {
                        case "static":
                            // 静的SQLを指定
                            cmnDao.SQLText = "SELECT * FROM Shippers";
                            break;

                        case "dynamic":
                            // 動的SQLを指定
                            cmnDao.SQLText = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><ROOT>SELECT * FROM Shippers</ROOT>";
                            break;
                    }

                    // 戻り値 dt
                    dt = new DataTable("rtn");

                    // 3列生成
                    dt.Columns.Add("ShipperID", System.Type.GetType("System.String"));
                    dt.Columns.Add("CompanyName", System.Type.GetType("System.String"));
                    dt.Columns.Add("Phone", System.Type.GetType("System.String"));

                    // 共通Daoを実行
                    IDataReader idr = cmnDao.ExecSelect_DR();

                    while (idr.Read())
                    {
                        // DRから読む
                        object[] objArray = new object[3];
                        idr.GetValues(objArray);

                        // DTに設定する。
                        DataRow dr = dt.NewRow();
                        dr.ItemArray = objArray;
                        dt.Rows.Add(dr);
                    }

                    // 終了したらクローズ
                    idr.Close();

                    // 戻り値を設定
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = int.Parse((string)dt.Rows[i]["ShipperID"]);
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;

                case "generate": // 自動生成Daoを使用する。

                    // DRのI/Fなし

                    // 自動生成Daoを生成
                    DaoShippers genDao = new DaoShippers(this.GetDam());

                    // 戻り値 dt
                    dt = new DataTable("rtn");

                    // 自動生成Daoを実行
                    genDao.D2_Select(dt);

                    // 戻り値を設定
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = int.Parse(dt.Rows[i]["ShipperID"].ToString());
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;

                default: // 個別Daoを使用する。
                    LayerD myDao = new LayerD(this.GetDam());
                    myDao.SelectAll_DR(muParameter.ActionType, out dt);

                    // 戻り値を設定
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = int.Parse((string)dt.Rows[i]["ShipperID"]);
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;
            }

            // ↑業務処理-----------------------------------------------------

            // ロールバックのテスト
            this.TestRollback(muParameter);
        }
Ejemplo n.º 44
0
        public string SelectAll_DR(ref string context, string actionType, out Shipper[] returnValue)
        {
            object temp = null;
            string ret = Call(ref context, "sbWebService", "SelectAll_DR", actionType, null, out temp);
            returnValue = (Shipper[])temp;

            return ret;
        }
 partial void DeleteShipper(Shipper instance);
 public void AddToShippers(Shipper shipper)
 {
     base.AddObject("Shippers", shipper);
 }
Ejemplo n.º 47
0
        //add shipper to DB and call delegate
        /// <summary>
        /// InsertShipper()
        /// Takes a Shipper object and adds a new record to the database table Shippers
        /// </summary>
        /// <param name="p">Object of type Shipper</param>
        public string InsertShipper(Shipper shpr)
        {
            String insertQuery = "INSERT INTO Shippers (CompanyName, Phone) VALUES ("
                + ((String.IsNullOrEmpty(shpr.CompanyName)) ? "null" : "\"" + shpr.CompanyName + "\"") + ","
                + ((String.IsNullOrEmpty(shpr.Phone)) ? "null" : "'" + shpr.Phone + "'") + ")";

            OleDbCommand cmInsert = new OleDbCommand(insertQuery, con);
            try
            {
                con.Open();
                cmInsert.ExecuteNonQuery();
            }
            catch (Exception)
            {
                //can't display any error feedback in data access layer
                return "Shipper Added Failed";
            }
            finally
            {
                con.Close();
            }

            //raise event
            if (shipperAdded_Changed != null)//check to makes sure at least one handler registered
            {
                shipperAdded_Changed();
            }
            return "Shipper Added";
        }
Ejemplo n.º 48
0
        public string Update(ref string context, string actionType, Shipper shipper, out int returnValue)
        {
            object temp = null;
            string ret = Call(ref context, "sbWebService", "Update", actionType, shipper, out temp);
            if (!int.TryParse((string)temp, out returnValue))
            {
                returnValue = -1;
            }

            return ret;
        }
Ejemplo n.º 49
0
        public string Select(ref string context, string actionType, int shipperID, out Shipper returnValue)
        {
            object temp = null;
            string ret = Call(ref context, "sbWebService", "Select", actionType, shipperID, out temp);
            returnValue = (Shipper)temp;

            return ret;
        }
Ejemplo n.º 50
0
        public string SelectAll_DSQL(ref string context, string actionType, string orderColumn, string orderSequence, out Shipper[] returnValue)
        {
            object temp = null;
            string ret = Call(ref context, "sbWebService", "SelectAll_DSQL", actionType,
                new string[] { orderColumn, orderSequence }, out temp);
            returnValue = (Shipper[])temp;

            return ret;
        }
Ejemplo n.º 51
0
 public ShipperDTO(Shipper info)
 {
     ShipperID = info.ShipperID;
     CompanyName = info.CompanyName;
     Phone = info.Phone;
 }
 partial void InsertShipper(Shipper instance);
Ejemplo n.º 53
0
 public bool UpdateShipper(Shipper shipper)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 54
0
 public static Shipper CreateShipper(int shipperID)
 {
     Shipper shipper = new Shipper();
     shipper.ShipperID = shipperID;
     return shipper;
 }
 public static Shipper CreateShipper(int shipperID, string companyName)
 {
     Shipper shipper = new Shipper();
     shipper.ShipperID = shipperID;
     shipper.CompanyName = companyName;
     return shipper;
 }
Ejemplo n.º 56
0
 /// <summary>
 /// 保存实体信息
 /// </summary>
 /// <param name="pEntity">实体对象</param>
 /// <returns>是否成功</returns>
 public void Save(Shipper pEntity)
 {
     HibernateDaoHelp.SaveOrUpdate(pEntity);
 }
 partial void UpdateShipper(Shipper instance);
Ejemplo n.º 58
0
        /// <summary>業務処理を実装</summary>
        /// <param name="muParameter">汎用引数クラス</param>
        private void UOC_SelectAll_DS(MuParameterValue muParameter)
        {
            // 戻り値クラスを生成して、事前に戻り地に設定しておく。
            MuReturnValue muReturn = new MuReturnValue();
            this.ReturnValue = muReturn;

            // ↓業務処理-----------------------------------------------------
            DataSet ds = null;
            DataTable dt = null;
            Shipper[] shippers = null;

            switch ((muParameter.ActionType.Split('%'))[1])
            {
                case "common": // 共通Daoを使用する。

                    // 共通Daoを生成
                    CmnDao cmnDao = new CmnDao(this.GetDam());

                    switch ((muParameter.ActionType.Split('%'))[2])
                    {
                        case "static":
                            // 静的SQLを指定
                            cmnDao.SQLText = "SELECT * FROM Shippers";
                            break;

                        case "dynamic":
                            // 動的SQLを指定
                            cmnDao.SQLText = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><ROOT>SELECT * FROM Shippers</ROOT>";
                            break;
                    }

                    // 戻り値 ds
                    ds = new DataSet();

                    // 共通Daoを実行
                    cmnDao.ExecSelectFill_DS(ds);

                    // 戻り値を設定
                    dt = ds.Tables[0];
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = (int)dt.Rows[i]["ShipperID"];
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;

                case "generate": // 自動生成Daoを使用する。

                    // 自動生成Daoを生成
                    DaoShippers genDao = new DaoShippers(this.GetDam());

                    // 戻り値 ds
                    ds = new DataSet();
                    ds.Tables.Add(new DataTable("rtn"));

                    // 自動生成Daoを実行
                    genDao.D2_Select(ds.Tables[0]);

                    // 戻り値を設定
                    dt = ds.Tables[0];
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = (int)dt.Rows[i]["ShipperID"];
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;

                default: // 個別Daoを使用する。
                    LayerD myDao = new LayerD(this.GetDam());
                    myDao.SelectAll_DS(muParameter.ActionType, out ds);

                    // 戻り値を設定
                    dt = ds.Tables[0];
                    shippers = new Shipper[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Shipper shipper = new Shipper();
                        shipper.ShipperID = (int)dt.Rows[i]["ShipperID"];
                        shipper.CompanyName = (string)dt.Rows[i]["CompanyName"];
                        shipper.Phone = (string)dt.Rows[i]["Phone"];
                        shippers[i] = shipper;
                    }

                    muReturn.Bean = shippers;

                    break;
            }

            // ↑業務処理-----------------------------------------------------

            // ロールバックのテスト
            this.TestRollback(muParameter);
        }
Ejemplo n.º 59
0
        //add shipper to DB and call delegate
        public string UpdateShipper(Shipper shpr)
        {
            String updateQuery = "UPDATE Shippers "
                + "SET CompanyName = " + ((String.IsNullOrEmpty(shpr.CompanyName)) ? "null" : "\"" + shpr.CompanyName + "\"")
                + ", Phone = " + ((String.IsNullOrEmpty(shpr.Phone)) ? "null" : "'" + shpr.Phone + "'")
                + " WHERE ShipperID = " + shpr.ShipperID;

            OleDbCommand cmUpdate = new OleDbCommand(updateQuery, con);
            try
            {
                con.Open();
                cmUpdate.ExecuteNonQuery();
            }
            catch (Exception)
            {
                //can't display any error feedback in data access layer
                return "Shipper Updated failed";
            }
            finally
            {
                con.Close();
            }

            //raise event
            if (shipperAdded_Changed != null)//check to makes sure at least one handler registered
            {
                shipperAdded_Changed();
            }

            return "Shipper Updated";
        }
Ejemplo n.º 60
0
 public ShipperViewModel(Shipper innerObject)
 {
     this.InnerObject = innerObject;
 }