Пример #1
0
        protected void edit_Command(object sender, CommandEventArgs e)
        {
            Driver temDriver = new Driver();
            int    index     = Convert.ToInt32(e.CommandArgument);

            if (SearchDriverList.Count > 0)
            {
                temDriver = SearchDriverList[index];
            }
            else
            {
                temDriver = DriverList[index];
            }
            try
            {
                IdHid.Value                      = temDriver.Id.ToString();
                NameTxt.Text                     = temDriver.Name;
                AddressTxt.Text                  = temDriver.Address;
                PhoneTxt.Text                    = temDriver.phone;
                licenseTxt.Text                  = temDriver.license;
                LicenceDateTxt.Text              = ExtendedMethod.ParseDateToString(DateTime.Parse(temDriver.LicenceDate.ToString()));
                LicencePeriodTxt.Text            = temDriver.LicencePeriod.ToString();
                AlertPeriodTxt.Text              = temDriver.AlertPeriod.ToString();
                AddTrafDepListhtml.SelectedValue = temDriver.TrafficDepID.ToString();
            }
            catch (Exception Exec)
            {
            }

            SearchDriverList = new List <Driver>();
            UpdatePanel3.Update();
        }
Пример #2
0
        protected void edit_Command(object sender, CommandEventArgs e)
        {
            Cars temCar = new Cars();
            int  index  = Convert.ToInt32(e.CommandArgument);

            if (SearchCarsList.Count > 0)
            {
                temCar = SearchCarsList[index];
            }
            else
            {
                temCar = CarsList[index];
            }
            try
            {
                CarsIdHid.Value       = temCar.id.ToString();
                CarNoTxt.Text         = temCar.CarNo;
                LicenceNOTxt.Text     = temCar.LicenceNO;
                LicenceDateTxt.Text   = ExtendedMethod.ParseDateToString(DateTime.Parse(temCar.LicenceDate.ToString()));
                LicencePeriodTxt.Text = temCar.LicencePeriod.ToString();
                AlertPeriodTxt.Text   = temCar.AlertPeriod.ToString();

                AddColorListhtml.SelectedValue    = temCar.ColorId.ToString();
                AddCityListhtml.SelectedValue     = temCar.CityId.ToString();
                AddCarTypeListhtml.SelectedValue  = temCar.CarTypeId.ToString();
                AddTrafDepListhtml.SelectedValue  = temCar.TrafficDepID.ToString();
                AddSupplierListhtml.SelectedValue = temCar.SubAccId.ToString();
            }
            catch (Exception Exec)
            {
            }

            SearchCarsList = new List <Cars>();
            UpdatePanel3.Update();
        }
        public void SearchFn(int AccountID)
        {
            EditFlag         = true;
            AddErrorTxt.Text = "";
            Sub_Account      = new SubAccount();
            Sub_Account_List = new List <SubAccount>();
            int level = 4;

            Sub_Account = db.SubAccount.ToList().Where(s => s.ID == AccountID).FirstOrDefault();             //  Sub_Account.GetSubAccount_ByID(AccountID).ElementAtOrDefault(0);
            level       = (int)Sub_Account.Level;
            SubAccount Sub_Account1 = db.SubAccount.ToList().Where(s => s.ID == AccountID).FirstOrDefault(); // Sub_Account.GetSubAccount_ByID(AccountID).ElementAtOrDefault(0);

            if (Sub_Account1 != null)
            {
                AccountNoForSearchDrop.SelectedValue = Sub_Account1.ID.ToString();
            }
            AccountIDTxt.Text              = Sub_Account1.ID.ToString();
            SubAccountManulID              = int.Parse(AccountIDTxt.Text);
            AccountNameTxt.Text            = Sub_Account1.name;
            DateTxt.Text                   = ExtendedMethod.ParseDateToString((DateTime)Sub_Account1.RegisterDate);
            AccountStateDrop.SelectedValue = Sub_Account1.BType;
            BalanceTxt.Text                = Sub_Account1.ABalance.ToString();
            Indx PersonalIndx = new Indx();

            try
            {
                PersonalIndx = db.Indx.ToList().Where(i => i.Sub_ID == Int64.Parse(AccountIDTxt.Text)).FirstOrDefault();// PersonalIndx.GetIndx_BySubID(Int64.Parse(AccountIDTxt.Text)).FirstOrDefault();

                if (PersonalIndx.ClientCategory != "")
                {
                    ClientCategoryList.SelectedItem.Text = PersonalIndx.ClientCategory;
                }
                if (PersonalIndx.ClientType != "")
                {
                    ClentTypelist.SelectedItem.Text = PersonalIndx.ClientType;
                }
                if (PersonalIndx.SalesUesrId.ToString() != "")
                {
                    SalesUesrId.SelectedValue = PersonalIndx.SalesUesrId.ToString();
                }
                ResponsiblePersonName.Text         = PersonalIndx.ResponsiblePersonName;
                ResponsiblePersonPhone.Text        = PersonalIndx.ResponsiblePersonPhone;
                AnotherResponsiblePersonPhone.Text = PersonalIndx.AnotherResponsiblePersonPhone;
                EmailTxt.Text           = PersonalIndx.Email;;
                Addess.Text             = PersonalIndx.Address;
                Sgl_TaxNO.Text          = PersonalIndx.Sgl_TaxNO;
                CommercialDocument.Text = PersonalIndx.CommercialDocument;
                TaxDocument.Text        = PersonalIndx.TaxDocument;
                PersonalIndx.Sub_ID     = Int64.Parse(AccountIDTxt.Text);
            }
            catch (Exception ex)
            {
            }
            OldSubAccountManul = SubAccountManulID;
        }
