protected void SaerchBtn_Click(object sender, EventArgs e) { RsltTxt.Text = ""; SaveBtn.Visible = true; TotalSum = 0; khazna_Moved = new KhznaMoved(); entry = new Entry(); EntryGrd_List = new List <EntryGrd>(); //entry.maxid(); int maxid = (int)db.Entry.ToList().Max(o => o.EntryID) + 1; //entry.MoveID; Khazna_Moved_List = new List <KhznaMoved>(); ToDateTxt.Text = ReformateDateFromPicker(ToDateTxt.Text); Khazna_Moved_List = db.KhznaMoved.ToList().Where(o => o.AccountID == int.Parse(AccountDropID.SelectedValue) & o.state == false & o.Date <= ExtendedMethod.FormatDate(ToDateTxt.Text)).ToList(); // khazna_Moved.GetAllKhznaMovedByKhaznaIDAndStateAndDate(int.Parse(AccountDropID.SelectedValue), // 0, ToDateTxt.Text); int i = 0; foreach (var move in Khazna_Moved_List) { if (i == 0) { if (move.EntryState == false) { SaveBtn.Enabled = true; i++; } else { SaveBtn.Enabled = false; } } EntryGrd_List.Add(new EntryGrd() { EntryID = (int)move.EntryID, EntryState = (bool)move.EntryState, Description = move.Description, ID = move.ID, Value = float.Parse(move.Value.ToString()), SubID = int.Parse(move.AccountID.ToString()), }); } NewEntryTxtID.Text = maxid.ToString(); EntryGrdV.DataSource = EntryGrd_List; EntryGrdV.DataBind(); }
public void Initialize_Page() { Sub_Account = new SubAccount(); ToDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; AccountDropID.DataSource = db.SubAccount.ToList().Where(o => o.MainAccount_id == 1103).ToList();// Sub_Account.GetSubAccount_ByUpID(1103); AccountDropID.DataTextField = "name"; AccountDropID.DataValueField = "ID"; AccountDropID.DataBind(); EntryGrdV.DataSource = null; EntryGrdV.DataBind(); SaveBtn.Visible = false; Khazna_Moved_List = new List <KhznaMoved>(); NewEntryTxtID.Text = ""; TotalText.Text = ""; }