Пример #1
0
    public int DeleteCard(CardFormUI cardFormUI)
    {
        int resutl = 0;

        resutl = cardFormDAL.DeleteCard(cardFormUI);
        return(resutl);
    }
Пример #2
0
    public int AddCard(CardFormUI cardFormUI)
    {
        int resutl = 0;

        resutl = cardFormDAL.AddCard(cardFormUI);
        return(resutl);
    }
Пример #3
0
    public int UpdateCard(CardFormUI cardFormUI)
    {
        int resutl = 0;

        resutl = cardFormDAL.UpdateCard(cardFormUI);
        return(resutl);
    }
Пример #4
0
    public DataTable GetCardListById(CardFormUI cardFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = cardFormDAL.GetCardListById(cardFormUI);
        return(dtb);
    }
Пример #5
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        CardFormUI cardFormUI = new CardFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["CardId"] != null)
            {
                cardFormUI.Tbl_CardId = Request.QueryString["CardId"];
                FillForm(cardFormUI);
                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update Card";
                txtCode.ReadOnly  = true;
            }
            else
            {
                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New Card";
            }
        }
    }
Пример #6
0
    private void FillForm(CardFormUI cardFormUI)
    {
        try
        {
            DataTable dtb = cardFormBAL.GetCardListById(cardFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtCode.Text     = dtb.Rows[0]["CardCode"].ToString();
                txtCardName.Text = dtb.Rows[0]["CardName"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "System_Settings_CardForm.CS";
            logExcpUIobj.RecordId         = cardFormUI.Tbl_CardId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[System_Settings_CardForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
Пример #7
0
    public int UpdateCard(CardFormUI cardFormUI)
    {
        int result = 0;

        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SupportCon.Open();
                SqlCommand sqlCmd = new SqlCommand("SP_Card_Update", SupportCon);
                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;

                sqlCmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar);
                sqlCmd.Parameters["@ModifiedBy"].Value = cardFormUI.ModifiedBy;
                sqlCmd.Parameters.Add("@tbl_CardId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CardId"].Value = cardFormUI.Tbl_CardId;

                sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_OrganizationId"].Value = cardFormUI.Tbl_OrganizationId;

                sqlCmd.Parameters.Add("@CardCode", SqlDbType.NVarChar);
                sqlCmd.Parameters["@CardCode"].Value = cardFormUI.CardCode;

                sqlCmd.Parameters.Add("@CardName", SqlDbType.NVarChar);
                sqlCmd.Parameters["@CardName"].Value = cardFormUI.CardName;

                result = sqlCmd.ExecuteNonQuery();

                sqlCmd.Dispose();
                SupportCon.Close();
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "UpdateCard()";
            logExcpUIobj.ResourceName     = "CardFormDAL.CS";
            logExcpUIobj.RecordId         = cardFormUI.Tbl_CardId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[CardFormDAL : UpdateCard] An error occured in the processing of Record Id : " + cardFormUI.Tbl_CardId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
Пример #8
0
    public DataTable GetCardListById(CardFormUI cardFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SqlCommand sqlCmd = new SqlCommand("SP_Card_SelectById", SupportCon);
                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;

                sqlCmd.Parameters.Add("@tbl_CardId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CardId"].Value = cardFormUI.Tbl_CardId;

                using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd))
                {
                    adapter.Fill(ds);
                }
            }
            if (ds.Tables.Count > 0)
            {
                dtbl = ds.Tables[0];
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "getCardListById()";
            logExcpUIobj.ResourceName     = "CardFormDAL.CS";
            logExcpUIobj.RecordId         = cardFormUI.Tbl_CardId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[CardFormDAL : getCardListById] An error occured in the processing of Record Id : " + cardFormUI.Tbl_CardId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }