public ICollection <ErrorHandlerClass> SaveDeductionMaster(DeductionMaster objDeductionMaster) { List <ErrorHandlerClass> lstErr = new List <ErrorHandlerClass>(); DataAccess da = new DataAccess(); try { da.Open_Connection(); da.BEGIN_TRANSACTION(); InsertDeductionMaster(objDeductionMaster, da, lstErr); foreach (ErrorHandlerClass objerr in lstErr) { if (objerr.Type == "E") { da.ROLLBACK_TRANSACTION(); return(lstErr); } } da.COMMIT_TRANSACTION(); } catch (Exception ex) { if (da != null) { da.ROLLBACK_TRANSACTION(); } objErrorHandlerClass.Type = ErrorConstant.strAboartType; objErrorHandlerClass.MsgId = 0; objErrorHandlerClass.Message = ex.Message.ToString(); objErrorHandlerClass.RowNo = 0; objErrorHandlerClass.FieldName = ""; objErrorHandlerClass.LogCode = ""; lstErr.Add(objErrorHandlerClass); } finally { if (da != null) { da.Close_Connection(); da = null; } } return(lstErr); }
public string UpdateDeductionMaster(DeductionMaster argDeductionMaster, DataAccess da, List <ErrorHandlerClass> lstErr) { da.Open_Connection(); SqlParameter[] param = new SqlParameter[7]; param[0] = new SqlParameter("@DesuctionId", argDeductionMaster.DesuctionId); param[1] = new SqlParameter("@Deductions", argDeductionMaster.Deductions); param[2] = new SqlParameter("@DeductionPercentage", argDeductionMaster.DeductionPercentage); param[3] = new SqlParameter("@ModifiedBy", argDeductionMaster.ModifiedBy); param[4] = new SqlParameter("@Type", SqlDbType.Char); param[4].Size = 1; param[4].Direction = ParameterDirection.Output; param[5] = new SqlParameter("@Message", SqlDbType.VarChar); param[5].Size = 255; param[5].Direction = ParameterDirection.Output; param[6] = new SqlParameter("@returnvalue", SqlDbType.VarChar); param[6].Size = 20; param[6].Direction = ParameterDirection.Output; int i = da.NExecuteNonQuery("Proc_UpdateDeductionMaster", param); string strMessage = Convert.ToString(param[5].Value); string strType = Convert.ToString(param[4].Value); string strRetValue = Convert.ToString(param[6].Value); objErrorHandlerClass.Type = strType; objErrorHandlerClass.MsgId = 0; objErrorHandlerClass.Message = strMessage.ToString(); objErrorHandlerClass.RowNo = 0; objErrorHandlerClass.FieldName = ""; objErrorHandlerClass.LogCode = ""; objErrorHandlerClass.ReturnValue = strRetValue; lstErr.Add(objErrorHandlerClass); return(strRetValue); }