Ejemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(hdDataType.Value))
        {
            SPType oSPType = (SPType)Session[Constants.SES_SPTYPE];
            if (oSPType == null)
            {
                oSPType = new SPType();
            }
            SPTypeDAL oSPTypeDAL = new SPTypeDAL();

            oSPType.SPTypeID = Request[txtSpTypeId.UniqueID].Trim().ToUpper();
            oSPType.TypeDesc = txtDescription.Text.Trim().ToUpper();

            if (!string.IsNullOrEmpty(ddlCurrency.SelectedValue))
            {
                oSPType.Currency.CurrencyID = ddlCurrency.SelectedValue;
            }

            oSPType.UserDetails          = ucUserDet.UserDetail;
            oSPType.UserDetails.MakeDate = DateTime.Now;
            ucUserDet.ResetData();

            Result oResult = (Result)oSPTypeDAL.Save(oSPType);

            if (oResult.Status)
            {
                ReloadList(oSPTypeDAL, oSPType.SPTypeID);
                ClearTextValue();
                ResetDenom();
                hdDenomID.Value  = string.Empty;
                hdSPTypeID.Value = string.Empty;

                ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS);
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR);
            }
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_APPROVED_SAVE_DATA, Constants.MSG_TYPE_INFO);
            ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
            ClearTextValue();
            ResetDenom();
            hdDenomID.Value  = string.Empty;
            hdSPTypeID.Value = string.Empty;
        }
    }