コード例 #1
0
    protected void btn_Update_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        try
        {
            if (ValidateBreed())
            {
                dt = objDist.UpdateBreedBAL(txtBreedCode.Text.Trim(), ddl_AnimalType.SelectedValue.ToString(), txtBreedName.Text.Trim(), UserName, ConnKey);
                if (dt.Rows.Count > 0)
                {
                    objCommon.ShowAlertMessage(dt.Rows[0][0].ToString());
                    txtBreedCode.Text      = "";
                    ddl_AnimalType.Enabled = true;
                    txtBreedName.Text      = "";
                    btn_Save.Visible       = true;
                    txtBreedCode.Enabled   = true;
                    btn_Update.Visible     = false;
                }
                else
                {
                    txtBreedCode.Text  = "";
                    btn_Save.Visible   = true;
                    btn_Update.Visible = false;
                    txtBreedName.Text  = "";
                    objCommon.ShowAlertMessage(dt.Rows[0][0].ToString());
                }
                Viewdata();
            }
        }
        catch (Exception ex)
        {
            ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
            Response.Redirect("~/Error.aspx");
        }
        finally
        {
        }
    }