private void btnDo_Click(object sender, EventArgs e) { txtInsuranceNumber.Text = txtInsuranceNumber.Text.Trim(); if (txtInsuranceNumber.Text.Length <= 0) { return; } string cond = "insuranceNumber='" + txtInsuranceNumber.Text + "' and cancel=1"; ViewInsuranceInfoBS bs = new ViewInsuranceInfoBS(); ViewInsuranceInfoData dataset = bs.load(cond); if (dataset.Tables[0].Rows.Count <= 0) { MessageBox.Show("پیدا نشد"); return; } int n = new InsuranceInfoBS().recover(int.Parse(dataset.Tables[0].Rows[0][InsuranceInfoData.id_FIELD].ToString())); if (n <= 0) { MessageBox.Show("امکان بازگرداندن این رکورد حذف شده نیست"); } else { MessageBox.Show("رکورد مورد نظر بازگردانده شد"); } }
public ViewInsuranceInfoData load(string condition) { ViewInsuranceInfoData ds = new ViewInsuranceInfoData(); dp.loadToDataSet(ViewInsuranceInfoData.VIEW_INSURANCEINFO_TABLE, ds, condition); fillRadif(ds); return(ds); }
public ViewInsuranceInfoData loadUserLimitedList(int userId, string condition, string orderby) { ViewInsuranceInfoData dataSet = new ViewInsuranceInfoData(); dp.executeSelect(userLimitedQuery(userId, condition, orderby), dataSet, ViewInsuranceInfoData.VIEW_INSURANCEINFO_TABLE); int count = dataSet.Tables[ViewInsuranceInfoData.VIEW_INSURANCEINFO_TABLE].Rows.Count; fillRadif(dataSet); fillPastExpirTime_and_shamsiEndDate(dataSet); return(dataSet); }
/* * آنهایی که تاریخ Expier * آنها از امروز رد شده و هنوز انجام نشده نگردیده اند در یک ستون به نام EXP * یک علامت دو ستاره قرار می دهیم * یک ستون با تاریخ اتمام شمسی اضافه میکنیم */ protected void fillPastExpirTime_and_shamsiEndDate(ViewInsuranceInfoData ds) { string condition = " haveDid = 0 "; condition += " and enddate >= getdate() and enddate - daysbeforExp < getdate() "; Boolean haveDid; DateTime date = DateTime.Now; int daysBeforExp = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (ds.Tables[0].Rows[i][ViewInsuranceInfoData.haveDid_FIELD].ToString() != null) { haveDid = Boolean.Parse(ds.Tables[0].Rows[i][ViewInsuranceInfoData.haveDid_FIELD].ToString()); } if (ds.Tables[0].Rows[i][ViewInsuranceInfoData.endDate_FIELD].ToString() != null) { date = DateTime.Parse(ds.Tables[0].Rows[i][ViewInsuranceInfoData.endDate_FIELD].ToString()); } if (ds.Tables[0].Rows[i][ViewInsuranceInfoData.DAYSBEFOREXP_FIELD].ToString() != null) { daysBeforExp = int.Parse(ds.Tables[0].Rows[i][ViewInsuranceInfoData.DAYSBEFOREXP_FIELD].ToString()); } // TimeSpan ts = new TimeSpan(daysBeforExp, 0, 0, 0); if (date < DateTime.Now) { ds.Tables[0].Rows[i][ViewInsuranceInfoData.PASTOFEXPIRE] = "**"; } if (date != null) { ds.Tables[0].Rows[i][ViewInsuranceInfoData.SHAMSIDATE] = RMX_TOOLS.date.DateXFormer.gregorianToPersianString(date); } if (ds.Tables[0].Rows[i][ViewInsuranceInfoData.beginDate_FIELD].ToString() != null) { date = DateTime.Parse(ds.Tables[0].Rows[i][ViewInsuranceInfoData.beginDate_FIELD].ToString()); } ds.Tables[0].Rows[i][ViewInsuranceInfoData.BEGINDATE_SHAMSI] = RMX_TOOLS.date.DateXFormer.gregorianToPersianString(date); } }