Ejemplo n.º 1
0
        public void LoadPropertyGrid(int portfolioId)
        {
            List <PropertyVo> propertyList = new List <PropertyVo>();

            try
            {
                string path = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
                int    count;

                propertyList = propertyBo.GetPropertyPortfolio(portfolioId, mypager.CurrentPage, hdnSort.Value, out count);
                if (count > 0)
                {
                    lblTotalRows.Text = hdnRecordCount.Value = count.ToString();
                    tblPager.Visible  = true;
                }
                if (propertyList != null)
                {
                    lblMsg.Visible = false;
                    DataTable dtProperty = new DataTable();
                    //dtProperty.Columns.Add("SI.No");
                    dtProperty.Columns.Add("PropertyId");
                    dtProperty.Columns.Add("Sub Category");
                    dtProperty.Columns.Add("Particulars");
                    dtProperty.Columns.Add("City");
                    dtProperty.Columns.Add("Area");
                    dtProperty.Columns.Add("Measurement Unit");
                    dtProperty.Columns.Add("Purchase Date");
                    dtProperty.Columns.Add("Purchase Cost");
                    dtProperty.Columns.Add("Current Value");
                    DataRow drProperty;
                    for (int i = 0; i < propertyList.Count; i++)
                    {
                        drProperty = dtProperty.NewRow();
                        propertyVo = new PropertyVo();
                        propertyVo = propertyList[i];
                        //drProperty[0] = (i + 1).ToString();
                        drProperty[0] = propertyVo.PropertyId.ToString();
                        drProperty[1] = propertyVo.AssetSubCategoryName.ToString();
                        drProperty[2] = propertyVo.Name.ToString();
                        drProperty[3] = propertyVo.PropertyCity.ToString();
                        drProperty[4] = propertyVo.Quantity.ToString("f0");
                        drProperty[5] = XMLBo.GetMeasureCodeName(path, propertyVo.MeasureCode.ToString());
                        if (propertyVo.PurchaseDate != DateTime.MinValue)
                        {
                            drProperty[6] = propertyVo.PurchaseDate.ToString("dd/MM/yyyy");
                        }
                        else
                        {
                            drProperty[6] = string.Empty;
                        }
                        drProperty[7] = propertyVo.PurchaseValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));
                        drProperty[8] = propertyVo.CurrentValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));

                        dtProperty.Rows.Add(drProperty);
                    }
                    gvrProperty.DataSource = dtProperty;
                    gvrProperty.DataBind();
                    this.GetPageCount();
                }
                else
                {
                    lblMsg.Visible         = true;
                    gvrProperty.DataSource = null;
                    gvrProperty.DataBind();
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "PortfolioProperty.ascx:LoadPropertyGrid()");
                object[] objects = new object[2];
                objects[0]   = propertyVo;
                objects[1]   = propertyList;
                FunctionInfo = exBase.AddObject(FunctionInfo, null);/*, objects*/
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }