//private void updateTradeBusinessDate(int TradeBusinessId, string TradeBusinessDate, string TradeBusinessExecutionDate)
        //{
        //    try
        //    {
        //        bool result;
        //        TradeBusinessDateVo TradeBusinessDateVo = new TradeBusinessDateVo();
        //        TradeBusinessDateVo.TradeBusinessId = TradeBusinessId;
        //        TradeBusinessDateVo.TradeBusinessDate = DateTime.Parse(TradeBusinessDate);
        //        TradeBusinessDateVo.TradeBusinessExecutionDate = DateTime.Parse(TradeBusinessExecutionDate);
        //        result = OnlineOrderBackOfficeBo.updateTradeBusinessDate(TradeBusinessDateVo);

        //    }
        //    catch (BaseApplicationException Ex)
        //    {
        //        throw Ex;
        //    }
        //    catch (Exception Ex)
        //    {
        //        BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex);
        //        NameValueCollection FunctionInfo = new NameValueCollection();
        //        FunctionInfo.Add("Method", "TradeBusinessDate.ascx.cs:updateTradeBusinessDate()");
        //        object[] objects = new object[2];
        //        objects[0] = TradeBusinessId;
        //        objects[1] = TradeBusinessDate;
        //        FunctionInfo = exBase.AddObject(FunctionInfo, objects);
        //        exBase.AdditionalInformation = FunctionInfo;
        //        ExceptionManager.Publish(exBase);
        //        throw exBase;
        //    }
        //}

        private void deleteTradeBusinessDate(int TradeBusinessId)
        {
            try
            {
                bool result;
                TradeBusinessDateVo TradeBusinessDateVo = new TradeBusinessDateVo();
                TradeBusinessDateVo.TradeBusinessId = TradeBusinessId;
                result = OnlineOrderBackOfficeBo.deleteTradeBusinessDate(TradeBusinessId);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "TradeBusinessDate.ascx.cs:deleteTradeBusinessDate()");
                object[] objects = new object[1];
                objects[0]   = TradeBusinessId;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private void createTradeBusinessDate(string TradeBusinessDate, string TradeBusinessExecutionDate, int holiday, int weekend)
        {
            try
            {
                bool result;
                TradeBusinessDateVo TradeBusinessDateVo = new TradeBusinessDateVo();
                TradeBusinessDateVo.TradeBusinessDate          = DateTime.Parse(TradeBusinessDate);
                TradeBusinessDateVo.TradeBusinessExecutionDate = DateTime.Parse(TradeBusinessExecutionDate);
                TradeBusinessDateVo.IsTradeBusinessDateHoliday = holiday;
                TradeBusinessDateVo.IsTradeBusinessDateWeekend = weekend;
                result = OnlineOrderBackOfficeBo.CreateTradeBusinessDate(TradeBusinessDateVo);
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Calendar Created!!');", true);
            }

            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "TradeBusinessDate.ascx.cs:CreateTradeBusinessDate()");
                object[] objects = new object[4];
                objects[0]   = TradeBusinessDate;
                objects[1]   = TradeBusinessExecutionDate;
                objects[2]   = holiday;
                objects[3]   = weekend;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void btnOk_Click(object sender, EventArgs e)
        {
            TradeBusinessDateVo TradeBusinessDateVo = new TradeBusinessDateVo();

            markholiday();
            string[] strDates = strdt.Split();
            strdt = strDates[0];
            if (!string.IsNullOrEmpty(Texcmt.Text))
            {
                TradeBusinessDateVo.HolidayName = Texcmt.Text;
            }
            OnlineOrderBackOfficeBo.MakeTradeToHoliday(Convert.ToDateTime(strdt), datesToBeUpdated, TradeBusinessDateVo);
            radwindowPopup.VisibleOnPageLoad = false;
            Texcmt.Text = String.Empty;
            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Holiday created!!');", true);
            BindTradebusinessdate();

            //GetTradeBusinessDates();
        }
        protected void gvTradeBusinessDateDetails_ItemCommand(object source, GridCommandEventArgs e)
        {
            DataTable getTradeBusinessDateDt = new DataTable();

            if (e.CommandName == RadGrid.UpdateCommandName)
            {
                OnlineOrderBackOfficeBo OnlineOrderBackOfficeBo = new OnlineOrderBackOfficeBo();
                TradeBusinessDateVo     TradeBusinessDateVo     = new TradeBusinessDateVo();
                GridEditableItem        gridEditableItem        = (GridEditableItem)e.Item;
                int           TradeBusinessId = Convert.ToInt32(gvTradeBusinessDate.MasterTableView.DataKeyValues[e.Item.ItemIndex]["WTBD_Id"].ToString());
                RadDatePicker date1           = (RadDatePicker)e.Item.FindControl("RadDatePicker1");
                //RadDatePicker dt2 = (RadDatePicker)e.Item.FindControl("RadDatePicker2");
                // RadDatePicker txtdate = (RadDatePicker)e.Item.FindControl("txtdate");
                TextBox txtHoliday = (TextBox)e.Item.FindControl("txtHolidaysName");
                TradeBusinessDateVo.HolidayName       = txtHoliday.Text.ToString();
                TradeBusinessDateVo.TradeBusinessDate = date1.SelectedDate.Value;

                if (date1.SelectedDate != null)
                {
                    bool bln = OnlineOrderBackOfficeBo.updateTradeBusinessDate(TradeBusinessId, TradeBusinessDateVo.HolidayName, TradeBusinessDateVo.TradeBusinessDate);
                    //GetTradeBusinessDates();
                    BindTradebusinessdate();
                }
            }
            if (e.CommandName == RadGrid.RebindGridCommandName)
            {
                //GetTradeBusinessDates();
            }
            if (e.CommandName == RadGrid.DeleteCommandName)
            {
                OnlineOrderBackOfficeBo = new OnlineOrderBackOfficeBo();
                GridDataItem dataItem        = (GridDataItem)e.Item;
                int          TradeBusinessId = Convert.ToInt32(gvTradeBusinessDate.MasterTableView.DataKeyValues[e.Item.ItemIndex]["WTBD_DayName"].ToString());
                //RadDatePicker dt1 = (RadDatePicker)e.Item.FindControl("RadDatePicker1");
                //RadDatePicker dt2 = (RadDatePicker)e.Item.FindControl("RadDatePicker2");
                //RadDatePicker txtdate = (RadDatePicker)e.Item.FindControl("txtdate");
                //RadDatePicker txtExecutionDate = (RadDatePicker)e.Item.FindControl("txtExecutionDate");
                //if (dt1.SelectedDate != null)
                //{
                deleteTradeBusinessDate(TradeBusinessId);
                //}
                ////GetTradeBusinessDates();
            }
            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                GridEditableItem gridEditableItem = (GridEditableItem)e.Item;
                RadDatePicker    dt1 = (RadDatePicker)e.Item.FindControl("RadDatePicker1");
                RadDatePicker    txtExecutionDate = (RadDatePicker)e.Item.FindControl("txtExecutionDate");
                RadioButton      rbtnIsHoliday    = (RadioButton)e.Item.FindControl("rbtnIsHoliday");
                RadioButton      rbtnIsWeekened   = (RadioButton)e.Item.FindControl("rbtnIsWeekened");

                if (rbtnIsHoliday.Checked == true)
                {
                    holiday = 1;
                }
                else
                {
                    holiday = 0;
                }

                if (rbtnIsWeekened.Checked == true)
                {
                    weekend = 1;
                }
                else
                {
                    weekend = 0;
                }

                createTradeBusinessDate(dt1.SelectedDate.ToString(), txtExecutionDate.SelectedDate.ToString(), holiday, weekend);
            }
            //GridCommandItem commandItem = (GridCommandItem)gvTradeBusinessDate.MasterTableView.GetItems(GridItemType.CommandItem)[0];
            //commandItem.FindControl("AddNewRecordButton").Parent.Visible = false;
        }