Esempio n. 1
0
        protected void gvCaste_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            hfCasteID.Value = e.CommandArgument.ToString();
            Caste objCaste = new Caste();

            if (e.CommandName.Equals("cmdEdit"))
            {
                objCaste = CasteBO.GetCaste(Convert.ToInt32(e.CommandArgument));
                txtCasteName.Text = objCaste.CasteName;
                ddlEthnicityID.SelectedValue = objCaste.EthnicityID.ToString();
                if (objCaste.IsDiscriminated == 1)
                {
                    rbDiscriminatedYes.Checked = true;
                    rbDiscriminatedNo.Checked = false;
                }
                else
                {
                    rbDiscriminatedNo.Checked = true;
                    rbDiscriminatedYes.Checked = false;
                }
                txtCasteName.Focus();
                
            }
            else if (e.CommandName.Equals("cmdDelete"))
            {
                int CasteID = Convert.ToInt32(e.CommandArgument);
                objCaste.CasteID = CasteID;
                objCaste.Status = 0;
                CasteBO.DeleteCaste(objCaste);
                loadCasteView();
            }
        }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Caste objCaste = new Caste();
            objCaste.CasteName = txtCasteName.Text;
            objCaste.EthnicityID = Convert.ToInt32(ddlEthnicityID.SelectedValue);
            objCaste.IsDiscriminated = Convert.ToInt32(rbDiscriminatedYes.Checked);
            objCaste.Status = 1;

            if (!string.IsNullOrEmpty(hfCasteID.Value.ToString()))
            {
                objCaste.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objCaste.UpdatedDate = DateTime.Now;
                objCaste.CasteID = Convert.ToInt32(hfCasteID.Value);
                objCaste.CasteName = txtCasteName.Text;
                objCaste.EthnicityID = Convert.ToInt32(ddlEthnicityID.SelectedValue);

                CasteBO.UpdateCaste(objCaste);

            }
            else
            {
                objCaste.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objCaste.CreatedDate = DateTime.Now;
                CasteBO.InsertCaste(objCaste);
            }
            txtCasteName.Text = string.Empty;
            
            hfCasteID.Value = string.Empty;
            loadCasteView();
            loadEthnicity();
            

        }
Esempio n. 3
0
        public int InsertCaste(Caste objCaste)
        {
            objCaste.CasteID = 1;
            BeginTransaction();

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

            return objCaste.CasteID;
        }
Esempio n. 4
0
        public int UpdateCaste(Caste objCaste)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "CasteName", "EthnicityID", "UpdatedBy", "UpdatedDate", 
                                                           "IsDiscriminated", "Status", "SyncStatus" };
                rowsaffected = Update(objCaste, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;
        }
Esempio n. 5
0
 public static int DeleteCaste(Caste objCaste)
 {
     return new CasteDAO().DeleteCaste(objCaste);
 }
Esempio n. 6
0
 public static int UpdateCaste(Caste objCaste)
 {
     return new CasteDAO().UpdateCaste(objCaste);
 }
Esempio n. 7
0
 public static Caste GetCaseType(int CasteID)
 {
     Caste objCaseType = new Caste();
     return (Caste)(new CasteDAO().FillDTO(objCaseType, "CasteID=" + CasteID));
 }
Esempio n. 8
0
 public static int InsertCaste(Caste objCaste)
 {
     return new CasteDAO().InsertCaste(objCaste);
 }
Esempio n. 9
0
        public int DeleteCaste(Caste objCaste)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Status" };
                rowsaffected = Update(objCaste, UpdateProperties);

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