public ICollection <ErrorHandlerClass> SaveLanguageMaster(LanguageMaster argLanguageMaster) { List <ErrorHandlerClass> lstErr = new List <ErrorHandlerClass>(); DataAccess da = new DataAccess(); try { da.Open_Connection(); da.BEGIN_TRANSACTION(); InsertLanguageMaster(argLanguageMaster, 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 void InsertLanguageMaster(LanguageMaster argLanguageMaster, DataAccess da, List <ErrorHandlerClass> lstErr) { da.Open_Connection(); SqlParameter[] param = new SqlParameter[8]; param[0] = new SqlParameter("@Language", argLanguageMaster.Language); param[1] = new SqlParameter("@Reads", argLanguageMaster.Reads); param[2] = new SqlParameter("@Speak", argLanguageMaster.Speak); param[3] = new SqlParameter("@Write", argLanguageMaster.Write); param[4] = new SqlParameter("@RRId", argLanguageMaster.RRId); param[5] = new SqlParameter("@Type", SqlDbType.Char); param[5].Size = 1; param[5].Direction = ParameterDirection.Output; param[6] = new SqlParameter("@Message", SqlDbType.VarChar); param[6].Size = 255; param[6].Direction = ParameterDirection.Output; param[7] = new SqlParameter("@returnvalue", SqlDbType.VarChar); param[7].Size = 20; param[7].Direction = ParameterDirection.Output; int i = da.NExecuteNonQuery("Proc_InsertLanguageMaster", param); string strMessage = Convert.ToString(param[6].Value); string strType = Convert.ToString(param[5].Value); string strRetValue = Convert.ToString(param[7].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 i; }