Esempio n. 1
0
        protected void gvRecAgency_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);
            string cmdName = e.CommandName;
            if (cmdName.Equals("cmdDelete"))
            {
                // Perform Delete Operation
                TRNRecruitmentAgency RecAgencyID = new TRNRecruitmentAgency();
                RecAgencyID.RecAgencyID = id;
                RecAgencyID.ModifiedBy = 1;
                RecAgencyID.Status = 0;

                int result = new TRNRecruitmentAgencyBO().DeleteRecruitmentAgency(RecAgencyID);
                LoadRecruitmentAgency();
            }

            if (cmdName.Equals("cmdEdit"))
            {
                // Show data to TextBoxes and controls
                DataView dvRecord = new TRNRecruitmentAgencyBO().GetRecruitmentAgencyByID(id);
                if (dvRecord.Count > 0)
                {
                    lblID.Text = dvRecord.Table.Rows[0]["ID"].ToString();
                    txtRecruitmentAgency.Text = dvRecord.Table.Rows[0]["RecruitmentAgency"].ToString();
                    btnSave.Text = "Save";
                }

            }
        }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (lblID.Text != string.Empty)
            {
                TRNRecruitmentAgency RecAgencyUpdate = new TRNRecruitmentAgency();
                RecAgencyUpdate.RecAgencyID = Convert.ToInt32(lblID.Text);
                RecAgencyUpdate.RecruitmentAgency = txtRecruitmentAgency.Text;
                RecAgencyUpdate.ModifiedBy = 1;
                RecAgencyUpdate.Status = 1;
                int result = new TRNRecruitmentAgencyBO().UpdateRecruitmentAgency(RecAgencyUpdate);
                if (result > 0)
                {
                    Clear();
                    btnSave.Text = "Save";
                    LoadRecruitmentAgency();
                }
               
            }
            else
            {
                TRNRecruitmentAgency RecAgencyInsert = new TRNRecruitmentAgency();
                RecAgencyInsert.RecruitmentAgency = txtRecruitmentAgency.Text;
                RecAgencyInsert.CreatedBy = 1;
                RecAgencyInsert.Status = 1;
                int result = new TRNRecruitmentAgencyBO().InsertRecruitmentAgency(RecAgencyInsert);
                if (result > 0)
                {
                    Clear();
                    LoadRecruitmentAgency();
                }
              
            }

        }
        public int InsertRecruitmentAgency(TRNRecruitmentAgency objRec)
        {
            objRec.RecAgencyID = 1;
            objRec.CreatedDate = DateTime.Now;
            BeginTransaction();
            try
            {
                objRec.RecAgencyID = Insert(objRec);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objRec.RecAgencyID = -1;
            }

            return objRec.RecAgencyID;
        }
        public int DeleteRecruitmentAgency(TRNRecruitmentAgency objRec)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "UpdatedBy","UpdatedDate","Status"};
                rowsaffected = Update(objRec, UpdateProperties);

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

        }
 public int DeleteRecruitmentAgency(TRNRecruitmentAgency recAgency)
 {
     recAgency.ModifiedDate = DateTime.Now;
     return new TRNRecruitmentAgencyDAO().DeleteRecruitmentAgency(recAgency);
 }
 public int InsertRecruitmentAgency(TRNRecruitmentAgency recAgency)
 {
     return new TRNRecruitmentAgencyDAO().InsertRecruitmentAgency(recAgency);
 }