private void ViewPledgeMembers_Load(object sender, EventArgs e) { CenterToScreen(); m_pledge_settings = this.Tag as ic.pledgeSettingC; InitializeGridColumnMain(); backworker.RunWorkerAsync(); }
public static void GetPledgeSettings(xing xd) { if (DATA_CURRENT_PLEDGE_SETTINGS == null) { DATA_CURRENT_PLEDGE_SETTINGS = new SortedList <int, ic.pledgeSettingC>(); } string _table_name = "pledge_settings_tb"; if (wdata.TABLE_STAMP == null) { wdata.TABLE_STAMP = new SortedList <string, long>(); } if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1) { wdata.TABLE_STAMP.Add(_table_name, 0); } // bool is_new = false; int _hlp_id = 0; var _xd = xd == null ? new xing() : xd; string _str = string.Empty; bool load_all = false; var _temp_val = _xd.GetTimeStamp(_table_name); if (DATA_CURRENT_PLEDGE_SETTINGS.Keys.Count == 0) { _str = "select * from " + _table_name + " where status=0"; is_new = true; load_all = true; } else { if (wdata.TABLE_STAMP[_table_name] == _temp_val) { return; } _str = string.Format("select * from " + _table_name + " where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]); } wdata.TABLE_STAMP[_table_name] = _temp_val;; List <int> m_upd_ids = new List <int>(); using (var _dr = _xd.SelectCommand(_str)) { if (_dr == null) { return; } ic.pledgeSettingC _obj = null; while (_dr.Read()) { _obj = null; if (load_all) { _obj = new ic.pledgeSettingC(); is_new = true; } else { try { _obj = datam.DATA_CURRENT_PLEDGE_SETTINGS[_dr["pls_id"].ToInt32()]; is_new = false; } catch (Exception ex) { if (_obj == null) { _obj = new ic.pledgeSettingC(); is_new = true; } } } if (is_new) { _obj.account_id = _dr["account_id"].ToInt32(); _obj.pls_id = _dr["pls_id"].ToInt32(); DATA_CURRENT_PLEDGE_SETTINGS.Add(_obj.pls_id, _obj); } _obj.pls_id = _dr["pls_id"].ToInt32(); _hlp_id = _dr["status"].ToInt16(); _obj.status = (em.pledge_setting_statusS)_dr["status"].ToInt16(); _obj.start_date = _dr.GetDateTime("start_date"); _obj.end_date = _dr.GetDateTime("end_date"); _obj.end_fs_id = fn.GetFSID(_obj.end_date.Value); _obj.start_fs_id = fn.GetFSID(_obj.start_date.Value); _obj.pledge_name = _dr["pledge_name"].ToStringNullable(); _obj.paid_amount = _dr["paid_amount"].ToInt32(); _obj.pledged_amount = _dr["amount_pledged"].ToInt32(); if (datam.CURR_FS.fs_id > _obj.end_fs_id & _obj.status == em.pledge_setting_statusS.valid) { m_upd_ids.Add(_obj.pls_id); _obj.status = em.pledge_setting_statusS.expired; } } } if (m_upd_ids.Count > 0) { foreach (var _t in m_upd_ids) { _xd.SingleUpdateCommandALL("pledge_settings_tb", new string[] { "status", "pls_id" }, new object[] { em.pledge_setting_statusS.expired.ToInt16(), _t }, 1); // xd.SingleUpdateCommandALL("pledge_master_tb", new string[] { "pl_status", "pls_id" }, new object[] { em.pledge_statusS.expired.ToInt16(), _t }, 1); // xd.SingleUpdateCommandALL("pledge_payment_mvt_tb", new string[] { "status", "pls_id" }, new object[] { 2,//expired _t }, 1); } } if (xd == null) { _xd.CommitTransaction(); } }
public void NewRecord(ic.pledgeSettingC k) { Application.DoEvents(); iGrid1.BeginUpdate(); iGRow _row = null; float _total = 0f; float _paid = 0f; float _percent = 0f; iGRow parent_row = null; _row = iGrid1.Rows.Add(); _row.Font = new Font("georgia", 12, FontStyle.Regular); _row.ReadOnly = iGBool.True; _row.Cells["no"].Value = iGrid1.Rows.Count; _row.Cells["pledge_name"].Value = k.pledge_name; _row.Cells["pledge"].Value = datam.DATA_ACCOUNTS[k.account_id].account_name; _row.Cells["pledge"].ForeColor = Color.Gray; if (string.IsNullOrEmpty(k.pledge_name)) { _row.Cells["pledge_name"].Value = _row.Cells["pledge"].Value; } _row.Cells["pledge_amount"].Value = k.pledged_amount; _row.Cells["paid"].Value = k.paid_amount; if (k.start_date != null) { _row.Cells["start_date"].Value = k.start_date.Value.ToMyShortDate(); } if (k.end_date != null) { _row.Cells["end_date"].Value = k.end_date.Value.ToMyShortDate(); } if (k.balance > 0) { _row.Cells["balance"].Value = k.balance; } if (k.paid_amount > 0) { _total = k.pledged_amount; _paid = k.paid_amount; _percent = ((_paid / _total) * 100); _row.Cells["p_comp"].Value = string.Format(" {0} %", Math.Round(_percent, 1)); } else { _row.Cells["p_comp"].Value = string.Format(" {0} %", 0); } _row.Key = string.Format("{0}", k.pls_id); _row.Tag = k; _row.Visible = true; _row.AutoHeight(); _row.Height += 2; parent_row = _row; parent_row.TreeButton = iGTreeButtonState.Hidden; parent_row.Cells["mem_count"].Value = null; iGrid1.Cols.AutoWidth(); iGrid1.AutoResizeCols = false; iGrid1.EndUpdate(); }
private void buttonX1_Click(object sender, EventArgs e) { if (!IsValid()) { return; } string _str = "Are You Sure You Want To Save This Record ??"; if (!dbm.WarningMessage(_str, "Save Warning")) { return; } ic.pledgeSettingC _pledge = new ic.pledgeSettingC(); _pledge.pledge_name = fGrid.Rows["pledge_name"].Cells[1].Text.Trim(); _pledge.pledge_name.ToProperCase(); _pledge.start_date = System.Convert.ToDateTime(fGrid.Rows["start_date"].Cells[1].AuxValue); _pledge.start_fs_id = fn.GetFSID(_pledge.start_date.Value); _pledge.status = em.pledge_setting_statusS.valid; if (fGrid.Rows["end_date"].Cells[1].AuxValue != null) { _pledge.end_date = System.Convert.ToDateTime(fGrid.Rows["end_date"].Cells[1].AuxValue); _pledge.end_fs_id = fn.GetFSID(_pledge.end_date.Value); } ic.accountC account = (fGrid.Rows["account"].Cells[1].AuxValue as fnn.iGComboItemEX).Tag as ic.accountC; if (account != null) { _pledge.account_id = account.account_id; } using (var xd = new xing()) { _pledge.pls_id = xd.SingleInsertCommandTSPInt("pledge_settings_tb", new string[] { "account_id", "start_date", "start_fs_id", "end_date", "end_fs_id", "fs_date", "pc_us_id", "exp_type", "fs_time_stamp", "lch_id", "start_year", "pledge_name" }, new object[] { _pledge.account_id, _pledge.start_date, _pledge.start_fs_id, _pledge.end_date, _pledge.end_fs_id, sdata.CURR_DATE, sdata.PC_US_ID, emm.export_type.insert.ToByte(), 0, datam.LCH_ID, _pledge.start_date.Value.Year, _pledge.pledge_name }); xd.CommitTransaction(); } if (this.Owner is Pledge.PledgesManagerB) { (this.Owner as Pledge.PledgesManagerB).NewRecord(_pledge); } buttonX2.PerformClick(); }