Ejemplo n.º 1
0
        /// <summary>
        /// Modified the function to add total field to the Client List Grid
        /// </summary>
        /// <param name="RMId"></param>
        public void getCustomerListforRM(int RMId)
        {
            DataSet dsCurrentValues = null;
            double  total           = 0.00;

            try
            {
                dsCurrentValues = assetBo.GetRMCustomersAssetAggregateCurrentValues(RMId);

                if (dsCurrentValues != null)
                {
                    DataTable dtCurrentValusForRM = new DataTable();
                    dtCurrentValusForRM.Columns.Add("CustomerId");
                    dtCurrentValusForRM.Columns.Add("Customer_Name");
                    dtCurrentValusForRM.Columns.Add("EQCurrentVal");
                    dtCurrentValusForRM.Columns.Add("MFCurrentVal");
                    dtCurrentValusForRM.Columns.Add("Total");
                    DataRow drCurrentValuesForRM;

                    for (int i = 0; i < dsCurrentValues.Tables[0].Rows.Count; i++)
                    {
                        drCurrentValuesForRM    = dtCurrentValusForRM.NewRow();
                        drCurrentValuesForRM[0] = dsCurrentValues.Tables[0].Rows[i]["CustomerId"].ToString();
                        drCurrentValuesForRM[1] = dsCurrentValues.Tables[0].Rows[i]["Customer_Name"].ToString();
                        drCurrentValuesForRM[2] = String.Format("{0:n2}", decimal.Parse(dsCurrentValues.Tables[0].Rows[i]["EQCurrentVal"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                        drCurrentValuesForRM[3] = String.Format("{0:n2}", decimal.Parse(dsCurrentValues.Tables[0].Rows[i]["MFCurrentVal"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                        total = double.Parse(dsCurrentValues.Tables[0].Rows[i]["EQCurrentVal"].ToString()) + double.Parse(dsCurrentValues.Tables[0].Rows[i]["MFCurrentVal"].ToString());
                        drCurrentValuesForRM[4] = String.Format("{0:n2}", total.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));

                        dtCurrentValusForRM.Rows.Add(drCurrentValuesForRM);
                    }
                    gvrRMClinetList.DataSource = dtCurrentValusForRM;
                    gvrRMClinetList.DataBind();
                }

                /* If AUM is zero, donot show customers */
                //gvrRMClinetList.DataSource = dsCurrentValues;
                //gvrRMClinetList.DataBind();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "RMDashboard.ascx:getCustomerListforRM()");
                object[] objects = new object[1];
                objects[0]   = dsCurrentValues;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }