private PardakhtBussines LoadData(SqlDataReader dr) { var item = new PardakhtBussines(); try { item.Guid = (Guid)dr["Guid"]; item.Modified = (DateTime)dr["Modified"]; item.DateM = (DateTime)dr["DateM"]; item.Description = dr["Description"].ToString(); item.Number = (long)dr["Number"]; item.TafsilGuid = (Guid)dr["TafsilGuid"]; item.MoeinGuid = (Guid)dr["MoeinGuid"]; item.UserGuid = (Guid)dr["UserGuid"]; item.SanadNumber = (long)dr["SanadNumber"]; item.TafsilName = dr["TafsilName"].ToString(); item.UserName = dr["UserName"].ToString(); item.ServerDeliveryDate = (DateTime)dr["ServerDeliveryDate"]; item.ServerStatus = (ServerStatus)dr["ServerStatus"]; item.IsModified = true; item.CheckMoshtariList = AsyncContext.Run(() => PardakhtCheckMoshtariBussines.GetAllAsync(item.Guid)); item.CheckShakhsiList = AsyncContext.Run(() => PardakhtCheckShakhsiBussines.GetAllAsync(item.Guid)); item.HavaleList = AsyncContext.Run(() => PardakhtHavaleBussines.GetAllAsync(item.Guid)); item.NaqdList = AsyncContext.Run(() => PardakhtNaqdBussines.GetAllAsync(item.Guid)); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } return(item); }
public async Task <ReturnedSaveFuncInfo> SaveAsync(PardakhtCheckMoshtariBussines item, SqlTransaction tr) { var res = new ReturnedSaveFuncInfo(); try { var cmd = new SqlCommand("sp_PardakhtCheckM_Insert", tr.Connection, tr) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@guid", item.Guid); cmd.Parameters.AddWithValue("@modif", item.Modified); cmd.Parameters.AddWithValue("@desc", item.Description ?? ""); cmd.Parameters.AddWithValue("@masterGuid", item.MasterGuid); cmd.Parameters.AddWithValue("@checkGuid", item.CheckGuid); cmd.Parameters.AddWithValue("@serverSt", (short)item.ServerStatus); cmd.Parameters.AddWithValue("@serverDate", item.ServerDeliveryDate); await cmd.ExecuteNonQueryAsync(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } return(res); }
private async void mnuKharj_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0 || DGrid.CurrentRow == null) { return; } var st = (EnCheckM)DGrid[dgStatus.Index, DGrid.CurrentRow.Index].Value; if (st == EnCheckM.Kharj || st == EnCheckM.Naqd) { frmNotification.PublicInfo.ShowMessage($"شما مجاز به خرج چک {st.GetDisplay()} نمی باشید"); return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var price = (decimal)DGrid[dgPrice.Index, DGrid.CurrentRow.Index].Value; var bankName = DGrid[dgBankName.Index, DGrid.CurrentRow.Index].Value.ToString(); var checkNumber = DGrid[dgCheckNumber.Index, DGrid.CurrentRow.Index].Value.ToString(); var sarresid = DGrid[dgSarresid.Index, DGrid.CurrentRow.Index].Value.ToString(); var cls = new PardakhtBussines(); var pardakhtcheck = new PardakhtCheckMoshtariBussines() { Guid = Guid.NewGuid(), Modified = DateTime.Now, Description = $"خرج چک {checkNumber} {bankName} به سررسید {sarresid}", Price = price, CheckGuid = guid, MasterGuid = cls.Guid }; cls.AddToDetList(pardakhtcheck); var frm = new frmPardakhtMain(cls); if (frm.ShowDialog(this) == DialogResult.OK) { await LoadDataAsync(); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private PardakhtCheckMoshtariBussines LoadData(SqlDataReader dr) { var item = new PardakhtCheckMoshtariBussines(); try { item.Guid = (Guid)dr["Guid"]; item.Modified = (DateTime)dr["Modified"]; item.MasterGuid = (Guid)dr["MasterGuid"]; item.Description = dr["Description"].ToString(); item.CheckGuid = (Guid)dr["CheckGuid"]; item.Price = (decimal)dr["Price"]; item.ServerDeliveryDate = (DateTime)dr["ServerDeliveryDate"]; item.ServerStatus = (ServerStatus)dr["ServerStatus"]; } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } return(item); }
private object GetRowInfo(int index) { try { var o = new object(); if (index > DGrid.RowCount - 1) { return(null); } if (DGrid[DGType.Index, index].Value.ToString() == "نقد") { var temp = new PardakhtNaqdBussines() { Guid = (Guid)(DGrid[DgGuid.Index, index].Value), Price = (DGrid[DGPrice.Index, index].Value.ToString().ParseToDecimal()), SandouqTafsilGuid = (Guid)(DGrid[DGTafsilGuid.Index, index].Value), Description = DGrid[DG_TempDescription.Index, index].Value.ToString() }; o = temp; } else if (DGrid[DGType.Index, index].Value.ToString() == "چک دریافتی") { var temp = new PardakhtCheckMoshtariBussines() { Guid = (Guid)(DGrid[DgGuid.Index, index].Value), Price = (DGrid[DGPrice.Index, index].Value.ToString().ParseToDecimal()), Description = DGrid[DG_TempDescription.Index, index].Value.ToString(), CheckGuid = (Guid)(DGrid[dgCheckGuid.Index, index].Value) }; o = temp; } else if (DGrid[DGType.Index, index].Value.ToString() == "حواله") { var temp = new PardakhtHavaleBussines() { Guid = (Guid)(DGrid[DgGuid.Index, index].Value), Price = (DGrid[DGPrice.Index, index].Value.ToString().ParseToDecimal()), BankTafsilGuid = (Guid)(DGrid[DGTafsilGuid.Index, index].Value), Number = DGrid[DGNumber.Index, index].Value.ToString(), Description = DGrid[DG_TempDescription.Index, index].Value.ToString() }; o = temp; } else if (DGrid[DGType.Index, index].Value.ToString() == "چک شخصی") { var temp = new PardakhtCheckShakhsiBussines() { Guid = (Guid)(DGrid[DgGuid.Index, index].Value), Price = (DGrid[DGPrice.Index, index].Value.ToString().ParseToDecimal()), Description = DGrid[DG_TempDescription.Index, index].Value.ToString(), CheckPageGuid = (Guid)(DGrid[dgCheckGuid.Index, index].Value), Number = DGrid[DGNumber.Index, index].Value.ToString(), DateSarResid = (DateTime)DGrid[DGDateSarresid.Index, index].Value }; o = temp; } return(o); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); return(null); } }