Пример #1
0
    protected void ReportGridDtls_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            switch (e.CommandName)
            {
            case ("Select"):
            {
                if (Convert.ToInt32(e.CommandArgument) != 0)
                {
                    ViewState["EditId"] = Convert.ToInt32(e.CommandArgument);
                    DS = Obj_damage.GetRecordForEdit(Convert.ToInt32(e.CommandArgument), out StrError);
                    if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                    {
                        TxtReturnNo.Text   = DS.Tables[0].Rows[0]["ReturnNo"].ToString();
                        lblReturndate.Text = DS.Tables[0].Rows[0]["ReturnDate"].ToString();
                        lblPreparedBy.Text = DS.Tables[0].Rows[0]["UserName"].ToString();        // Session["UserName"].ToString();
                        lblInwardNo.Text   = DS.Tables[0].Rows[0]["InwardNo"].ToString();
                        lblInwardDate.Text = DS.Tables[0].Rows[0]["InwardDate"].ToString();
                        lblSuppName.Text   = DS.Tables[0].Rows[0]["SuplierName"].ToString();

                        lblpono.Text          = DS.Tables[0].Rows[0]["PONo"].ToString();
                        lblPODATE.Text        = DS.Tables[0].Rows[0]["PODate"].ToString();
                        lblQuotationNo.Text   = DS.Tables[0].Rows[0]["POQTNO"].ToString();
                        lblQuotationDate.Text = DS.Tables[0].Rows[0]["POQTDATE"].ToString();
                        ddlInwardNo.Enabled   = false;
                    }
                    else
                    {
                        MakeEmptyForm();
                    }
                    if (DS.Tables[1].Rows.Count > 0)
                    {
                        FlagForCalculationOperation = true;
                        GrdInward.DataSource        = DS.Tables[1];
                        GrdInward.DataBind();
                        ViewState["CurrentTable"] = DS.Tables[1];
                        ViewState["ReturnDtls"]   = DS.Tables[1];
                    }
                    DS                = null;
                    Obj_damage        = null;
                    BtnUpdate.Visible = true;
                    BtnSave.Visible   = false;
                }
                break;
            }
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
Пример #2
0
    private void SetInitialRow()
    {
        DataTable dt = new DataTable();
        DataRow   dr;

        dt.Columns.Add("#", typeof(Int32));
        dt.Columns.Add("InwardNo", typeof(string));
        dt.Columns.Add("ItemId", typeof(Int32));
        dt.Columns.Add("ItemCode", typeof(string));
        dt.Columns.Add("ItemName", typeof(string));
        dt.Columns.Add("ItemDesc", typeof(string));
        dt.Columns.Add("UnitId", typeof(Int32));
        dt.Columns.Add("Unit", typeof(string));
        dt.Columns.Add("InwardQty", typeof(decimal));
        dt.Columns.Add("DamageQty", typeof(decimal));
        dt.Columns.Add("PrevReturnQty", typeof(decimal));
        dt.Columns.Add("GrdtxtReturnQty", typeof(decimal));
        dt.Columns.Add("rate", typeof(decimal));
        dt.Columns.Add("Amount", typeof(decimal));
        dt.Columns.Add("Reason", typeof(string));
        dr                    = dt.NewRow();
        dr["#"]               = 0;
        dr["InwardNo"]        = "";
        dr["ItemId"]          = 0;
        dr["ItemCode"]        = "";
        dr["ItemName"]        = "";
        dr["ItemDesc"]        = "";
        dr["UnitId"]          = 0;
        dr["Unit"]            = "";
        dr["InwardQty"]       = 0.0;
        dr["DamageQty"]       = 0.0;
        dr["PrevReturnQty"]   = 0.0;
        dr["GrdtxtReturnQty"] = 0.0;
        dr["rate"]            = 0.0;
        dr["Amount"]          = 0.0;
        dr["Reason"]          = "";
        dt.Rows.Add(dr);
        ViewState["CurrentTable"] = dt;
        ViewState["ReturnDtls"]   = dt;
        GrdInward.DataSource      = dt;
        GrdInward.DataBind();
    }
Пример #3
0
 protected void ddlInwardNo_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         DS = Obj_damage.GetInwardDtls(Convert.ToInt32(ddlInwardNo.SelectedValue), out StrError);
         if (DS.Tables.Count > 0)
         {
             if (DS.Tables[0].Rows.Count > 0)
             {
                 lblInwardNo.Text      = DS.Tables[0].Rows[0]["InwardNo"].ToString();
                 lblInwardDate.Text    = DS.Tables[0].Rows[0]["InwardDate"].ToString();
                 lblSuppName.Text      = DS.Tables[0].Rows[0]["SuplierName"].ToString();
                 lblpono.Text          = DS.Tables[0].Rows[0]["PONo"].ToString();
                 lblPODATE.Text        = DS.Tables[0].Rows[0]["PODate"].ToString();
                 lblQuotationNo.Text   = DS.Tables[0].Rows[0]["POQTNO"].ToString();
                 lblQuotationDate.Text = DS.Tables[0].Rows[0]["POQTDATE"].ToString();
             }
             else
             {
                 lblInwardNo.Text   = "";
                 lblInwardDate.Text = "";
                 lblSuppName.Text   = "";
             }
             if (DS.Tables[1].Rows.Count > 0)
             {
                 FlagForCalculationOperation = false;
                 GrdInward.DataSource        = DS.Tables[1];
                 GrdInward.DataBind();
                 BlockTextBox();
                 ((TextBox)GrdInward.Rows[0].FindControl("GrdtxtReturnQty")).Focus();
             }
             else
             {
                 SetInitialRow();
             }
         }
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
 }