示例#1
0
		public short Insert(StockTypesDetails Details)
		{
			try 
			{
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);

                Int16 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int16.Parse(dr[0].ToString());
                }

				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
示例#2
0
        public Int32 Save(StockTypesDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveStockType(@StockTypeID, @StockTypeCode, @Description, @StockDirection, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("StockTypeID", Details.StockTypeID);
                cmd.Parameters.AddWithValue("StockTypeCode", Details.StockTypeCode);
                cmd.Parameters.AddWithValue("Description", Details.Description);
                cmd.Parameters.AddWithValue("StockDirection", Details.StockDirection);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return(base.ExecuteNonQuery(cmd));
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#3
0
        public short Insert(StockTypesDetails Details)
        {
            try
            {
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);

                Int16 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int16.Parse(dr[0].ToString());
                }

                return(iID);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#4
0
		public void Update(StockTypesDetails Details)
		{
			try 
			{
                Save(Details);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
示例#5
0
        public void Update(StockTypesDetails Details)
        {
            try
            {
                Save(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#6
0
        public StockTypesDetails Details(Int16 StockTypeID)
        {
            try
            {
                string SQL = "SELECT " +
                             "StockTypeID, " +
                             "StockTypeCode, " +
                             "Description, " +
                             "StockDirection " +
                             "FROM tblStockType " +
                             "WHERE StockTypeID = @StockTypeID;";



                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmStockTypeID = new MySqlParameter("@StockTypeID", MySqlDbType.Int16);
                prmStockTypeID.Value = StockTypeID;
                cmd.Parameters.Add(prmStockTypeID);

                System.Data.DataTable dt = new System.Data.DataTable("StockType");
                base.MySqlDataAdapterFill(cmd, dt);


                StockTypesDetails Details = new StockTypesDetails();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.StockTypeID    = StockTypeID;
                    Details.StockTypeCode  = "" + dr["StockTypeCode"].ToString();
                    Details.Description    = "" + dr["Description"].ToString();
                    Details.StockDirection = (StockDirections)Enum.Parse(typeof(StockDirections), Convert.ToInt16(dr["StockDirection"]).ToString());
                }

                return(Details);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
示例#7
0
        public Int32 Save(StockTypesDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveStockType(@StockTypeID, @StockTypeCode, @Description, @StockDirection, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("StockTypeID", Details.StockTypeID);
                cmd.Parameters.AddWithValue("StockTypeCode", Details.StockTypeCode);
                cmd.Parameters.AddWithValue("Description", Details.Description);
                cmd.Parameters.AddWithValue("StockDirection", Details.StockDirection);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#8
0
		public StockTypesDetails Details(Int16 StockTypeID)
		{
			try
			{
				string SQL=	"SELECT " +
								"StockTypeID, " +
								"StockTypeCode, " +
								"Description, " +
								"StockDirection " +
							"FROM tblStockType " +
							"WHERE StockTypeID = @StockTypeID;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

				MySqlParameter prmStockTypeID = new MySqlParameter("@StockTypeID",MySqlDbType.Int16);
				prmStockTypeID.Value = StockTypeID;
				cmd.Parameters.Add(prmStockTypeID);

                System.Data.DataTable dt = new System.Data.DataTable("StockType");
                base.MySqlDataAdapterFill(cmd, dt);
                
				
				StockTypesDetails Details = new StockTypesDetails();

                foreach (System.Data.DataRow dr in dt.Rows)
				{
					Details.StockTypeID = StockTypeID;
					Details.StockTypeCode = "" + dr["StockTypeCode"].ToString();
					Details.Description = "" + dr["Description"].ToString();
                    Details.StockDirection = (StockDirections)Enum.Parse(typeof(StockDirections), Convert.ToInt16(dr["StockDirection"]).ToString());
				}

				return Details;
			}

			catch (Exception ex)
			{
				
				
				{
					
					
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
示例#9
0
        private void SaveRecord()
		{
			StockTypes clsStockType = new StockTypes();
			StockTypesDetails clsDetails = new StockTypesDetails();

			clsDetails.StockTypeID = Convert.ToInt16(lblStockTypeID.Text);
			clsDetails.StockTypeCode = txtStockTypeCode.Text;
			clsDetails.Description = txtDescription.Text;
			clsDetails.StockDirection = (StockDirections) Enum.Parse(typeof(StockDirections), cboDirection.SelectedItem.Value);

			clsStockType.Update(clsDetails);
			clsStockType.CommitAndDispose();
        }
示例#10
0
        private Int32 SaveRecord()
		{
			StockTypes clsStockType = new StockTypes();
			StockTypesDetails clsDetails = new StockTypesDetails();

			clsDetails.StockTypeCode = txtStockTypeCode.Text;
			clsDetails.Description = txtDescription.Text;
			clsDetails.StockDirection = (StockDirections) Enum.Parse(typeof(StockDirections), cboDirection.SelectedItem.Value);

			int id = clsStockType.Insert(clsDetails);
			
			clsStockType.CommitAndDispose();

			return id;
        }