Пример #4
0
        protected void edit_Command(object sender, CommandEventArgs e)
        {
            EditFlage = true;
            //enable After Part Untill edit
            After.Enabled       = true;
            DateAfter.Enabled   = true;
            AtHourAfter.Enabled = true;
            //Disable Before Part Untill edit
            Before.Enabled       = false;
            DateBefore.Enabled   = false;
            AtHourBefore.Enabled = false;

            CarChangeRateOnDis temCarChangeRateOndis = new CarChangeRateOnDis();
            int index = Convert.ToInt32(e.CommandArgument);

            if (SearchCarChangeRateOnDisList.Count > 0)
            {
                temCarChangeRateOndis = SearchCarChangeRateOnDisList[index];
            }
            else
            {
                temCarChangeRateOndis = CarChangeRateOnDisList[index];
            }
            try
            {
                IdHid.Value      = temCarChangeRateOndis.Id.ToString();
                Description.Text = temCarChangeRateOndis.Description;

                AddCarsListhtml.SelectedValue     = temCarChangeRateOndis.CarId.ToString();
                AddServicesListhtml.SelectedValue = temCarChangeRateOndis.ServiceId.ToString();

                Before.Text       = temCarChangeRateOndis.Before.ToString();
                DateBefore.Text   = ExtendedMethod.ParseDateToString(DateTime.Parse(temCarChangeRateOndis.DateBefore.ToString()));
                AtHourBefore.Text = temCarChangeRateOndis.AtHourBefore;

                After.Text       = temCarChangeRateOndis.After.ToString();
                DateAfter.Text   = ExtendedMethod.ParseDateToString(DateTime.Parse(temCarChangeRateOndis.DateAfter.ToString()));
                AtHourAfter.Text = temCarChangeRateOndis.AtHourAfter;
            }
            catch (Exception Exec)
            {
            }
            SearchCarChangeRateOnDisList = new List <CarChangeRateOnDis>();
            UpdatePanel3.Update();
        }
        public void SearchFn(int AccountID)
        {
            EditFlag         = true;
            AddErrorTxt.Text = "";
            Sub_Account      = new SubAccount();
            Sub_Account_List = new List <SubAccount>();
            int level = 4;

            Sub_Account = db.SubAccount.ToList().Where(s => s.ID == AccountID).FirstOrDefault();             //  Sub_Account.GetSubAccount_ByID(AccountID).ElementAtOrDefault(0);
            level       = (int)Sub_Account.Level;
            SubAccount Sub_Account1 = db.SubAccount.ToList().Where(s => s.ID == AccountID).FirstOrDefault(); // Sub_Account.GetSubAccount_ByID(AccountID).ElementAtOrDefault(0);

            if (Sub_Account1 != null)
            {
                AccountNoForSearchDrop.SelectedValue = Sub_Account1.ID.ToString();
            }
            AccountIDTxt.Text              = Sub_Account1.ID.ToString();
            SubAccountManulID              = int.Parse(AccountIDTxt.Text);
            AccountNameTxt.Text            = Sub_Account1.name;
            DateTxt.Text                   = ExtendedMethod.ParseDateToString((DateTime)Sub_Account1.RegisterDate);
            AccountStateDrop.SelectedValue = Sub_Account1.BType;
            BalanceTxt.Text                = Sub_Account1.ABalance.ToString();
            Indx PersonalIndx = new Indx();

            try
            {
                PersonalIndx     = db.Indx.ToList().Where(i => i.Sub_ID == Int64.Parse(AccountIDTxt.Text)).FirstOrDefault();// PersonalIndx.GetIndx_BySubID(Int64.Parse(AccountIDTxt.Text)).FirstOrDefault();
                PersonalID.Text  = PersonalIndx.PersonalID;
                MobileNoTxt.Text = PersonalIndx.MobileNo;
                EmailTxt.Text    = PersonalIndx.Email;
                Sgl_TaxNO.Text   = PersonalIndx.Sgl_TaxNO;
                TaxDocument.Text = PersonalIndx.TaxDocument;
                maamoriaTxt.Text = PersonalIndx.Maamria;
                Addess.Text      = PersonalIndx.Address;
            }
            catch (Exception ex)
            {
            }

            OldSubAccountManul = SubAccountManulID;
        }
