Exemple #1
0
        public void Update(PositionDetails Details)
        {
            try
            {
                string SQL = "CALL procPositionUpdate(@PositionID, @PositionCode, @PositionName);";



                MySqlCommand cmd = new MySqlCommand();


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

                cmd.Parameters.AddWithValue("@PositionID", Details.PositionID);
                cmd.Parameters.AddWithValue("@PositionCode", Details.PositionCode);
                cmd.Parameters.AddWithValue("@PositionName", Details.PositionName);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #2
0
		public Int16 Insert(PositionDetails Details)
		{
			try 
			{
                string SQL = "CALL procPositionInsert(@PositionCode, @PositionName);";

                

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

                MySqlParameter prmPositionCode = new MySqlParameter("@PositionCode",MySqlDbType.String);
                prmPositionCode.Value = Details.PositionCode;
                cmd.Parameters.Add(prmPositionCode);

                MySqlParameter prmPositionName = new MySqlParameter("@PositionName",MySqlDbType.String);
                prmPositionName.Value = Details.PositionName;
                cmd.Parameters.Add(prmPositionName);

                base.ExecuteNonQuery(cmd);

				SQL = "SELECT LAST_INSERT_ID();";
				
				cmd.Parameters.Clear(); 
				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);
			}	
		}
Exemple #3
0
        public Int16 Insert(PositionDetails Details)
        {
            try
            {
                string SQL = "CALL procPositionInsert(@PositionCode, @PositionName);";



                MySqlCommand cmd = new MySqlCommand();


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

                MySqlParameter prmPositionCode = new MySqlParameter("@PositionCode", MySqlDbType.String);
                prmPositionCode.Value = Details.PositionCode;
                cmd.Parameters.Add(prmPositionCode);

                MySqlParameter prmPositionName = new MySqlParameter("@PositionName", MySqlDbType.String);
                prmPositionName.Value = Details.PositionName;
                cmd.Parameters.Add(prmPositionName);

                base.ExecuteNonQuery(cmd);

                SQL = "SELECT LAST_INSERT_ID();";

                cmd.Parameters.Clear();
                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);
            }
        }
Exemple #4
0
        public PositionDetails Details(string PositionName)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE PositionName = @PositionName;";



                MySqlCommand cmd = new MySqlCommand();


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

                cmd.Parameters.AddWithValue("@PositionName", PositionName);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                PositionDetails Details = new PositionDetails();

                while (myReader.Read())
                {
                    Details.PositionID   = myReader.GetInt16("PositionID");
                    Details.PositionCode = "" + myReader["PositionCode"].ToString();
                    Details.PositionName = "" + myReader["PositionName"].ToString();
                }

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #5
0
        public Int32 Save(PositionDetails Details)
        {
            try
            {
                string SQL = "CALL procSavePositions(@PositionID, @PositionCode, @PositionName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("PositionID", Details.PositionID);
                cmd.Parameters.AddWithValue("PositionCode", Details.PositionCode);
                cmd.Parameters.AddWithValue("PositionName", Details.PositionName);
                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);
            }
        }
Exemple #6
0
		public PositionDetails Details(string PositionName)
		{
			try
			{
				string SQL=	SQLSelect() + "WHERE PositionName = @PositionName;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@PositionName", PositionName);

				MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
				
				PositionDetails Details = new PositionDetails();

				while (myReader.Read()) 
				{
					Details.PositionID = myReader.GetInt16("PositionID");
					Details.PositionCode = "" + myReader["PositionCode"].ToString();
					Details.PositionName = "" + myReader["PositionName"].ToString();
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
					

				
				
				

				throw base.ThrowException(ex);
			}	
		}
Exemple #7
0
        public Int32 Save(PositionDetails Details)
        {
            try
            {
                string SQL = "CALL procSavePositions(@PositionID, @PositionCode, @PositionName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("PositionID", Details.PositionID);
                cmd.Parameters.AddWithValue("PositionCode", Details.PositionCode);
                cmd.Parameters.AddWithValue("PositionName", Details.PositionName);
                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);
            }
        }
Exemple #8
0
		public void Update(PositionDetails Details)
		{
			try 
			{
                string SQL = "CALL procPositionUpdate(@PositionID, @PositionCode, @PositionName);";

                

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

                cmd.Parameters.AddWithValue("@PositionID", Details.PositionID);
                cmd.Parameters.AddWithValue("@PositionCode", Details.PositionCode);
                cmd.Parameters.AddWithValue("@PositionName", Details.PositionName);

                base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				
				
					

				
				
				

				throw base.ThrowException(ex);
			}	
		}
Exemple #9
0
        private Int16 SaveRecord()
        {
            Positions clsPosition = new Positions();
            PositionDetails clsDetails = new PositionDetails();

            clsDetails.PositionCode = txtPositionCode.Text;
            clsDetails.PositionName = txtPositionName.Text;

            Int16 id = clsPosition.Insert(clsDetails);

            clsPosition.CommitAndDispose();

            return id;
        }
Exemple #10
0
        private void SaveRecord()
        {
            Positions clsPosition = new Positions();
            PositionDetails clsDetails = new PositionDetails();

            clsDetails.PositionID = Convert.ToInt16(lblPositionID.Text);
            clsDetails.PositionCode = txtPositionCode.Text;
            clsDetails.PositionName = txtPositionName.Text;

            clsPosition.Update(clsDetails);
            clsPosition.CommitAndDispose();
        }