public void Insert(DateTime? DateCreated,string CustomerRef,byte[] Ts) { Deont item = new Deont(); item.DateCreated = DateCreated; item.CustomerRef = CustomerRef; item.Ts = Ts; item.Save(UserName); }
/// <summary> /// append to appropriate ordernumber table depending on office /// to appropriate log table e.g. ordernumbertable for uk /// other offices use different table e.g. NLONT (NetherlandsOrderNumberTable /// </summary> /// <param name="office">ID of requesting office derived from logged in user</param> /// <returns>OrderNumber primary key on all office ordernumber tables</returns> public static int insert_order_number(int officeid) { int _neworderno = 0; switch (officeid) { case 1: //uk office { //06/12/13 primary key added to ordernumbertable OrderNumberTable _tbl = new OrderNumberTable(); _tbl.DateCreated = DateTime.Now; _tbl.RefX = ""; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); //why does ordernumbertable not have a primary key? //using (SqlConnection _cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PublishipSQLConnectionString"].ConnectionString)) //{ // string _sql = "INSERT INTO OrderNumberTable(DateCreated, Ref) VALUES (@DateCreated, @Ref);"; // _cn.Open(); // using (SqlCommand _cmd = new SqlCommand(_sql, _cn)) // { // _cmd.Parameters.AddWithValue("@DateCreated", DateTime.Now.ToString()); // _cmd.Parameters.AddWithValue("@Ref", ""); // // try // { // object _obj = _cmd.ExecuteScalar(); // _neworderno = wwi_func.vint(_obj.ToString()); // } // catch (Exception ex) // { // this.dxlblErr.Text = ex.Message.ToString(); // this.dxpnlErr.ClientVisible = true; // } // finally // { // _cn.Close(); // }//end error trapping // } //end using command //} //end using connection break; } case 2: //hong kong office { Hkont _tbl = new Hkont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 3: //singapore office { Sgont _tbl = new Sgont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 4: //australia order { Aont _tbl = new Aont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 5: //italy order { Itont _tbl = new Itont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 6: //us order { Usont _tbl = new Usont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 7: //netherlands order { Nlont _tbl = new Nlont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 9: //germany order { Deont _tbl = new Deont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 10: //thailand order { Thont _tbl = new Thont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 13: //brazil order { Bront _tbl = new Bront(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } default: { break; } } return _neworderno; }
public void Update(int OrderNumber,DateTime? DateCreated,string CustomerRef,byte[] Ts) { Deont item = new Deont(); item.MarkOld(); item.IsLoaded = true; item.OrderNumber = OrderNumber; item.DateCreated = DateCreated; item.CustomerRef = CustomerRef; item.Ts = Ts; item.Save(UserName); }
/// <summary> /// append to appropriate ordernumber table depending on office /// to appropriate log table e.g. ordernumbertable for uk /// other offices use different table e.g. NLONT (NetherlandsOrderNumberTable /// </summary> /// <param name="office">ID of requesting office derived from logged in user</param> /// <returns>OrderNumber primary key on all office ordernumber tables</returns> public static int insert_order_number(int officeid) { int _neworderno = 0; switch (officeid) { case 1: //uk office { //06/12/13 primary key added to ordernumbertable OrderNumberTable _tbl = new OrderNumberTable(); _tbl.DateCreated = DateTime.Now; _tbl.RefX = ""; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); //why does ordernumbertable not have a primary key? //using (SqlConnection _cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PublishipSQLConnectionString"].ConnectionString)) //{ // string _sql = "INSERT INTO OrderNumberTable(DateCreated, Ref) VALUES (@DateCreated, @Ref);"; // _cn.Open(); // using (SqlCommand _cmd = new SqlCommand(_sql, _cn)) // { // _cmd.Parameters.AddWithValue("@DateCreated", DateTime.Now.ToString()); // _cmd.Parameters.AddWithValue("@Ref", ""); // // try // { // object _obj = _cmd.ExecuteScalar(); // _neworderno = wwi_func.vint(_obj.ToString()); // } // catch (Exception ex) // { // this.dxlblErr.Text = ex.Message.ToString(); // this.dxpnlErr.ClientVisible = true; // } // finally // { // _cn.Close(); // }//end error trapping // } //end using command //} //end using connection break; } case 2: //hong kong office { Hkont _tbl = new Hkont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 3: //singapore office { Sgont _tbl = new Sgont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 4: //australia order { Aont _tbl = new Aont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 5: //italy order { Itont _tbl = new Itont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 6: //us order { Usont _tbl = new Usont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 7: //netherlands order { Nlont _tbl = new Nlont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 9: //germany order { Deont _tbl = new Deont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 10: //thailand order { Thont _tbl = new Thont(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } case 13: //brazil order { Bront _tbl = new Bront(); _tbl.DateCreated = DateTime.Now; _tbl.Save(); _neworderno = (int)_tbl.GetPrimaryKeyValue(); break; } default: { break; } } return(_neworderno); }