Пример #6
0
        void searchFn(int ID)
        {
            EditFlag = true;

            Khzna_Moved = new KhznaMoved();
            Bank_Moved  = new BankMoved();
            Sub_Account = new SubAccount();
            OldEntry    = new Entry();
            if (MonyTypeDrop.SelectedIndex == 0)                                                                      //نقدى
            {
                Khzna_Moved      = db.KhznaMoved.Where(k => k.ID == ID & k.state == false).ToList().FirstOrDefault(); //  Khzna_Moved.GetKhznaMoved_ByID(ID, 0).ElementAt(0);
                OperationID.Text = Khzna_Moved.ID.ToString();
                Value.Text       = String.Format("{0:0.00}", Khzna_Moved.Value);
                FromSubAccountsID.Items.Clear();
                FromSubAccountsID.DataBind();
                FromSubAccountsID.DataSource     = db.SubAccount.ToList().Where(s => s.ID == int.Parse(Khzna_Moved.AccountID.ToString()));//  Sub_Account.GetSubAccount_ByID(int.Parse(Khzna_Moved.AccountID.ToString()));
                FromSubAccountsID.DataValueField = "ID";
                FromSubAccountsID.DataTextField  = "name";
                FromSubAccountsID.DataBind();
                string khaznaNaname = ToKhaznaDrop.SelectedValue; //Sub_Account.GetSubAccount_ByID(int.Parse(Khzna_Moved.TreasuryID.ToString())).ElementAtOrDefault(0).name;
                ToKhaznaDrop.SelectedValue = khaznaNaname;
                DescTxt.Text      = Khzna_Moved.Description;
                ReceivedDate.Text = ExtendedMethod.ParseDateToString((DateTime)Khzna_Moved.Date);
                if (Khzna_Moved.FinancialPostitionId != 0 && Khzna_Moved.FinancialPostitionType != "")
                {
                    add_Edit_financialPosInfo((int)Khzna_Moved.FinancialPostitionId, Khzna_Moved.FinancialPostitionType);
                }
                DeleteMonyInBtn.Enabled = true;
                DeleteMonyInBtn.Enabled = true;

                OldKhznaID             = int.Parse(ToKhaznaDrop.SelectedValue);
                OldEntry.Date          = DateTime.Parse(ReceivedDate.Text, CultureInfo.CreateSpecificCulture("ar-EG"));
                OldEntry.description   = DescTxt.Text;
                OldEntry.SubAccount_id = int.Parse(FromSubAccountsID.SelectedValue);

                OldValue       = float.Parse(Value.Text);
                OldDescription = DescTxt.Text;
            }
            else//شيك
            {
                Bank_Moved = db.BankMoved.Where(b => b.ID == ID & b.state == false).ToList().FirstOrDefault();// Bank_Moved.GetBankMoving_ByID(ID, 0).ElementAt(0);
                if (Bank_Moved.FinancialPostitionId != 0 && Bank_Moved.FinancialPostitionType != "")
                {
                    add_Edit_financialPosInfo((int)Bank_Moved.FinancialPostitionId, Bank_Moved.FinancialPostitionType);
                }
                OperationID.Text = Bank_Moved.ID.ToString();
                Value.Text       = String.Format("{0:0.00}", Bank_Moved.Value);
                //FromSubAccountsID.Items.Clear();
                //FromSubAccountsID.DataBind();

                //FromSubAccountsID.Items.Add(Sub_Account.GetSubAccount_ByID(int.Parse(Bank_Moved.AccountID.ToString())).ElementAt(0).name.ToString());
                FromSubAccountsID.SelectedItem.Text = db.SubAccount.ToList().Where(s => s.ID == int.Parse(Bank_Moved.AccountID.ToString())).ToList().FirstOrDefault().name;// Sub_Account.GetSubAccount_ByID(int.Parse(Bank_Moved.AccountID.ToString())).ElementAt(0).name;
                DescTxt.Text            = Bank_Moved.Description;
                ReceivedDate.Text       = ExtendedMethod.ParseDateToString((DateTime)Khzna_Moved.Date);
                SarfDateTxt.Text        = Bank_Moved.SarfDate.ToString();
                DeleteMonyInBtn.Enabled = true;
                ChecqRow.Visible        = true;
                //BankNameRow.Visible = true;
                ToKhaznaDrop.SelectedItem.Value = Bank_Moved.DocID.ToString();
                ChequeNoTxt.Text = Bank_Moved.ChequeNo;
                //BankDropID.SelectedValue = Bank_Moved.BankName;
                DeleteMonyInBtn.Enabled = true;
                // OldDate = SarfDateTxt.Text;
                OldEntry.Date = DateTime.Parse(SarfDateTxt.Text, CultureInfo.CreateSpecificCulture("ar-EG"));
                OldCheq       = ChequeNoTxt.Text;
                //OldBankName = BankDropID.SelectedValue;
                OldBankID = int.Parse(ToKhaznaDrop.SelectedValue);
                OldEntry.SubAccount_id = int.Parse(FromSubAccountsID.SelectedItem.Value);

                OldValue       = float.Parse(Value.Text);
                OldDescription = DescTxt.Text;
            }
        }
        public void Calc_Operation()
        {
            attemptValue          = 0;
            Account               = new SubAccount();
            Khazna_Moved_List     = new List <KhznaMoved>();
            Bank_Moved_List       = new List <BankMoved>();
            Purchase_Invoice_List = new List <PurchaseInvoice>();
            Khazna_Moved          = new KhznaMoved();
            Bank_Moved            = new BankMoved();
            Purchase_Invoice      = new PurchaseInvoice();

            // Khazna_Moved_List = Khazna_Moved.GetKhznaMoved_ByAccountIDByDate(int.Parse(AccountDropID.SelectedValue),FromDateTxt.Text,ToDateTxt.Text);
            // Bank_Moved_List = Bank_Moved.BankMoved_Between_Date_ForAccount(FromDateTxt.Text,ToDateTxt.Text, int.Parse(AccountDropID.SelectedValue));

            Khazna_Moved_List = db.KhznaMoved.ToList().Where(o => o.AccountID == int.Parse(AccountDropID.SelectedValue)).ToList();
            // Khazna_Moved_List = Khazna_Moved.GetKhznaMoved_ByAccountID(int.Parse(AccountDropID.SelectedValue));

            Bank_Moved_List       = db.BankMoved.ToList().Where(o => o.AccountID == int.Parse(AccountDropID.SelectedValue)).ToList();
            Purchase_Invoice_List = db.PurchaseInvoice.ToList().Where(p => p.SubAccountId == int.Parse(AccountDropID.SelectedValue)).ToList();
            //Purchase_Invoice.GetPurchaseInvoiceBySubID(int.Parse(AccountDropID.SelectedValue));


            SubAccount sub_Account = new SubAccount();

            sub_Account = db.SubAccount.ToList().FirstOrDefault(s => s.ID == int.Parse(AccountDropID.SelectedValue));//  sub_Account.GetSubAccount_ByID(int.Parse(AccountDropID.SelectedValue)).ElementAtOrDefault(0);
            float Account_Sum = float.Parse(sub_Account.ABalance.ToString());

            Account_Operations           = new AccountOperationsGrd();
            AccountOperations_List       = new List <AccountOperationsGrd>();
            Account_Mony_Operations_List = new List <KhznaMoved>();
            Account_Operations_List      = new List <AccountOperationsGrd>();
            List <AccountOperationsGrd> FinalGrd = new List <AccountOperationsGrd>();
            List <AccountOperationsGrd> LastGrd  = new List <AccountOperationsGrd>();

            //  DateTime.Parse(operation.Date.ToString()).Year
            //DateTime RD= DateTime.ParseExact(sub_Account.RegisterDate.ToString(), "yyyy-MM-dd", null);

            if (sub_Account.BType == "دائن")
            {
                FinalGrd.Add(new AccountOperationsGrd()
                {
                    OperationID   = 0,
                    OperationDate = (DateTime)sub_Account.RegisterDate,

                    CreditBalance   = float.Parse(sub_Account.ABalance.ToString()),
                    Credit_Movement = 0,
                    IndebtBalance   = 0,
                    InDebt_Movement = 0,
                    Description     = "رصيد افتتاحى",
                    State           = sub_Account.BType
                });
            }
            else
            {
                FinalGrd.Add(new AccountOperationsGrd()
                {
                    OperationID   = 0,
                    OperationDate = (DateTime)sub_Account.RegisterDate,

                    CreditBalance   = 0,
                    Credit_Movement = 0,
                    IndebtBalance   = float.Parse(sub_Account.ABalance.ToString()),
                    InDebt_Movement = 0,
                    Description     = "رصيد افتتاحى",
                    State           = sub_Account.BType
                });
            }

            //  LastGrd.Add(FinalGrd[0]);
            //كل العمليات مع الخزنة الخاصة بaccount
            foreach (var Khazna in Khazna_Moved_List)
            {
                Account_Mony_Operations_List.Add(new KhznaMoved
                {
                    ID          = Khazna.ID,
                    state       = Khazna.state == true ? false : true,
                    Value       = Khazna.Value,
                    Description = Khazna.Description,
                    AccountID   = Khazna.AccountID,
                    Date        = Khazna.Date
                });
            }

            //كل العمليات الواقعة على التعاملات البنكية
            foreach (var bank in Bank_Moved_List)
            {
                Account_Mony_Operations_List.Add(new KhznaMoved
                {
                    ID          = bank.ID,
                    state       = bank.state == true ? false : true,
                    Value       = bank.Value,
                    Description = bank.Description,
                    AccountID   = bank.AccountID,
                    Date        = bank.Date
                });
            }


            //فواتير الشراء
            foreach (var Pur in Purchase_Invoice_List)
            {
                Account_Mony_Operations_List.Add(new KhznaMoved
                {
                    ID          = int.Parse(Pur.Id),
                    state       = (bool)Pur.PurchaseType,
                    Value       = decimal.Parse(Pur.Total.ToString()),
                    Description = Pur.PurchaseType == true?"شراء":"مرتجع شراء",
                    AccountID   = Pur.SubAccountId,
                    Date        = DateTime.Parse(Pur.InvoiceDate.ToString(), CultureInfo.CreateSpecificCulture("ar-EG"))
                });
            }
            List <TransportCommand> TransportComandList = new List <TransportCommand>();

            TransportComandList = db.TransportCommand.ToList();
            //اوامر النقل
            foreach (var Pur in TransportComandList)
            {
                Account_Mony_Operations_List.Add(new KhznaMoved
                {
                    ID          = Pur.Id,
                    state       = true,
                    Value       = decimal.Parse(Pur.TotalTransportPrice.ToString()),
                    Description = "امر نقل",
                    AccountID   = Pur.SubAccVendorId,
                    Date        = ExtendedMethod.FormatDate(ExtendedMethod.ParseDateToString(DateTime.Parse(Pur.TransportCommandTime.ToString())))
                });
            }


            // Account_Mony_Operations_List.OrderBy(a => a.Date);


            //Concatination//////////////////////////////////////////////////////////////////////////////////////////////////////////

            ConcatenationLists(Account_Mony_Operations_List, Account_Operations_List, Account_Sum);
            //الشغل على Account_Operations_List
            int i = 1;

            Account_Operations_List = Account_Operations_List.OrderBy(o => o.OperationDate).ToList();
            attemptValue            = FinalGrd[0].State == "دائن" ? FinalGrd[0].CreditBalance : FinalGrd[0].IndebtBalance;
            string CurrentState = "";

            foreach (var operation in Account_Operations_List)
            {
                //CurrentState = FinalGrd[i - 1].State == "مدين" ? Math.Sign(attemptValue + operation.InDebt_Movement - operation.Credit_Movement) >= 0 ? "مدين" : "دائن" :
                //     Math.Sign(attemptValue +  operation.Credit_Movement- operation.InDebt_Movement) >= 0 ? "دائن" : "مدين";

                if (FinalGrd[i - 1].State == "مدين")
                {
                    if (operation.InDebt_Movement > 0)
                    {
                        attemptValue = Math.Abs(attemptValue + operation.InDebt_Movement - operation.Credit_Movement);
                        if (attemptValue > 0)
                        {
                            CurrentState = "مدين";
                        }
                        else
                        {
                            CurrentState = "دائن";
                        }
                    }
                    else
                    {
                        attemptValue = (attemptValue - operation.Credit_Movement + operation.InDebt_Movement);
                        if (attemptValue > 0)
                        {
                            CurrentState = "مدين";
                        }
                        else
                        {
                            CurrentState = "دائن";
                            attemptValue = -attemptValue;
                        }
                    }
                }
                else
                {
                    if (operation.Credit_Movement > 0)
                    {
                        attemptValue = Math.Abs(attemptValue + operation.Credit_Movement - operation.InDebt_Movement);
                        if (attemptValue > 0)
                        {
                            CurrentState = "دائن";
                        }
                        else
                        {
                            CurrentState = "مدين";
                        }
                    }
                    else
                    {
                        attemptValue = (attemptValue - operation.InDebt_Movement + operation.Credit_Movement);
                        if (attemptValue > 0)
                        {
                            CurrentState = "دائن";
                        }
                        else
                        {
                            CurrentState = "مدين";
                            attemptValue = -attemptValue;
                        }
                    }
                }
                if (CurrentState == "دائن")
                {
                    FinalGrd.Add(new AccountOperationsGrd()
                    {
                        CreditBalance   = attemptValue,
                        Credit_Movement = operation.Credit_Movement,
                        IndebtBalance   = operation.IndebtBalance,
                        InDebt_Movement = operation.InDebt_Movement,
                        Description     = operation.Description,
                        OperationDate   = operation.OperationDate,
                        OperationID     = operation.OperationID,
                        State           = "دائن"
                    });
                }
                else
                {
                    //if (operation.InDebt_Movement  > 0)
                    //{
                    //    attemptValue = Math.Abs(attemptValue + operation.InDebt_Movement - operation.Credit_Movement);
                    //}
                    //else
                    //{
                    //    attemptValue = Math.Abs(attemptValue + operation.Credit_Movement - operation.InDebt_Movement);
                    //}

                    FinalGrd.Add(new AccountOperationsGrd()
                    {
                        CreditBalance   = operation.CreditBalance,
                        Credit_Movement = operation.Credit_Movement,
                        IndebtBalance   = attemptValue,// operation.IndebtBalance,
                        InDebt_Movement = operation.InDebt_Movement,
                        Description     = operation.Description,
                        OperationDate   = operation.OperationDate,
                        OperationID     = operation.OperationID,
                        State           = "مدين"
                    });
                }



                i++;
            }



            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


            string fromdate = ReformateDateFromPicker(FromDateTxt.Text); // DateTime.Parse(FromDateTxt.Text).Year + "-" + DateTime.Parse(FromDateTxt.Text).Month + "-" + DateTime.Parse(FromDateTxt.Text).Day;
            string Todate   = ReformateDateFromPicker(ToDateTxt.Text);   //DateTime.Parse(ToDateTxt.Text).Year + "-" + DateTime.Parse(ToDateTxt.Text).Month + "-" + DateTime.Parse(ToDateTxt.Text).Day;
            var    mydate   = DateTime.Parse(fromdate, CultureInfo.CreateSpecificCulture("ar-EG"));
            var    mydateTo = DateTime.Parse(Todate, CultureInfo.CreateSpecificCulture("ar-EG"));

            LastGrd.Add(FinalGrd.Where(o => o.OperationDate < mydate).LastOrDefault());
            if (LastGrd.Last() == null)
            {
                LastGrd.Remove(LastGrd.Last());
            }
            LastGrd.AddRange(FinalGrd.Where(o => o.OperationDate >= mydate & o.OperationDate <= mydateTo));
            AccountGrd.DataSource = LastGrd;// FinalGrd.Where(o => o.OperationDate < DateTime.Parse(fromdate)).LastOrDefault() && o.OperationDate >= DateTime.Parse(fromdate) & o.OperationDate <= DateTime.Parse(Todate) ); //Account_Operations_List.Where(o=>o.OperationDate >= DateTime.Parse(FromDateTxt.Text) &  o.OperationDate <= DateTime.Parse(ToDateTxt.Text));
            AccountGrd.DataBind();

            GridView1.DataSource = LastGrd;
            GridView1.DataBind();
            Textbox1.Text      = FromDateTxt.Text;
            Textbox2.Text      = ToDateTxt.Text;
            Dropdownlist1.Text = AccountDropID.SelectedItem.Text;
        }