예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            OccupationTypes objOccupationTypes = new OccupationTypes();
            objOccupationTypes.OccupationTypeDesc = txtOccupationTypeDesc.Text;
            objOccupationTypes.Status = 1;

            if (!string.IsNullOrEmpty(hfOccupationTypeID.Value.ToString()))
            {
                objOccupationTypes.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objOccupationTypes.UpdatedDate = DateTime.Now;
                objOccupationTypes.OccupationTypeID = Convert.ToInt32(hfOccupationTypeID.Value);
                objOccupationTypes.OccupationTypeDesc = txtOccupationTypeDesc.Text;
                OccupationTypeBO.UpdateOccupationTypes(objOccupationTypes);
            }
            else
            {
                objOccupationTypes.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objOccupationTypes.CreatedDate = DateTime.Now;
                OccupationTypeBO.InsertOccupationType(objOccupationTypes);
            }
            
            txtOccupationTypeDesc.Text = string.Empty;
            hfOccupationTypeID.Value = string.Empty;
            loadOccupationType();
        }
예제 #2
0
        public int InsertOccupationType(OccupationTypes objOccupationType)
        {
            objOccupationType.OccupationTypeID = 1;
            BeginTransaction();

            try
            {
                objOccupationType.OccupationTypeID = Insert(objOccupationType);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objOccupationType.OccupationTypeID = -1;
            }

            return objOccupationType.OccupationTypeID;
        }
예제 #3
0
        protected void gvOccupationType_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            hfOccupationTypeID.Value = e.CommandArgument.ToString();
            OccupationTypes objOccupationTypes = new OccupationTypes();

            if (e.CommandName.Equals("cmdEdit"))
            {
                objOccupationTypes = OccupationTypeBO.GetOccupationType(Convert.ToInt32(e.CommandArgument));
                txtOccupationTypeDesc.Text = objOccupationTypes.OccupationTypeDesc;
            }
            else if (e.CommandName.Equals("cmdDelete"))
            {
                int OccupationTypeID = Convert.ToInt32(e.CommandArgument);
                objOccupationTypes.OccupationTypeID = OccupationTypeID;
                objOccupationTypes.Status = 0;
                OccupationTypeBO.DeleteOccupationTypes(objOccupationTypes);
                loadOccupationType();
            }
        }
예제 #4
0
        public int DeleteOccupationTypes(OccupationTypes objOccupationTypes)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Status" };
                rowsaffected = Update(objOccupationTypes, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
예제 #5
0
 public static int DeleteOccupationTypes(OccupationTypes objOccupationTypes)
 {
     return new OccupationTypeDAO().DeleteOccupationTypes(objOccupationTypes);
 }
예제 #6
0
 public static int UpdateOccupationTypes(OccupationTypes objOccupationTypes)
 {
     return new OccupationTypeDAO().UpdateOccupationTypes(objOccupationTypes);
 }
예제 #7
0
 public static OccupationTypes GetOccupationType(int OccupationTypeID)
 {
     OccupationTypes objOccupationType = new OccupationTypes();
     return (OccupationTypes)(new OccupationTypeDAO().FillDTO(objOccupationType, "OccupationTypeID=" + OccupationTypeID));
 }
예제 #8
0
 public static int InsertOccupationType(OccupationTypes objOccupationType)
 {
     return new OccupationTypeDAO().InsertOccupationType(objOccupationType);
 }