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

                dt = objDist.InsertAnimalTypeBAL(txtAnimalTCode.Text, txtAnimalName.Text.Trim(), UserName, "I", ConnKey);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0][0].ToString() == "1")
                    {
                        string message = "Inserted Successfully";
                        objCommon.ShowAlertMessage(message);
                        txtAnimalTCode.Text = "";
                        txtAnimalName.Text  = "";
                    }
                    else
                    {
                        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
        {
        }
    }