Beispiel #1
0
 private void bindData()
 {
     System.Int32 EditId;
     if (Request.QueryString["id"] == null)
     {
         return;
     }
     else
     {
         EditId = System.Int32.Parse(Request.QueryString["id"].ToString());
         Manufacturers m_Manufacturers = new Manufacturers();
         m_Manufacturers.ManufacturerId = EditId;
         m_Manufacturers         = m_Manufacturers.Get();
         txManufacturerName.Text = m_Manufacturers.ManufacturerName.ToString();
         txManufacturerDesc.Text = m_Manufacturers.ManufacturerDesc.ToString();
         txStatusId.Text         = m_Manufacturers.StatusId.ToString();
         txDisplayOrder.Text     = m_Manufacturers.DisplayOrder.ToString();
     }
 }
Beispiel #2
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int32  EditId;
        Manufacturers m_Manufacturers = new Manufacturers();

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


            m_Manufacturers.CrUserId = ActUserId;

            if (txManufacturerName.Text != "")
            {
                m_Manufacturers.ManufacturerName = txManufacturerName.Text;
            }

            if (txManufacturerDesc.Text != "")
            {
                m_Manufacturers.ManufacturerDesc = txManufacturerDesc.Text;
            }

            m_Manufacturers.StatusId = byte.Parse(txStatusId.Text);

            m_Manufacturers.DisplayOrder = int.Parse(txDisplayOrder.Text);

            m_Manufacturers.ManufacturerId = EditId;
            SysMessageTypeId = m_Manufacturers.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);
        }
    }