public bool DeleteTGenerateIMEI(TGenerateIMEI TGenerateIMEI) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteTGenerateIMEI"; cmd.Parameters.AddWithValue("@PkGenerateIMEIID", TGenerateIMEI.PkGenerateIMEIID); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { TGenerateIMEI.msg = ObjTrans.ErrorMessage; return(false); } }
public bool AddTGenerateIMEI(TGenerateIMEI TGenerateIMEI) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddTGenerateIMEI"; cmd.Parameters.AddWithValue("@PkGenerateIMEIID", TGenerateIMEI.PkGenerateIMEIID); cmd.Parameters.AddWithValue("@IMEINo", TGenerateIMEI.IMEINo); cmd.Parameters.AddWithValue("@FkVoucherNo", TGenerateIMEI.FkVoucherNo); cmd.Parameters.AddWithValue("@FkStockTrnNo", TGenerateIMEI.FkStockTrnNo); cmd.Parameters.AddWithValue("@ItemNo", TGenerateIMEI.ItemNo); cmd.Parameters.AddWithValue("@IsSales", TGenerateIMEI.IsSales); cmd.Parameters.AddWithValue("@SalesStockTrnNo", TGenerateIMEI.SalesStockTrnNo); cmd.Parameters.AddWithValue("@SalesFkVoucherNo", TGenerateIMEI.SalesFkVoucherNo); cmd.Parameters.AddWithValue("@IsActive", TGenerateIMEI.IsActive); cmd.Parameters.AddWithValue("@UserID", TGenerateIMEI.UserID); cmd.Parameters.AddWithValue("@UserDate", TGenerateIMEI.UserDate); cmd.Parameters.AddWithValue("@CompanyNo", TGenerateIMEI.CompanyNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { TGenerateIMEI.msg = ObjTrans.ErrorMessage; return(false); } }
public TGenerateIMEI ModifyTGenerateIMEIByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from TGenerateIMEI where PkGenerateIMEIID =" + ID; cmd = new SqlCommand(sql, Con); cmd.Connection = Con; Con.Open(); cmd.CommandType = CommandType.Text; SqlDataReader dr; dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.HasRows) { TGenerateIMEI MM = new TGenerateIMEI(); while (dr.Read()) { MM.PkGenerateIMEIID = Convert.ToInt32(dr["PkGenerateIMEIID"]); if (!Convert.IsDBNull(dr["IMEINo"])) { MM.IMEINo = Convert.ToString(dr["IMEINo"]); } if (!Convert.IsDBNull(dr["FkVoucherNo"])) { MM.FkVoucherNo = Convert.ToInt64(dr["FkVoucherNo"]); } if (!Convert.IsDBNull(dr["FkStockTrnNo"])) { MM.FkStockTrnNo = Convert.ToInt64(dr["FkStockTrnNo"]); } if (!Convert.IsDBNull(dr["ItemNo"])) { MM.ItemNo = Convert.ToInt64(dr["ItemNo"]); } if (!Convert.IsDBNull(dr["IsSales"])) { MM.IsSales = Convert.ToBoolean(dr["IsSales"]); } if (!Convert.IsDBNull(dr["SalesStockTrnNo"])) { MM.SalesStockTrnNo = Convert.ToInt64(dr["SalesStockTrnNo"]); } if (!Convert.IsDBNull(dr["SalesFkVoucherNo"])) { MM.SalesFkVoucherNo = Convert.ToInt64(dr["SalesFkVoucherNo"]); } if (!Convert.IsDBNull(dr["IsActive"])) { MM.IsActive = Convert.ToBoolean(dr["IsActive"]); } if (!Convert.IsDBNull(dr["UserID"])) { MM.UserID = Convert.ToInt64(dr["UserID"]); } if (!Convert.IsDBNull(dr["UserDate"])) { MM.UserDate = Convert.ToDateTime(dr["UserDate"]); } if (!Convert.IsDBNull(dr["CompanyNo"])) { MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new TGenerateIMEI()); }