示例#1
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int16 EditId;
        ProductTypes m_ProductTypes = new ProductTypes();

        if (Request.QueryString["id"] == null)
        {
            EditId = 0;
        }
        else
        {
            EditId = System.Int16.Parse(Request.QueryString["id"].ToString());
            m_ProductTypes.ProductTypeId = EditId;
            m_ProductTypes = m_ProductTypes.Get();
        }
        try
        {
            if (txProductTypeName.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }


            m_ProductTypes.CrUserId = ActUserId;

            if (txProductTypeName.Text != "")
            {
                m_ProductTypes.ProductTypeName = txProductTypeName.Text;
            }

            if (txProductTypeDesc.Text != "")
            {
                m_ProductTypes.ProductTypeDesc = txProductTypeDesc.Text;
            }

            m_ProductTypes.DisplayOrder = short.Parse(txDisplayOrder.Text);

            m_ProductTypes.ProductTypeId = EditId;
            SysMessageTypeId             = m_ProductTypes.InsertOrUpdate(ConstantHelpers.Replicated, ActUserId, ref SysMessageId);

            StringBuilder       csText = new StringBuilder();
            Type                cstype = this.GetType();
            ClientScriptManager cs     = Page.ClientScript;
            csText.Clear();
            csText.Append("<script type=\"text/javascript\">");
            csText.Append("window.parent.jQuery('#divEdit').dialog('close');");
            csText.Append("</script>");
            cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "system_message", csText.ToString());
        }
        catch (Exception ex)
        {
            sms.utils.LogFiles.LogError(((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name + "\t" + ex.ToString());
            JSAlertHelpers.Alert(ex.Message, this);
        }
    }