Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CounselorDifficulties objCounselorDifficulties = new CounselorDifficulties();
            objCounselorDifficulties.CounselorDifficultyDesc = txtCounselorDifficultyDesc.Text;
            objCounselorDifficulties.Status = 1;

            if (!string.IsNullOrEmpty(hfCounselorDifficultyID.Value.ToString()))
            {
                objCounselorDifficulties.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objCounselorDifficulties.UpdatedDate = DateTime.Now;
                objCounselorDifficulties.CounselorDifficultyID = Convert.ToInt32(hfCounselorDifficultyID.Value);
                objCounselorDifficulties.CounselorDifficultyDesc = txtCounselorDifficultyDesc.Text;
                CounselorDifficultiesBO.UpdateCounselorDifficulties(objCounselorDifficulties);
            }
            else
            {
                objCounselorDifficulties.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objCounselorDifficulties.CreatedDate = DateTime.Now;
                CounselorDifficultiesBO.InsertCounselorDifficulty(objCounselorDifficulties);
            }

            txtCounselorDifficultyDesc.Text = string.Empty;
            hfCounselorDifficultyID.Value = string.Empty;
            loadCounselorDifficulties();
        }
        public int InsertCounselorDifficulty(CounselorDifficulties objCounselorDifficulties)
        {
            objCounselorDifficulties.CounselorDifficultyID = 1;
            BeginTransaction();

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

            return objCounselorDifficulties.CounselorDifficultyID;
        }
        public int DeleteCounselorDifficulties(CounselorDifficulties objCounselorDifficulties)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Status" };
                rowsaffected = Update(objCounselorDifficulties, UpdateProperties);

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

        }
Пример #4
0
        protected void gvCounselorDifficulty_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            hfCounselorDifficultyID.Value = e.CommandArgument.ToString();
            CounselorDifficulties objCounselorDifficulties = new CounselorDifficulties();

            if (e.CommandName.Equals("cmdEdit"))
            {
                objCounselorDifficulties = CounselorDifficultiesBO.GetCounselorDifficulties(Convert.ToInt32(e.CommandArgument));
                txtCounselorDifficultyDesc.Text = objCounselorDifficulties.CounselorDifficultyDesc;
            }
            else if (e.CommandName.Equals("cmdDelete"))
            {
                int CounselorDifficultyID = Convert.ToInt32(e.CommandArgument);
                objCounselorDifficulties.CounselorDifficultyID = CounselorDifficultyID;
                objCounselorDifficulties.Status = 0;
                CounselorDifficultiesBO.DeleteCounselorDifficulties(objCounselorDifficulties);
                loadCounselorDifficulties();
            }
        }
 public static int DeleteCounselorDifficulties(CounselorDifficulties objCounselorDifficulties)
 {
     return new CounselorDifficultiesDAO().DeleteCounselorDifficulties(objCounselorDifficulties);
 }
 public static CounselorDifficulties GetCounselorDifficulties(int CounselorDifficultyID)
 {
     CounselorDifficulties objCounselorDifficulties = new CounselorDifficulties();
     return (CounselorDifficulties)(new CounselorDifficultiesDAO().FillDTO(objCounselorDifficulties, "CounselorDifficultyID=" + CounselorDifficultyID));
 }
 public static int InsertCounselorDifficulty(CounselorDifficulties objCounselorDifficulties)
 {
     return new CounselorDifficultiesDAO().InsertCounselorDifficulty(objCounselorDifficulties);
 }