void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (88);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

            TableRow.LayoutParams p = new TableRow.LayoutParams ();
            p.Height = TableLayout.LayoutParams.WrapContent;
            p.Width = TableLayout.LayoutParams.WrapContent;
            p.Gravity = GravityFlags.Center;

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in currentAttendances) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -70;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in currentAttendances) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;

                        string value = string.Empty;
                        if (attendace.id != -1) {
                            value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id);
                        } else {
                            value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
                            rl.Click += Rl_Click;
                        }

                        TextView vvv = new TextView (Activity);
                        vvv.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals(@"N")) {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_danger);
            //							rl.SetBa
                            rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
            //							rl.SetBackgroundResource(Resource.Style.alert_success);
                        } else {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_success);
            //							vvv.SetTextSize (ComplexUnitType.Sp, 24);
            //							vvv.SetTextColor(Android.Graphics.Color.Argb);

                            rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                        }
                        vvv.Text = AttendanceResult.StringBoolToRussian(value);
                        rl.AddView (vvv);
                        rr.AddView (rl);
                    }

                    tl.AddView (rr);
                }

                r.AddView (tl);
                table.AddView (r);
            }
        }
        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (70);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

            TableRow.LayoutParams p = new TableRow.LayoutParams ();
            p.Height = TableLayout.LayoutParams.WrapContent;
            p.Width = TableLayout.LayoutParams.WrapContent;
            p.Gravity = GravityFlags.Center;

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in drugInfo.attendaces) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -60;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in drugInfo.attendaces) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;
                        rl.Click += (object sender, EventArgs e) => {
                            RelativeLayout rlAttendace = (RelativeLayout) sender;
                            TableRow trDrug = (TableRow) rl.Parent;
                            TableLayout trInfo = (TableLayout) rl.Parent.Parent;

                            string message = string.Format(@"Click to RL.id:{0}, P,id:{1}, PP.id:{2}", rlAttendace.Id, trDrug.Id, trInfo.Id);

                            Toast.MakeText(Activity,  message, ToastLength.Short).Show();

                            FragmentTransaction trans = FragmentManager.BeginTransaction ();
                            DrugInfoValueDialog drugInfoValueDialog = new DrugInfoValueDialog ();
                            Bundle args = new Bundle();
                            args.PutInt(DrugInfoValueDialog.ATTENDANCE_ID, rlAttendace.Id);
                            args.PutInt(DrugInfoValueDialog.DRUG_ID, trDrug.Id);
                            args.PutInt(DrugInfoValueDialog.INFO_ID, trInfo.Id);
            //							args.PutString(DrugInfoValueDialog.VALUE, GetDrugInfoValue(drugInfo.attendaces[rlAttendace.Id - 1].results, trInfo.Id, trDrug.Id));

                            drugInfoValueDialog.Arguments = args;
                            drugInfoValueDialog.AfterSave += DrugInfoValueDialog_AfterSave;

                            drugInfoValueDialog.Show (trans, "dialog fragment");

                            Log.Info ("ifSignInButton", "Click");
                        };

            //						string value = GetDrugInfoValue (attendace.results, info.id, drug.id);

                        if (string.IsNullOrEmpty (value)) {
                            ImageView iv = new ImageView (Activity);
                            iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
                            rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
            //							rl.SetBackgroundResource(Resource.Style.alert_success);
                            rl.AddView (iv);
                        } else {
                            TextView vvv = new TextView (Activity);
                            vvv.Gravity = GravityFlags.Center;
                            vvv.Text = value;
                            vvv.SetTextAppearance (Activity, Resource.Style.text_success);
            //							vvv.SetTextSize (ComplexUnitType.Sp, 24);
            //							vvv.SetTextColor(Android.Graphics.Color.Argb);

                            rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                            rl.AddView (vvv);
                        }

                        rr.AddView (rl);
                    }

                    //					for (int i = 0; i < 2; i++) { // Values
                    //						ImageView iv = new ImageView (Activity);
                    //						iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
                    //						rr.AddView (iv);
                    //					}

                    tl.AddView (rr);
                }

                r.AddView (tl);
                table.AddView (r);
            }
        }