Пример #1
0
        public DepartmentDetails Details(string DepartmentName)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect() + "WHERE DepartmentName = @DepartmentName;";

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

                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                DepartmentDetails Details = new DepartmentDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.DepartmentID   = Int16.Parse(dr["DepartmentID"].ToString());
                    Details.DepartmentCode = "" + dr["DepartmentCode"].ToString();
                    Details.DepartmentName = "" + dr["DepartmentName"].ToString();
                }

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #2
0
 public void Update(DepartmentDetails Details)
 {
     try
     {
         Save(Details);
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
Пример #3
0
 public void Update(DepartmentDetails Details)
 {
     try
     {
         Save(Details);
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
Пример #4
0
        public Int32 Insert(DepartmentDetails Details)
        {
            try
            {
                Save(Details);

                return(Int32.Parse(base.getLAST_INSERT_ID(this)));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #5
0
        public Int32 Insert(DepartmentDetails Details)
        {
            try
            {
                Save(Details);

                return Int32.Parse(base.getLAST_INSERT_ID(this));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #6
0
        public Int32 Save(DepartmentDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveDepartment(@DepartmentID, @DepartmentCode, @DepartmentName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("DepartmentID", Details.DepartmentID);
                cmd.Parameters.AddWithValue("DepartmentCode", Details.DepartmentCode);
                cmd.Parameters.AddWithValue("DepartmentName", Details.DepartmentName);
                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);
            }
        }
Пример #7
0
        public Int32 Save(DepartmentDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveDepartment(@DepartmentID, @DepartmentCode, @DepartmentName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("DepartmentID", Details.DepartmentID);
                cmd.Parameters.AddWithValue("DepartmentCode", Details.DepartmentCode);
                cmd.Parameters.AddWithValue("DepartmentName", Details.DepartmentName);
                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
        private void SaveRecord()
        {
            Department clsDepartment = new Department();
            DepartmentDetails clsDetails = new DepartmentDetails();

            clsDetails.DepartmentID = Convert.ToInt16(lblDepartmentID.Text);
            clsDetails.DepartmentCode = txtDepartmentCode.Text;
            clsDetails.DepartmentName = txtDepartmentName.Text;

            clsDepartment.Update(clsDetails);
            clsDepartment.CommitAndDispose();
        }
Пример #9
0
		public DepartmentDetails Details(string DepartmentName)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL=	SQLSelect() + "WHERE DepartmentName = @DepartmentName;";

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

                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                DepartmentDetails Details = new DepartmentDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.DepartmentID = Int16.Parse(dr["DepartmentID"].ToString());
                    Details.DepartmentCode = "" + dr["DepartmentCode"].ToString();
                    Details.DepartmentName = "" + dr["DepartmentName"].ToString();
                }

                return Details;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #10
0
        private Int32 SaveRecord()
        {
            Department clsDepartment = new Department();
            DepartmentDetails clsDetails = new DepartmentDetails();

            clsDetails.DepartmentCode = txtDepartmentCode.Text;
            clsDetails.DepartmentName = txtDepartmentName.Text;

            Int32 id = clsDepartment.Insert(clsDetails);

            clsDepartment.CommitAndDispose();

            return id;
        }