Ejemplo n.º 1
0
        protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                double dblChallanAmnt = 0;
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    ChlnBookingCrsngDAL obj = new ChlnBookingCrsngDAL();
                    Int64 ChlnIdno          = Convert.ToInt64(DataBinder.Eval(e.Row.DataItem, "Chln_Idno"));
                    if ((obj.CheckBilled(ChlnIdno, ApplicationFunction.ConnectionString())) > 0)
                    {
                        LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
                        lnkbtnDelete.Visible = false;
                        e.Row.ForeColor      = System.Drawing.Color.Maroon;
                    }
                    obj = null;

                    dblChallanAmnt  = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "Net_Amnt"));
                    dblTChallanAmnt = dblChallanAmnt + dblTChallanAmnt;
                }
                else if (e.Row.RowType == DataControlRowType.Footer)
                {
                    Label lblTChallanAmnt = (Label)e.Row.FindControl("lblNetAmnt");
                    lblTChallanAmnt.Text = dblTChallanAmnt.ToString("N2");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private void Populate(Int64 HeadId)
        {
            ChlnBookingCrsngDAL obj          = new ChlnBookingCrsngDAL();
            tblChlnBookHead     chlnBookhead = obj.selectHead(HeadId);

            ddldateRange.SelectedValue = Convert.ToString(chlnBookhead.Year_Idno);
            ddldateRange_SelectedIndexChanged(null, null);
            ddldateRange.Enabled        = false;
            txtchallanNo.Text           = chlnBookhead.Chln_No;
            txtDate.Text                = Convert.ToDateTime(chlnBookhead.Chln_Date).ToString("dd-MM-yyyy");
            ddlTranspoter.SelectedValue = Convert.ToString(chlnBookhead.Transprtr_Idno);
            txtchlnRef.Text             = Convert.ToString(chlnBookhead.Ref_No);
            ddlTruckNo.SelectedValue    = Convert.ToString(chlnBookhead.Truck_Idno);
            ddlTruckNo_SelectedIndexChanged(null, null);
            txtgrossAmnt.Text             = Convert.ToDouble(chlnBookhead.Gross_Amnt).ToString("N2");
            txtKattAmnt.Text              = Convert.ToDouble(chlnBookhead.Other_Amnt).ToString("N2");
            txtNetAmnt.Text               = Convert.ToDouble(chlnBookhead.Net_Amnt).ToString("N2");
            hidWorkType.Value             = Convert.ToString(chlnBookhead.Work_type);
            DdlfromcityHead.SelectedValue = Convert.ToString(chlnBookhead.BaseCity_Idno);
            dtTemp          = obj.selectDetl(ApplicationFunction.ConnectionString(), Convert.ToInt32(ddldateRange.SelectedValue), HeadId);
            ViewState["dt"] = dtTemp;
            this.BindGridT();
            //  imgSearch.Enabled = false;
            Int64 value = 0;

            value = obj.CheckBilled(HeadId, ApplicationFunction.ConnectionString());
            if (value > 0)
            {
                lnkbtnSave.Enabled = false;
            }
            else
            {
                lnkbtnSave.Enabled = true;
            }
            obj = null;
        }