Esempio n. 1
0
    protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string message = "";

        try
        {
            PriceListDetails m_PriceListDetails = new PriceListDetails();
            m_PriceListDetails.PriceListDetailId = System.Int32.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString());
            m_PriceListDetails.Delete();
        }
        catch (Exception ex)
        {
            sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
        }
        ShowGrid();
    }
Esempio n. 2
0
 private void bindData()
 {
     System.Int32 EditId;
     if (Request.QueryString["id"] == null)
     {
         return;
     }
     else
     {
         EditId = System.Int32.Parse(Request.QueryString["id"].ToString());
         PriceListDetails m_PriceListDetails = new PriceListDetails();
         m_PriceListDetails.PriceListDetailId = EditId;
         m_PriceListDetails = m_PriceListDetails.Get();
         txPriceListId.Text = m_PriceListDetails.PriceListId.ToString();
         txProductId.Text   = m_PriceListDetails.ProductId.ToString();
         txUnitId.Text      = m_PriceListDetails.UnitId.ToString();
         txPrice.Text       = m_PriceListDetails.Price.ToString();
         txCrUserId.Text    = m_PriceListDetails.CrUserId.ToString();
     }
 }
Esempio n. 3
0
    //--------------------------------------------------------------------------------

    private void ShowGrid()
    {
        try
        {
            PriceListDetails m_PriceListDetails = new PriceListDetails();
            m_PriceListDetails.PriceListDetailName = txtSearch.Text;
            string DateFrom = txtDateFrom.Text;
            string DateTo   = txtDateTo.Text;
            int    RowCount = 0;
            List <PriceListDetails> l_PriceListDetails = m_PriceListDetails.GetPage("", "", ddlOrderBy.SelectedValue, m_grid.PageSize, CustomPaging.PageIndex - 1, ref RowCount);

            m_grid.DataSource = l_PriceListDetails;
            m_grid.DataBind();
            lblTong.Text           = RowCount.ToString();
            CustomPaging.TotalPage = (RowCount == 0) ? 1 : (RowCount % m_grid.PageSize == 0) ? RowCount / m_grid.PageSize : (RowCount - RowCount % m_grid.PageSize) / m_grid.PageSize + 1;
        }
        catch (Exception ex)
        {
            sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
        }
    }
Esempio n. 4
0
 protected void lbDelete_Click(object sender, EventArgs e)
 {
     try
     {
         PriceListDetails m_PriceListDetails = new PriceListDetails();
         foreach (GridViewRow m_Row in m_grid.Rows)
         {
             CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction");
             if (chkAction != null)
             {
                 if (chkAction.Checked)
                 {
                     m_PriceListDetails.PriceListDetailId = System.Int32.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString());
                     m_PriceListDetails.Delete();
                 }
             }
         }
         ShowGrid();
     }
     catch (Exception ex)
     {
         sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
     }
 }
Esempio n. 5
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int32     EditId;
        PriceListDetails m_PriceListDetails = new PriceListDetails();

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


            m_PriceListDetails.CrUserId = ActUserId;

            m_PriceListDetails.PriceListId = int.Parse(txPriceListId.Text);

            m_PriceListDetails.ProductId = int.Parse(txProductId.Text);

            m_PriceListDetails.UnitId = short.Parse(txUnitId.Text);

            if (txPrice.Text != "")
            {
                m_PriceListDetails.Price = txPrice.Text;
            }

            m_PriceListDetails.PriceListDetailId = EditId;
            SysMessageTypeId = m_PriceListDetails.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);
        }
    }